[svn-upgrade] Integrating new upstream version, shadow (4.0.8)

This commit is contained in:
nekral-guest
2007-10-07 11:46:07 +00:00
parent 0ee095abd8
commit 8e167d28af
414 changed files with 21641 additions and 27358 deletions

View File

@@ -27,9 +27,6 @@ libmisc_a_SOURCES = \
isexpired.c \
limits.c \
list.c log.c \
login_access.c \
login_desrpc.c \
login_krb.c \
loginprompt.c \
mail.c \
motd.c \

View File

@@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.9.4 from Makefile.am.
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -57,16 +57,15 @@ am_libmisc_a_OBJECTS = addgrps.$(OBJEXT) age.$(OBJEXT) \
copydir.$(OBJEXT) entry.$(OBJEXT) env.$(OBJEXT) \
failure.$(OBJEXT) fields.$(OBJEXT) getdate.$(OBJEXT) \
hushed.$(OBJEXT) isexpired.$(OBJEXT) limits.$(OBJEXT) \
list.$(OBJEXT) log.$(OBJEXT) login_access.$(OBJEXT) \
login_desrpc.$(OBJEXT) login_krb.$(OBJEXT) \
loginprompt.$(OBJEXT) mail.$(OBJEXT) motd.$(OBJEXT) \
myname.$(OBJEXT) obscure.$(OBJEXT) pam_pass.$(OBJEXT) \
pwd2spwd.$(OBJEXT) pwdcheck.$(OBJEXT) pwd_init.$(OBJEXT) \
rlogin.$(OBJEXT) salt.$(OBJEXT) setugid.$(OBJEXT) \
setup.$(OBJEXT) setupenv.$(OBJEXT) shell.$(OBJEXT) \
strtoday.$(OBJEXT) sub.$(OBJEXT) sulog.$(OBJEXT) \
ttytype.$(OBJEXT) tz.$(OBJEXT) ulimit.$(OBJEXT) utmp.$(OBJEXT) \
valid.$(OBJEXT) xmalloc.$(OBJEXT)
list.$(OBJEXT) log.$(OBJEXT) loginprompt.$(OBJEXT) \
mail.$(OBJEXT) motd.$(OBJEXT) myname.$(OBJEXT) \
obscure.$(OBJEXT) pam_pass.$(OBJEXT) pwd2spwd.$(OBJEXT) \
pwdcheck.$(OBJEXT) pwd_init.$(OBJEXT) rlogin.$(OBJEXT) \
salt.$(OBJEXT) setugid.$(OBJEXT) setup.$(OBJEXT) \
setupenv.$(OBJEXT) shell.$(OBJEXT) strtoday.$(OBJEXT) \
sub.$(OBJEXT) sulog.$(OBJEXT) ttytype.$(OBJEXT) tz.$(OBJEXT) \
ulimit.$(OBJEXT) utmp.$(OBJEXT) valid.$(OBJEXT) \
xmalloc.$(OBJEXT)
libmisc_a_OBJECTS = $(am_libmisc_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -122,17 +121,16 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INTLLIBS = @INTLLIBS@
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
LDFLAGS = @LDFLAGS@
LIBCRACK = @LIBCRACK@
LIBCRYPT = @LIBCRYPT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBMD = @LIBMD@
LIBOBJS = @LIBOBJS@
LIBPAM = @LIBPAM@
LIBS = @LIBS@
LIBSELINUX = @LIBSELINUX@
LIBSKEY = @LIBSKEY@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
@@ -231,9 +229,6 @@ libmisc_a_SOURCES = \
isexpired.c \
limits.c \
list.c log.c \
login_access.c \
login_desrpc.c \
login_krb.c \
loginprompt.c \
mail.c \
motd.c \
@@ -272,9 +267,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libmisc/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libmisc/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu libmisc/Makefile
$(AUTOMAKE) --foreign libmisc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -325,9 +320,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/limits.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/login_access.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/login_desrpc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/login_krb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loginprompt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mail.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motd.Po@am__quote@

View File

@@ -10,7 +10,7 @@
#include <errno.h>
#include "rcsid.h"
RCSID ("$Id: addgrps.c,v 1.6 2003/04/22 10:59:21 kloczek Exp $")
RCSID ("$Id: addgrps.c,v 1.7 2005/03/31 05:14:50 kloczek Exp $")
#define SEP ",:"
/*
* Add groups with names from LIST (separated by commas or colons)
@@ -58,8 +58,7 @@ int add_groups (const char *list)
continue;
}
for (i = 0; i < ngroups && grouplist[i] != grp->gr_gid;
i++);
for (i = 0; i < ngroups && grouplist[i] != grp->gr_gid; i++);
if (i < ngroups)
continue;
@@ -68,9 +67,7 @@ int add_groups (const char *list)
fprintf (stderr, _("Warning: too many groups\n"));
break;
}
tmp =
realloc (grouplist,
(ngroups + 1) * sizeof (GETGROUPS_T));
tmp = realloc (grouplist, (ngroups + 1) * sizeof (GETGROUPS_T));
if (!tmp) {
free (grouplist);
return -1;

View File

@@ -41,7 +41,7 @@
#if defined(SHADOWPWD)
#include "rcsid.h"
RCSID ("$Id: age.c,v 1.9 2004/03/29 00:26:18 kloczek Exp $")
RCSID ("$Id: age.c,v 1.10 2005/03/31 05:14:50 kloczek Exp $")
#ifndef PASSWD_PROGRAM
#define PASSWD_PROGRAM "/bin/passwd"
#endif
@@ -124,8 +124,7 @@ int expire (const struct passwd *pw, const struct spwd *sp)
if (setup_uid_gid (pw, 0))
_exit (126);
execl (PASSWD_PROGRAM, PASSWD_PROGRAM, pw->pw_name,
(char *) 0);
execl (PASSWD_PROGRAM, PASSWD_PROGRAM, pw->pw_name, (char *) 0);
err = errno;
perror ("Can't execute " PASSWD_PROGRAM);
_exit ((err == ENOENT) ? 127 : 126);
@@ -170,8 +169,7 @@ void agecheck (const struct passwd *pw, const struct spwd *sp)
("Your password will expire in %ld days.\n"),
remain);
else if (remain == 1)
printf (_
("Your password will expire tomorrow.\n"));
printf (_("Your password will expire tomorrow.\n"));
else if (remain == 0)
printf (_("Your password will expire today.\n"));
}

View File

@@ -1,4 +1,4 @@
/* $Id: chkname.h,v 1.2 2000/08/26 18:27:17 marekm Exp $ */
/* $Id: chkname.h,v 1.3 2005/03/31 05:14:50 kloczek Exp $ */
#ifndef _CHKNAME_H_
#define _CHKNAME_H_
@@ -9,7 +9,7 @@
#include "defines.h"
extern int check_user_name(const char *);
extern int check_group_name(const char *name);
extern int check_user_name (const char *);
extern int check_group_name (const char *name);
#endif

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: chowndir.c,v 1.7 2003/04/22 10:59:21 kloczek Exp $")
RCSID ("$Id: chowndir.c,v 1.8 2005/03/31 05:14:50 kloczek Exp $")
#include <sys/types.h>
#include <sys/stat.h>
#include "prototypes.h"
@@ -86,8 +86,7 @@ chown_tree (const char *root, uid_t old_uid, uid_t new_uid, gid_t old_gid,
* destination files.
*/
if (strlen (root) + strlen (ent->d_name) + 2 >
sizeof new_name)
if (strlen (root) + strlen (ent->d_name) + 2 > sizeof new_name)
break;
snprintf (new_name, sizeof new_name, "%s/%s", root,
@@ -114,8 +113,7 @@ chown_tree (const char *root, uid_t old_uid, uid_t new_uid, gid_t old_gid,
#endif
if (sb.st_uid == old_uid)
LCHOWN (new_name, new_uid,
sb.st_gid ==
old_gid ? new_gid : sb.st_gid);
sb.st_gid == old_gid ? new_gid : sb.st_gid);
}
closedir (dir);
@@ -126,8 +124,7 @@ chown_tree (const char *root, uid_t old_uid, uid_t new_uid, gid_t old_gid,
if (!stat (root, &sb)) {
if (sb.st_uid == old_uid)
LCHOWN (root, new_uid,
sb.st_gid ==
old_gid ? new_gid : sb.st_gid);
sb.st_gid == old_gid ? new_gid : sb.st_gid);
}
return rc;
}

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: chowntty.c,v 1.10 2003/04/22 10:59:21 kloczek Exp $")
RCSID ("$Id: chowntty.c,v 1.11 2005/03/31 05:14:50 kloczek Exp $")
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
@@ -103,8 +103,7 @@ void chown_tty (const char *tty, const struct passwd *info)
chmod (tty, getdef_num ("TTYPERM", 0600))) {
int err = errno;
snprintf (buf, sizeof buf, _("Unable to change tty %s"),
tty);
snprintf (buf, sizeof buf, _("Unable to change tty %s"), tty);
perror (buf);
SYSLOG ((LOG_WARN,
"unable to change tty `%s' for user `%s'\n", tty,

View File

@@ -30,14 +30,17 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: copydir.c,v 1.10 2004/10/18 20:10:10 kloczek Exp $")
RCSID ("$Id: copydir.c,v 1.12 2005/03/31 05:14:50 kloczek Exp $")
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>
#include "prototypes.h"
#include "defines.h"
#ifdef WITH_SELINUX
#include <selinux/selinux.h>
static int selinux_enabled = -1;
#endif
static const char *src_orig;
static const char *dst_orig;
@@ -50,6 +53,26 @@ struct link_name {
};
static struct link_name *links;
#ifdef WITH_SELINUX
static int selinux_file_context (const char *dst_name)
{
security_context_t scontext = NULL;
if (selinux_enabled < 0)
selinux_enabled = is_selinux_enabled () > 0;
if (selinux_enabled) {
if (matchpathcon (dst_name, 0, &scontext) < 0)
if (security_getenforce ())
return 1;
if (setfscreatecon (scontext) < 0)
if (security_getenforce ())
return 1;
freecon (scontext);
}
return 0;
}
#endif
/*
* remove_link - delete a link from the link list
*/
@@ -80,8 +103,7 @@ static void remove_link (struct link_name *ln)
* check_link - see if a file is really a link
*/
static struct link_name *check_link (const char *name,
const struct stat *sb)
static struct link_name *check_link (const char *name, const struct stat *sb)
{
struct link_name *lp;
int src_len;
@@ -119,9 +141,7 @@ static struct link_name *check_link (const char *name,
* as it goes.
*/
int
copy_tree (const char *src_root, const char *dst_root, uid_t uid,
gid_t gid)
int copy_tree (const char *src_root, const char *dst_root, uid_t uid, gid_t gid)
{
char src_name[1024];
char dst_name[1024];
@@ -202,6 +222,9 @@ copy_tree (const char *src_root, const char *dst_root, uid_t uid,
* the user and then recursively copy that directory.
*/
#ifdef WITH_SELINUX
selinux_file_context (dst_name);
#endif
mkdir (dst_name, sb.st_mode & 0777);
chown (dst_name,
uid == (uid_t) - 1 ? sb.st_uid : uid,
@@ -238,16 +261,19 @@ copy_tree (const char *src_root, const char *dst_root, uid_t uid,
break;
}
oldlink[len] = '\0'; /* readlink() does not NUL-terminate */
if (!strncmp
(oldlink, src_orig, strlen (src_orig))) {
if (!strncmp (oldlink, src_orig, strlen (src_orig))) {
snprintf (dummy, sizeof dummy, "%s%s",
dst_orig,
oldlink + strlen (src_orig));
strcpy (oldlink, dummy);
}
if (symlink(oldlink, dst_name) ||
lchown (dst_name, uid == (uid_t) -1 ? sb.st_uid:uid,
gid == (gid_t) -1 ? sb.st_gid:gid)) {
#ifdef WITH_SELINUX
selinux_file_context (dst_name);
#endif
if (symlink (oldlink, dst_name) ||
lchown (dst_name,
uid == (uid_t) - 1 ? sb.st_uid : uid,
gid == (gid_t) - 1 ? sb.st_gid : gid)) {
err++;
break;
}
@@ -281,8 +307,10 @@ copy_tree (const char *src_root, const char *dst_root, uid_t uid,
*/
if (!S_ISREG (sb.st_mode)) {
if (mknod
(dst_name, sb.st_mode & ~07777, sb.st_rdev)
#ifdef WITH_SELINUX
selinux_file_context (dst_name);
#endif
if (mknod (dst_name, sb.st_mode & ~07777, sb.st_rdev)
|| chown (dst_name,
uid == (uid_t) - 1 ? sb.st_uid : uid,
gid == (gid_t) - 1 ? sb.st_gid : gid)
@@ -302,6 +330,9 @@ copy_tree (const char *src_root, const char *dst_root, uid_t uid,
err++;
break;
}
#ifdef WITH_SELINUX
selinux_file_context (dst_name);
#endif
if ((ofd =
open (dst_name, O_WRONLY | O_CREAT | O_TRUNC, 0)) < 0
|| chown (dst_name,
@@ -381,8 +412,7 @@ int remove_tree (const char *root)
* Make the filename for the current entry.
*/
if (strlen (root) + strlen (ent->d_name) + 2 >
sizeof new_name) {
if (strlen (root) + strlen (ent->d_name) + 2 > sizeof new_name) {
err++;
break;
}

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: env.c,v 1.10 2003/04/22 10:59:22 kloczek Exp $")
RCSID ("$Id: env.c,v 1.11 2005/03/31 05:14:50 kloczek Exp $")
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -179,8 +179,7 @@ void set_env (int argc, char *const *argv)
continue; /* ignore long entries */
if (!(cp = strchr (*argv, '='))) {
snprintf (variable, sizeof variable, "L%d",
noname++);
snprintf (variable, sizeof variable, "L%d", noname++);
addenv (variable, *argv);
} else {
const char **p;

View File

@@ -30,14 +30,13 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: failure.c,v 1.9 2003/04/25 21:11:08 kloczek Exp $")
RCSID ("$Id: failure.c,v 1.12 2005/04/12 14:12:26 kloczek Exp $")
#include <fcntl.h>
#include <stdio.h>
#include "defines.h"
#include "faillog.h"
#include "getdef.h"
#include "failure.h"
#define YEAR (365L*DAY)
/*
* failure - make failure entry
@@ -227,9 +226,12 @@ void failprint (const struct faillog *fail)
if (*lasttime == ' ')
lasttime++;
#endif
printf (_("%d %s since last login. Last was %s on %s.\n"),
printf (ngettext("%d failure since last login.\n"
"Last was %s on %s.\n",
"%d failures since last login.\n"
"Last was %s on %s.\n",
fail->fail_cnt),
fail->fail_cnt,
fail->fail_cnt > 1 ? _("failures") : _("failure"),
lasttime, fail->fail_line);
}

View File

@@ -1,4 +1,4 @@
/* $Id: failure.h,v 1.2 2000/08/26 18:27:17 marekm Exp $ */
/* $Id: failure.h,v 1.3 2005/03/31 05:14:50 kloczek Exp $ */
#ifndef _FAILURE_H_
#define _FAILURE_H_
@@ -12,7 +12,7 @@
* failure() creates a new (struct faillog) entry or updates an
* existing one with the current failed login information.
*/
extern void failure(uid_t, const char *, struct faillog *);
extern void failure (uid_t, const char *, struct faillog *);
/*
* failcheck - check for failures > allowable
@@ -22,7 +22,7 @@ extern void failure(uid_t, const char *, struct faillog *);
* returns FALSE to indicate that the login should be denied even though
* the password is valid.
*/
extern int failcheck(uid_t, struct faillog *, int);
extern int failcheck (uid_t, struct faillog *, int);
/*
* failprint - print line of failure information
@@ -30,7 +30,7 @@ extern int failcheck(uid_t, struct faillog *, int);
* failprint takes a (struct faillog) entry and formats it into a
* message which is displayed at login time.
*/
extern void failprint(const struct faillog *);
extern void failprint (const struct faillog *);
/*
* failtmp - update the cummulative failure log
@@ -38,7 +38,6 @@ extern void failprint(const struct faillog *);
* failtmp updates the (struct utmp) formatted failure log which
* maintains a record of all login failures.
*/
extern void failtmp(const struct utmp *);
extern void failtmp (const struct utmp *);
#endif

View File

@@ -1,7 +1,7 @@
/* A Bison parser, made by GNU Bison 1.875d. */
/* A Bison parser, made by GNU Bison 1.875c. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -347,7 +347,7 @@ typedef union YYSTYPE {
/* A type that is properly aligned for any stack member. */
union yyalloc
{
short int yyss;
short yyss;
YYSTYPE yyvs;
};
@@ -357,7 +357,7 @@ union yyalloc
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
/* Copy COUNT objects from FROM to TO. The source and destination do
@@ -399,7 +399,7 @@ union yyalloc
#if defined (__STDC__) || defined (__cplusplus)
typedef signed char yysigned_char;
#else
typedef short int yysigned_char;
typedef short yysigned_char;
#endif
/* YYFINAL -- State number of the termination state. */
@@ -491,7 +491,7 @@ static const yysigned_char yyrhs[] =
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short int yyrline[] =
static const unsigned short yyrline[] =
{
0, 191, 191, 192, 195, 198, 201, 204, 207, 210,
213, 219, 225, 234, 240, 252, 255, 259, 264, 268,
@@ -518,7 +518,7 @@ static const char *const yytname[] =
# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
token YYLEX-NUM. */
static const unsigned short int yytoknum[] =
static const unsigned short yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 58,
@@ -739,12 +739,12 @@ do { \
#if defined (__STDC__) || defined (__cplusplus)
static void
yy_stack_print (short int *bottom, short int *top)
yy_stack_print (short *bottom, short *top)
#else
static void
yy_stack_print (bottom, top)
short int *bottom;
short int *top;
short *bottom;
short *top;
#endif
{
YYFPRINTF (stderr, "Stack now");
@@ -1011,9 +1011,9 @@ yyparse ()
to reallocate them elsewhere. */
/* The state stack. */
short int yyssa[YYINITDEPTH];
short int *yyss = yyssa;
register short int *yyssp;
short yyssa[YYINITDEPTH];
short *yyss = yyssa;
register short *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
@@ -1050,7 +1050,6 @@ yyparse ()
yyssp = yyss;
yyvsp = yyvs;
goto yysetstate;
/*------------------------------------------------------------.
@@ -1076,7 +1075,7 @@ yyparse ()
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
short int *yyss1 = yyss;
short *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the
@@ -1104,7 +1103,7 @@ yyparse ()
yystacksize = YYMAXDEPTH;
{
short int *yyss1 = yyss;
short *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
@@ -1646,8 +1645,8 @@ yyreduce:
}
/* Line 1010 of yacc.c. */
#line 1651 "getdate.c"
/* Line 1000 of yacc.c. */
#line 1650 "getdate.c"
yyvsp -= yylen;
yyssp -= yylen;

View File

@@ -4,5 +4,5 @@
#include <config.h>
#include "defines.h"
time_t get_date(const char *, const time_t *);
time_t get_date (const char *, const time_t *);
#endif

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: hushed.c,v 1.5 2003/04/22 10:59:22 kloczek Exp $")
RCSID ("$Id: hushed.c,v 1.6 2005/03/31 05:14:50 kloczek Exp $")
#include <sys/types.h>
#include <stdio.h>
#include "defines.h"
@@ -64,8 +64,7 @@ int hushed (const struct passwd *pw)
*/
if (hushfile[0] != '/') {
snprintf (buf, sizeof (buf), "%s/%s", pw->pw_dir,
hushfile);
snprintf (buf, sizeof (buf), "%s/%s", pw->pw_dir, hushfile);
return (access (buf, F_OK) == 0);
}
@@ -80,8 +79,7 @@ int hushed (const struct passwd *pw)
for (found = 0; !found && fgets (buf, sizeof buf, fp);) {
buf[strlen (buf) - 1] = '\0';
found = !strcmp (buf,
buf[0] ==
'/' ? pw->pw_shell : pw->pw_name);
buf[0] == '/' ? pw->pw_shell : pw->pw_name);
}
(void) fclose (fp);
return found;

View File

@@ -41,7 +41,7 @@
#include <time.h>
#include "rcsid.h"
RCSID ("$Id: isexpired.c,v 1.11 2003/05/03 16:14:33 kloczek Exp $")
RCSID ("$Id: isexpired.c,v 1.12 2005/03/31 05:14:50 kloczek Exp $")
/*
* isexpired - determine if account is expired yet
@@ -77,8 +77,7 @@ int isexpired (const struct passwd *pw, const struct spwd *sp)
* if /etc/shadow doesn't exist, getspnam() still succeeds and
* returns sp_lstchg==0 (must change password) instead of -1!
*/
if (sp->sp_lstchg == 0
&& !strcmp (pw->pw_passwd, SHADOW_PASSWD_STRING))
if (sp->sp_lstchg == 0 && !strcmp (pw->pw_passwd, SHADOW_PASSWD_STRING))
return 1;
if (sp->sp_lstchg > 0 && sp->sp_max >= 0 && sp->sp_inact >= 0 &&

View File

@@ -34,8 +34,10 @@
#include <config.h>
#ifndef USE_PAM
#include "rcsid.h"
RCSID ("$Id: limits.c,v 1.14 2003/05/05 21:44:15 kloczek Exp $")
RCSID ("$Id: limits.c,v 1.16 2005/03/31 05:14:50 kloczek Exp $")
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
@@ -248,8 +250,7 @@ static int do_user_limits (const char *buf, const char *name)
case 'm':
case 'M':
/* RLIMIT_MEMLOCK - max locked-in-memory address space (KB) */
retval |=
setrlimit_value (RLIMIT_MEMLOCK, pp, 1024);
retval |= setrlimit_value (RLIMIT_MEMLOCK, pp, 1024);
break;
#endif
#ifdef RLIMIT_NOFILE
@@ -398,8 +399,7 @@ void setup_limits (const struct passwd *info)
exit (1);
}
#endif
for (cp = info->pw_gecos; cp != NULL;
cp = strchr (cp, ',')) {
for (cp = info->pw_gecos; cp != NULL; cp = strchr (cp, ',')) {
if (*cp == ',')
cp++;
@@ -424,3 +424,5 @@ void setup_limits (const struct passwd *info)
}
}
}
#endif /* !USE_PAM */

View File

@@ -30,17 +30,13 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: log.c,v 1.7 2003/12/17 12:52:25 kloczek Exp $")
RCSID ("$Id: log.c,v 1.9 2005/04/02 11:31:39 kloczek Exp $")
#include <sys/types.h>
#include <pwd.h>
#include <fcntl.h>
#include <time.h>
#include "defines.h"
#if HAVE_LASTLOG_H
#include <lastlog.h>
#else
#include "lastlog_.h"
#endif
/*
* dolastlog - create lastlog entry
*
@@ -89,6 +85,7 @@ dolastlog (struct lastlog *ll, const struct passwd *pw, const char *line,
ll_time = newlog.ll_time;
time (&ll_time);
newlog.ll_time = ll_time;
strncpy (newlog.ll_line, line, sizeof newlog.ll_line);
#if HAVE_LL_HOST
strncpy (newlog.ll_host, host, sizeof newlog.ll_host);

View File

@@ -1,324 +0,0 @@
/* Taken from logdaemon-5.0, only minimal changes. --marekm */
/************************************************************************
* Copyright 1995 by Wietse Venema. All rights reserved. Individual files
* may be covered by other copyrights (as noted in the file itself.)
*
* This material was originally written and compiled by Wietse Venema at
* Eindhoven University of Technology, The Netherlands, in 1990, 1991,
* 1992, 1993, 1994 and 1995.
*
* Redistribution and use in source and binary forms are permitted
* provided that this entire copyright notice is duplicated in all such
* copies.
*
* This software is provided "as is" and without any expressed or implied
* warranties, including, without limitation, the implied warranties of
* merchantibility and fitness for any particular purpose.
************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef LOGIN_ACCESS
#include "rcsid.h"
RCSID ("$Id: login_access.c,v 1.9 2003/05/05 21:44:15 kloczek Exp $")
#include "prototypes.h"
/*
* This module implements a simple but effective form of login access
* control based on login names and on host (or domain) names, internet
* addresses (or network numbers), or on terminal line names in case of
* non-networked logins. Diagnostics are reported through syslog(3).
*
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
*/
#include <sys/types.h>
#include <stdio.h>
#include <syslog.h>
#include <ctype.h>
#include <netdb.h>
#include <grp.h>
#ifdef PRIMARY_GROUP_MATCH
#include <pwd.h>
#endif
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h> /* for inet_ntoa() */
extern struct group *getgrnam ();
extern int innetgr ();
#if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
#undef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif
/* Path name of the access control file. */
#ifndef TABLE
#define TABLE "/etc/login.access"
#endif
/* Delimiters for fields and for lists of users, ttys or hosts. */
static char fs[] = ":"; /* field separator */
static char sep[] = ", \t"; /* list-element separator */
/* Constants to be used in assignments only, not in comparisons... */
#define YES 1
#define NO 0
static int list_match ();
static int user_match ();
static int from_match ();
static int string_match ();
/* login_access - match username/group and host/tty with access control file */
int login_access (const char *user, const char *from)
{
FILE *fp;
char line[BUFSIZ];
char *perm; /* becomes permission field */
char *users; /* becomes list of login names */
char *froms; /* becomes list of terminals or hosts */
int match = NO;
int end;
int lineno = 0; /* for diagnostics */
/*
* Process the table one line at a time and stop at the first match.
* Blank lines and lines that begin with a '#' character are ignored.
* Non-comment lines are broken at the ':' character. All fields are
* mandatory. The first field should be a "+" or "-" character. A
* non-existing table means no access control.
*/
if ((fp = fopen (TABLE, "r"))) {
while (!match && fgets (line, sizeof (line), fp)) {
lineno++;
if (line[end = strlen (line) - 1] != '\n') {
syslog (LOG_ERR,
"%s: line %d: missing newline or line too long",
TABLE, lineno);
continue;
}
if (line[0] == '#')
continue; /* comment line */
while (end > 0 && isspace (line[end - 1]))
end--;
line[end] = 0; /* strip trailing whitespace */
if (line[0] == 0) /* skip blank lines */
continue;
if (!(perm = strtok (line, fs))
|| !(users = strtok ((char *) 0, fs))
|| !(froms = strtok ((char *) 0, fs))
|| strtok ((char *) 0, fs)) {
syslog (LOG_ERR,
"%s: line %d: bad field count",
TABLE, lineno);
continue;
}
if (perm[0] != '+' && perm[0] != '-') {
syslog (LOG_ERR,
"%s: line %d: bad first field",
TABLE, lineno);
continue;
}
match = (list_match (froms, from, from_match)
&& list_match (users, user, user_match));
}
(void) fclose (fp);
} else if (errno != ENOENT) {
syslog (LOG_ERR, "cannot open %s: %m", TABLE);
}
return (match == 0 || (line[0] == '+'));
}
/* list_match - match an item against a list of tokens with exceptions */
static int list_match (char *list, const char *item, int (*match_fn) ())
{
char *tok;
int match = NO;
/*
* Process tokens one at a time. We have exhausted all possible matches
* when we reach an "EXCEPT" token or the end of the list. If we do find
* a match, look for an "EXCEPT" list and recurse to determine whether
* the match is affected by any exceptions.
*/
for (tok = strtok (list, sep); tok != 0;
tok = strtok ((char *) 0, sep)) {
if (strcasecmp (tok, "EXCEPT") == 0) /* EXCEPT: give up */
break;
if ((match = (*match_fn) (tok, item))) /* YES */
break;
}
/* Process exceptions to matches. */
if (match != NO) {
while ((tok = strtok ((char *) 0, sep))
&& strcasecmp (tok, "EXCEPT"))
/* VOID */ ;
if (tok == 0
|| list_match ((char *) 0, item, match_fn) == NO)
return (match);
}
return (NO);
}
/* myhostname - figure out local machine name */
static char *myhostname (void)
{
static char name[MAXHOSTNAMELEN + 1] = "";
if (name[0] == 0) {
gethostname (name, sizeof (name));
name[MAXHOSTNAMELEN] = 0;
}
return (name);
}
/* netgroup_match - match group against machine or user */
static int
netgroup_match (const char *group, const char *machine, const char *user)
{
static char *mydomain = 0;
if (mydomain == 0) {
static char domain[MAXHOSTNAMELEN + 1];
getdomainname (domain, MAXHOSTNAMELEN);
mydomain = domain;
}
return innetgr (group, machine, user, mydomain);
}
/* user_match - match a username against one token */
static int user_match (const char *tok, const char *string)
{
struct group *group;
#ifdef PRIMARY_GROUP_MATCH
struct passwd *userinf;
#endif
int i;
char *at;
/*
* If a token has the magic value "ALL" the match always succeeds.
* Otherwise, return YES if the token fully matches the username, or if
* the token is a group that contains the username.
*/
if ((at = strchr (tok + 1, '@')) != 0) { /* split user@host pattern */
*at = 0;
return (user_match (tok, string)
&& from_match (at + 1, myhostname ()));
} else if (tok[0] == '@') { /* netgroup */
return (netgroup_match (tok + 1, (char *) 0, string));
} else if (string_match (tok, string)) { /* ALL or exact match */
return (YES);
} else if ((group = getgrnam (tok))) { /* try group membership */
for (i = 0; group->gr_mem[i]; i++)
if (strcasecmp (string, group->gr_mem[i]) == 0)
return (YES);
#ifdef PRIMARY_GROUP_MATCH
/*
* If the sting is an user whose initial GID matches the token,
* accept it. May avoid excessively long lines in /etc/group.
* Radu-Adrian Feurdean <raf@licj.soroscj.ro>
*
* XXX - disabled by default for now. Need to verify that
* getpwnam() doesn't have some nasty side effects. --marekm
*/
if ((userinf = getpwnam (string)))
if (userinf->pw_gid == group->gr_gid)
return (YES);
#endif
}
return (NO);
}
static char *resolve_hostname (string)
char *string;
{
/*
* Resolve hostname to numeric IP address, as suggested
* by Dave Hagewood <admin@arrowweb.com>. --marekm
*/
struct hostent *hp;
hp = gethostbyname (string);
if (hp)
return
inet_ntoa (*((struct in_addr *) *(hp->h_addr_list)));
syslog (LOG_ERR, "%s - unknown host", string);
return string;
}
/* from_match - match a host or tty against a list of tokens */
static int from_match (const char *tok, const char *string)
{
int tok_len;
int str_len;
/*
* If a token has the magic value "ALL" the match always succeeds. Return
* YES if the token fully matches the string. If the token is a domain
* name, return YES if it matches the last fields of the string. If the
* token has the magic value "LOCAL", return YES if the string does not
* contain a "." character. If the token is a network number, return YES
* if it matches the head of the string.
*/
if (tok[0] == '@') { /* netgroup */
return (netgroup_match (tok + 1, string, (char *) 0));
} else if (string_match (tok, string)) { /* ALL or exact match */
return (YES);
} else if (tok[0] == '.') { /* domain: match last fields */
if ((str_len = strlen (string)) > (tok_len = strlen (tok))
&& strcasecmp (tok, string + str_len - tok_len) == 0)
return (YES);
} else if (strcasecmp (tok, "LOCAL") == 0) { /* local: no dots */
if (strchr (string, '.') == 0)
return (YES);
} else if (tok[(tok_len = strlen (tok)) - 1] == '.' /* network */
&& strncmp (tok, resolve_hostname (string),
tok_len) == 0) {
return (YES);
}
return (NO);
}
/* string_match - match a string against one token */
static int string_match (const char *tok, const char *string)
{
/*
* If the token has the magic value "ALL" the match always succeeds.
* Otherwise, return YES if the token fully matches the string.
*/
if (strcasecmp (tok, "ALL") == 0) { /* all: always matches */
return (YES);
} else if (strcasecmp (tok, string) == 0) { /* try exact match */
return (YES);
}
return (NO);
}
#endif /* LOGIN_ACCESS */

View File

@@ -1,74 +0,0 @@
/* Taken from logdaemon-5.0, only minimal changes. --marekm */
/************************************************************************
* Copyright 1995 by Wietse Venema. All rights reserved. Individual files
* may be covered by other copyrights (as noted in the file itself.)
*
* This material was originally written and compiled by Wietse Venema at
* Eindhoven University of Technology, The Netherlands, in 1990, 1991,
* 1992, 1993, 1994 and 1995.
*
* Redistribution and use in source and binary forms are permitted
* provided that this entire copyright notice is duplicated in all such
* copies.
*
* This software is provided "as is" and without any expressed or implied
* warranties, including, without limitation, the implied warranties of
* merchantibility and fitness for any particular purpose.
************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef DES_RPC
#include "rcsid.h"
RCSID ("$Id: login_desrpc.c,v 1.8 2003/04/22 10:59:22 kloczek Exp $")
#include "defines.h"
/*
* Decrypt the user's secret secure RPC key and stores it into the
* keyserver. Returns 0 if successful, -1 on failure.
*
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
*/
#include <stdio.h>
#include <rpc/rpc.h>
#include <rpc/key_prot.h>
#if !(defined __GLIBC__ && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0)))
/* these don't seem to be in any header file (libc-5.4.33) */
/* but will be in glibc 2.1 <rpc/auth.h> and <rpc/auth_des.h> */
extern int getnetname (char *);
extern int getsecretkey (const char *, char *, const char *);
extern int key_setsecret (const char *);
#endif
int login_desrpc (const char *passwd)
{
char netname[MAXNETNAMELEN + 1];
char secretkey[HEXKEYBYTES + 1];
if (getnetname (netname) == 0)
return -1;
if (getsecretkey (netname, secretkey, passwd) == 0)
return -1;
if (secretkey[0] == 0) {
fprintf (stderr,
_
("Password does not decrypt secret key for %s.\n"),
netname);
return -1;
}
if (key_setsecret (secretkey) < 0) {
fprintf (stderr,
_
("Could not set %s's secret key: is the keyserv daemon running?\n"),
netname);
return -1;
}
return 0;
}
#else
extern int errno; /* warning: ANSI C forbids an empty source file */
#endif

View File

@@ -1,58 +0,0 @@
/* Taken from logdaemon-5.0, only minimal changes. --marekm */
/************************************************************************
* Copyright 1995 by Wietse Venema. All rights reserved. Individual files
* may be covered by other copyrights (as noted in the file itself.)
*
* This material was originally written and compiled by Wietse Venema at
* Eindhoven University of Technology, The Netherlands, in 1990, 1991,
* 1992, 1993, 1994 and 1995.
*
* Redistribution and use in source and binary forms are permitted
* provided that this entire copyright notice is duplicated in all such
* copies.
*
* This software is provided "as is" and without any expressed or implied
* warranties, including, without limitation, the implied warranties of
* merchantibility and fitness for any particular purpose.
************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef KERBEROS
#include "rcsid.h"
RCSID ("$Id: login_krb.c,v 1.4 2003/04/22 10:59:22 kloczek Exp $")
#include <krb.h>
/*
* Do an equivalent to kinit here. We need to do the kinit before trying to
* cd to the home directory, because it might be on a remote filesystem that
* uses Kerberos authentication. We also need to do this after we've
* setuid() to the user, or krb_get_pw_in_tkt() won't know where to put the
* ticket.
*
* We don't really care about whether or not it succeeds; if it fails, we'll
* just carry on bravely.
*
* NB: we assume: local realm, same username and password as supplied to login.
*
* Security note: if pp is NULL, login doesn't have the password. This is
* common when it's called by rlogind. Since this is almost always a remote
* connection, we don't want to risk asking for the password by supplying a
* NULL pp to krb_get_pw_in_tkt(), because somebody could be listening. So
* we'll just forget the whole thing. -jdd
*/
int login_kerberos (const char *username, const char *password)
{
char realm[REALM_SZ];
(void) krb_get_lrealm (realm, 1);
if (password != 0)
(void) krb_get_pw_in_tkt (username, "", realm, "krbtgt",
realm, DEFAULT_TKT_LIFE,
password);
}
#else
extern int errno; /* warning: ANSI C forbids an empty source file */
#endif /* KERBEROS */

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: loginprompt.c,v 1.7 2003/04/22 10:59:22 kloczek Exp $")
RCSID ("$Id: loginprompt.c,v 1.8 2005/03/31 05:14:50 kloczek Exp $")
#include <stdio.h>
#include <signal.h>
#include <ctype.h>
@@ -144,8 +144,7 @@ void login_prompt (const char *prompt, char *name, int namesize)
envp[envc] = nvar;
} else {
envp[envc] = xmalloc (strlen (nvar) + 32);
sprintf (envp[envc], "L%d=%s", count++,
nvar);
sprintf (envp[envc], "L%d=%s", count++, nvar);
}
}
set_env (envc, envp);

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: motd.c,v 1.4 2003/04/22 10:59:22 kloczek Exp $")
RCSID ("$Id: motd.c,v 1.5 2005/03/31 05:14:50 kloczek Exp $")
#include <stdio.h>
#include "prototypes.h"
#include "defines.h"
@@ -54,8 +54,7 @@ void motd (void)
strncpy (motdlist, mb, sizeof (motdlist));
motdlist[sizeof (motdlist) - 1] = '\0';
for (mb = motdlist; (motdfile = strtok (mb, ":")) != NULL;
mb = NULL) {
for (mb = motdlist; (motdfile = strtok (mb, ":")) != NULL; mb = NULL) {
if ((fp = fopen (motdfile, "r")) != NULL) {
while ((c = getc (fp)) != EOF)
putchar (c);

View File

@@ -29,8 +29,10 @@
#include <config.h>
#ifndef USE_PAM
#include "rcsid.h"
RCSID ("$Id: obscure.c,v 1.11 2003/05/05 21:44:15 kloczek Exp $")
RCSID ("$Id: obscure.c,v 1.12 2005/03/24 04:29:23 kloczek Exp $")
/*
* This version of obscure.c contains modifications to support "cracklib"
@@ -273,3 +275,5 @@ int obscure (const char *old, const char *new, const struct passwd *pwdp)
}
return 1;
}
#endif /* !USE_PAM */

View File

@@ -3,7 +3,7 @@
#ifdef USE_PAM
#include "rcsid.h"
RCSID ("$Id: pam_pass.c,v 1.9 2003/07/29 09:05:39 kloczek Exp $")
RCSID ("$Id: pam_pass.c,v 1.10 2005/03/31 05:14:50 kloczek Exp $")
/*
* Change the user's password using PAM. Requires libpam and libpam_misc
@@ -41,13 +41,12 @@ void do_pam_passwd (const char *user, int silent, int change_expired)
ret = pam_chauthtok (pamh, flags);
if (ret != PAM_SUCCESS) {
fprintf (stderr, _("passwd: %s\n"),
pam_strerror (pamh, ret));
fprintf (stderr, _("passwd: %s\n"), pam_strerror (pamh, ret));
pam_end (pamh, ret);
exit (10); /* XXX */
}
fputs(_("passwd: password updated successfully\n"), stderr);
fputs (_("passwd: password updated successfully\n"), stderr);
pam_end (pamh, PAM_SUCCESS);
}
#else /* !USE_PAM */

View File

@@ -1,7 +1,7 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: pwdcheck.c,v 1.4 2004/11/02 18:46:30 kloczek Exp $")
RCSID ("$Id: pwdcheck.c,v 1.5 2005/03/31 05:14:50 kloczek Exp $")
#include "prototypes.h"
#include "defines.h"
#include <pwd.h>
@@ -13,8 +13,7 @@ RCSID ("$Id: pwdcheck.c,v 1.4 2004/11/02 18:46:30 kloczek Exp $")
#include "pam_defs.h"
#endif
#define WRONGPWD2 "incorrect password for `%s'"
void
passwd_check (const char *user, const char *passwd, const char *progname)
void passwd_check (const char *user, const char *passwd, const char *progname)
{
#ifdef USE_PAM
pam_handle_t *pamh = NULL;

View File

@@ -32,13 +32,12 @@
#ifdef RLOGIN
#include "rcsid.h"
RCSID ("$Id: rlogin.c,v 1.7 2005/01/20 12:47:20 kloczek Exp $")
RCSID ("$Id: rlogin.c,v 1.9 2005/03/31 05:14:50 kloczek Exp $")
#include "prototypes.h"
#include "defines.h"
#include <stdio.h>
#include <pwd.h>
#include <unistd.h>
#include <netdb.h>
static struct {
int spd_name;
int spd_baud;

View File

@@ -8,13 +8,12 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: salt.c,v 1.6 2003/04/22 10:59:22 kloczek Exp $")
RCSID ("$Id: salt.c,v 1.7 2005/04/06 00:21:37 kloczek Exp $")
#include <sys/time.h>
#include <stdlib.h>
#include "prototypes.h"
#include "defines.h"
#include <sys/time.h>
#if 1
#include "getdef.h"
extern char *l64a ();
/*
* Generate 8 base64 ASCII characters of random salt. If MD5_CRYPT_ENAB
@@ -44,21 +43,3 @@ char *crypt_make_salt (void)
return result;
}
#else
/*
* This is the old style random salt generator...
*/
char *crypt_make_salt (void)
{
time_t now;
static unsigned long x;
static char result[3];
time (&now);
x += now + getpid () + clock ();
result[0] = i64c (((x >> 18) ^ (x >> 6)) & 077);
result[1] = i64c (((x >> 12) ^ x) & 077);
result[2] = '\0';
return result;
}
#endif

View File

@@ -34,7 +34,7 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: setugid.c,v 1.7 2003/04/22 10:59:22 kloczek Exp $")
RCSID ("$Id: setugid.c,v 1.9 2005/03/31 05:14:50 kloczek Exp $")
#include <stdio.h>
#include <grp.h>
#include "prototypes.h"
@@ -80,12 +80,7 @@ int change_uid (const struct passwd *info)
/*
* Set the real UID to the UID value in the password file.
*/
#ifndef BSD
if (setuid (info->pw_uid))
#else
if (setreuid (info->pw_uid, info->pw_uid))
#endif
{
if (setuid (info->pw_uid)) {
perror ("setuid");
SYSLOG ((LOG_ERR, "bad user ID `%d' for user `%s': %m\n",
(int) info->pw_uid, info->pw_name));

View File

@@ -34,7 +34,7 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: setupenv.c,v 1.13 2003/05/05 21:44:15 kloczek Exp $")
RCSID ("$Id: setupenv.c,v 1.14 2005/03/31 05:14:50 kloczek Exp $")
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
@@ -44,8 +44,7 @@ RCSID ("$Id: setupenv.c,v 1.13 2003/05/05 21:44:15 kloczek Exp $")
#include <pwd.h>
#include "getdef.h"
static void
addenv_path (const char *varname, const char *dirname,
const char *filename)
addenv_path (const char *varname, const char *dirname, const char *filename)
{
char *buf;

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: shell.c,v 1.9 2003/05/05 21:49:56 kloczek Exp $")
RCSID ("$Id: shell.c,v 1.10 2005/03/31 05:14:50 kloczek Exp $")
#include <stdio.h>
#include <errno.h>
#include "prototypes.h"
@@ -67,8 +67,7 @@ void shell (const char *file, const char *arg)
*/
if (arg == (char *) 0) {
snprintf (arg0, sizeof arg0, "-%s",
Basename ((char *) file));
snprintf (arg0, sizeof arg0, "-%s", Basename ((char *) file));
arg = arg0;
}
#ifdef DEBUG

View File

@@ -34,7 +34,7 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: strtoday.c,v 1.9 2003/04/22 10:59:22 kloczek Exp $")
RCSID ("$Id: strtoday.c,v 1.10 2005/03/31 05:14:50 kloczek Exp $")
#include "defines.h"
#ifndef USE_GETDATE
#define USE_GETDATE 1
@@ -190,8 +190,7 @@ long strtoday (const char *str)
*/
total = (long) ((year - 1970) * 365L) + (((year + 1) - 1970) / 4);
total += (long) juldays[month] + (month > 2
&& (year % 4) == 0 ? 1 : 0);
total += (long) juldays[month] + (month > 2 && (year % 4) == 0 ? 1 : 0);
total += (long) day - 1;
return total;

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: sulog.c,v 1.7 2003/04/22 10:59:22 kloczek Exp $")
RCSID ("$Id: sulog.c,v 1.8 2005/03/31 05:14:50 kloczek Exp $")
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
@@ -41,8 +41,7 @@ RCSID ("$Id: sulog.c,v 1.7 2003/04/22 10:59:22 kloczek Exp $")
/*
* sulog - log a SU command execution result
*/
void
sulog (const char *tty, int success, const char *oldname, const char *name)
void sulog (const char *tty, int success, const char *oldname, const char *name)
{
char *sulog_file;
time_t now;

View File

@@ -30,16 +30,14 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: ttytype.c,v 1.7 2004/08/18 09:53:58 kloczek Exp $")
RCSID ("$Id: ttytype.c,v 1.9 2005/03/31 05:14:50 kloczek Exp $")
#include <stdio.h>
#include "prototypes.h"
#include "defines.h"
#include "getdef.h"
/*
* ttytype - set ttytype from port to terminal type mapping database
*/
void ttytype (const char *line)
{
FILE *fp;
@@ -67,16 +65,9 @@ void ttytype (const char *line)
if ((cp = strchr (buf, '\n')))
*cp = '\0';
#if defined(SUN) || defined(BSD) || defined(SUN4)
if ((sscanf (buf, "%s \"%*[^\"]\" %s", port, type) == 2 ||
sscanf (buf, "%s %*s %s", port, type) == 2) &&
strcmp (line, port) == 0)
break;
#else /* USG */
if (sscanf (buf, "%s %s", type, port) == 2 &&
strcmp (line, port) == 0)
break;
#endif
}
if (!feof (fp) && !ferror (fp))
addenv ("TERM", type);

View File

@@ -41,7 +41,7 @@
#include <stdio.h>
#include "rcsid.h"
RCSID ("$Id: utmp.c,v 1.14 2003/12/17 12:52:25 kloczek Exp $")
RCSID ("$Id: utmp.c,v 1.15 2005/03/31 05:14:50 kloczek Exp $")
#if HAVE_UTMPX_H
struct utmpx utxent;
#endif
@@ -108,8 +108,7 @@ void checkutmp (int picky)
utent.ut_pid = pid;
strncpy (utent.ut_line, line, sizeof utent.ut_line);
/* XXX - assumes /dev/tty?? */
strncpy (utent.ut_id, utent.ut_line + 3,
sizeof utent.ut_id);
strncpy (utent.ut_id, utent.ut_line + 3, sizeof utent.ut_id);
strcpy (utent.ut_user, "LOGIN");
utent.ut_time = time (NULL);
}
@@ -175,11 +174,9 @@ void checkutmp (int picky)
}
if (strncmp (line, "/dev/", 5) == 0)
line += 5;
strncpy (utent.ut_line, line,
sizeof utent.ut_line);
strncpy (utent.ut_line, line, sizeof utent.ut_line);
#if HAVE_UTMPX_H
strncpy (utxent.ut_line, line,
sizeof utxent.ut_line);
strncpy (utxent.ut_line, line, sizeof utxent.ut_line);
#endif
}
} else {
@@ -201,15 +198,13 @@ void checkutmp (int picky)
#if HAVE_UTMPX_H
strncpy (utxent.ut_line, line, sizeof utxent.ut_line);
if ((utx = getutxline (&utxent)))
strncpy (utxent.ut_id, utx->ut_id,
sizeof utxent.ut_id);
strncpy (utxent.ut_id, utx->ut_id, sizeof utxent.ut_id);
strcpy (utxent.ut_user, "LOGIN");
utxent.ut_pid = utent.ut_pid;
utxent.ut_type = utent.ut_type;
if (sizeof (utxent.ut_tv) == sizeof (struct timeval))
gettimeofday ((struct timeval *) &utxent.ut_tv,
NULL);
gettimeofday ((struct timeval *) &utxent.ut_tv, NULL);
else {
struct timeval tv;
@@ -393,8 +388,7 @@ void setutmp (const char *name, const char *line, const char *host)
}
utline.ut_time = utxline.ut_tv.tv_sec;
strncpy (utxline.ut_host, host ? host : "",
sizeof utxline.ut_host);
strncpy (utxline.ut_host, host ? host : "", sizeof utxline.ut_host);
pututxline (&utxline);
pututline (&utline);

View File

@@ -10,10 +10,9 @@
#include <config.h>
#include "rcsid.h"
RCSID ("$Id: xmalloc.c,v 1.5 2004/05/06 21:31:33 kloczek Exp $")
RCSID ("$Id: xmalloc.c,v 1.6 2005/03/31 05:14:50 kloczek Exp $")
#include <stdio.h>
#include "defines.h"
char *xmalloc (size_t size)
{
char *ptr;