home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-09-13 | 63.2 KB | 3,081 lines |
- Path: wupost!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!natinst!sequoia!rpp386!jfh
- From: jfh@rpp386.cactus.org (John F Haugh II)
- Newsgroups: alt.sources
- Subject: Shadow Login Suite, patch 8
- Message-ID: <19839@rpp386.cactus.org>
- Date: 12 Sep 91 13:57:09 GMT
- Distribution: alt
- Organization: River Parishes Programming, Austin TX
- Lines: 3070
-
- This is the latest patch for my shadow login suite. It includes a
- number of minor bug fixes, plus changes needed to make the code
- lint cleaner. This is the third to last scheduled patch before the
- code is sent to comp.sources.misc for general release. The next
- patch includes soft-configuration changes made by Chip Rosenthal,
- plus any bugs found in this patch. The final patch will contain
- only bug fixes, no new features. So please, send your bug reports
- to me.
-
- I did want to make a point - there are now enough utilities in this
- suite to make it useful even if you don't want to include the login
- and su commands (that is, you don't trust this code or you don't
- trust me). There are now general utilities for adding, modifying
- and deleting users and groups. So, don't hestitate to pick and
- chose.
- --
- Prereq: "3.0.7"
- Index: patchlevel.h
- *** rel3/patchlevel.h Thu Sep 12 08:47:50 1991
- --- patchlevel.h Thu Aug 15 09:56:58 1991
- ***************
- *** 10,14 ****
- */
-
- #define RELEASE 3
- ! #define PATCHLEVEL 7
- ! #define VERSION "3.0.7"
- --- 10,14 ----
- */
-
- #define RELEASE 3
- ! #define PATCHLEVEL 8
- ! #define VERSION "3.0.8"
- Index: utmp.c
- *** rel3/utmp.c Thu Sep 12 08:48:01 1991
- --- utmp.c Thu Sep 12 08:48:38 1991
- ***************
- *** 31,37 ****
- #endif /* SUN || BSD */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)utmp.c 3.9 08:46:57 7/15/91";
- #endif
-
- extern struct utmp utent;
- --- 31,37 ----
- #endif /* SUN || BSD */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)utmp.c 3.11 08:43:33 9/12/91";
- #endif
-
- extern struct utmp utent;
- ***************
- *** 92,110 ****
-
- endutent ();
-
- if (utent.ut_line[0] == '\0') {
- if (! (line = ttyname (0))) {
- (void) puts (NO_TTY);
- exit (1);
- }
- ! (void) strncpy (utent.ut_line, line + 5,
- ! sizeof utent.ut_line);
- }
- - if (ut && utent.ut_pid == pid)
- - return;
- -
- - (void) puts (NO_UTENT);
- - exit (1);
- } else {
- if (! (line = ttyname (0))) {
- puts (NO_TTY);
- --- 92,111 ----
-
- endutent ();
-
- + if (!ut || utent.ut_pid != pid) {
- + (void) puts (NO_UTENT);
- + exit (1);
- + }
- if (utent.ut_line[0] == '\0') {
- if (! (line = ttyname (0))) {
- (void) puts (NO_TTY);
- exit (1);
- }
- ! if (strncmp (line, "/dev/", 5) == 0)
- ! line += 5;
- ! (void) strncpy (utent.ut_line, line,
- ! (int) sizeof utent.ut_line);
- }
- } else {
- if (! (line = ttyname (0))) {
- puts (NO_TTY);
- ***************
- *** 126,142 ****
- }
- #else /* !USG */
- bzero (&utent, sizeof utent);
- ! if (line = ttyname (0)) {
- ! if (strncmp (line, "/dev/", 5))
- ! line += 5;
- !
- ! (void) strncpy (utent.ut_line, line, sizeof utent.ut_line);
- ! (void) time (&utent.ut_time);
- ! return;
- }
- #endif /* !USG */
- - puts (NO_TTY);
- - exit (1);
- }
-
- /*
- --- 127,142 ----
- }
- #else /* !USG */
- bzero (&utent, sizeof utent);
- ! if (! (line = ttyname (0))) {
- ! puts (NO_TTY);
- ! exit (1);
- }
- + if (strncmp (line, "/dev/", 5))
- + line += 5;
- +
- + (void) strncpy (utent.ut_line, line, sizeof utent.ut_line);
- + (void) time (&utent.ut_time);
- #endif /* !USG */
- }
-
- /*
- Index: id.c
- *** rel3/id.c Thu Sep 12 08:46:32 1991
- --- id.c Thu Sep 12 08:48:40 1991
- ***************
- *** 1,19 ****
- /*
- ! * id - print current process user identification information
- *
- ! * This program was written by John F. Haugh II (jfh@rpp386.UUCP)
- ! * on 7/9/89 and placed into the public domain.
- *
- - * Syntax:
- - * id
- - * Synopsis:
- * Print the current process identifiers. This includes the
- ! * UID, GID, effective-UID and effective-GID.
- ! *
- ! * Notes:
- ! * Straightforward implementation. Get the IDs and print
- ! * them out. This is being included as a means of exercising
- ! * the low level user database routines.
- */
-
- #include <sys/types.h>
- --- 1,20 ----
- /*
- ! * Copyright 1991, John F. Haugh II
- ! * All rights reserved.
- *
- ! * Permission is granted to copy and create derivative works for any
- ! * non-commercial purpose, provided this copyright notice is preserved
- ! * in all copies of source code, or included in human readable form
- ! * and conspicuously displayed on all copies of object code or
- ! * distribution media.
- ! */
- !
- ! /*
- ! * id - print current process user identification information
- *
- * Print the current process identifiers. This includes the
- ! * UID, GID, effective-UID and effective-GID. Optionally print
- ! * the concurrent group set if the current system supports it.
- */
-
- #include <sys/types.h>
- ***************
- *** 22,41 ****
- #include "pwd.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)id.c 3.1 12:30:47 12/12/90";
- #endif
-
- main (argc, argv)
- int argc;
- char **argv;
- {
- int id;
- ! int i;
- struct passwd *pw,
- *getpwuid();
- struct group *gr,
- *getgrgid();
-
- if (pw = getpwuid (id = getuid ()))
- printf ("uid=%d(%s)", id, pw->pw_name);
- else
- --- 23,83 ----
- #include "pwd.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)id.c 3.4 08:43:37 9/12/91";
- ! #endif
- !
- ! usage ()
- ! {
- ! #if NGROUPS > 0
- ! fprintf (stderr, "usage: id [ -a ]\n");
- ! #else
- ! fprintf (stderr, "usage: id\n");
- #endif
- + exit (1);
- + }
-
- + /*ARGSUSED*/
- main (argc, argv)
- int argc;
- char **argv;
- {
- int id;
- ! #if NGROUPS > 0
- ! #if NGROUPS > 100
- ! int *groups;
- ! #else
- ! int groups[NGROUPS];
- ! #endif
- ! int ngroups;
- ! int aflg = 0;
- ! #endif
- struct passwd *pw,
- *getpwuid();
- struct group *gr,
- *getgrgid();
-
- + #if NGROUPS > 0
- + /*
- + * See if the -a flag has been given to print out the
- + * concurrent group set.
- + */
- +
- + if (argc > 1) {
- + if (argc > 2 || strcmp (argv[1], "-a"))
- + usage ();
- + else
- + aflg = 1;
- + }
- + #else
- + if (argc > 1)
- + usage ();
- + #endif
- +
- + /*
- + * Print out the real user ID and group ID. If the user or
- + * group does not exist, just give the numerical value.
- + */
- +
- if (pw = getpwuid (id = getuid ()))
- printf ("uid=%d(%s)", id, pw->pw_name);
- else
- ***************
- *** 46,51 ****
- --- 88,98 ----
- else
- printf (" gid=%d", id);
-
- + /*
- + * Print out the effective user ID and group ID if they are
- + * different from the real values.
- + */
- +
- if (getuid () != geteuid ()) {
- if (pw = getpwuid (id = geteuid ()))
- printf (" euid=%d(%s)", id, pw->pw_name);
- ***************
- *** 58,62 ****
- --- 105,160 ----
- else
- printf (" egid=%d", id);
- }
- + #if NGROUPS > 0
- +
- + /*
- + * Print out the concurrent group set if the user has requested
- + * it. The group numbers will be printed followed by their
- + * names.
- + */
- +
- + if (aflg && (ngroups = getgroups (0, 0)) != -1) {
- +
- + #if NGROUPS > 100
- + /*
- + * The size of the group set is determined so an array
- + * large enough to hold it can be allocated.
- + */
- +
- + if (groups = (int *) malloc (ngroups * sizeof *groups)) {
- + putchar ('\n');
- + perror ("out of memory");
- + exit (1);
- + }
- + #endif
- + /*
- + * Start off the group message. It will be of the format
- + *
- + * groups=###(aaa),###(aaa),###(aaa)
- + *
- + * where "###" is a numerical value and "aaa" is the
- + * corresponding name for each respective numerical value.
- + */
- +
- + getgroups (ngroups, groups);
- + printf (" groups=");
- + for (i = 0;i < ngroups;i++) {
- + if (i)
- + putchar (',');
- +
- + if (gr = getgrgid (groups[i]))
- + printf ("%d(%s)", groups[i], gr->gr_name);
- + else
- + printf ("%d", groups[i]);
- + }
- + }
- + #endif
- +
- + /*
- + * Finish off the line.
- + */
- +
- putchar ('\n');
- + exit (0);
- + /*NOTREACHED*/
- }
- Index: newgrp.c
- *** rel3/newgrp.c Thu Sep 12 08:48:00 1991
- --- newgrp.c Thu Sep 12 08:48:44 1991
- ***************
- *** 29,35 ****
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)newgrp.c 3.6 08:51:45 7/23/91";
- #endif
-
- #ifdef NGROUPS
- --- 29,35 ----
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)newgrp.c 3.7 08:43:39 9/12/91";
- #endif
-
- #ifdef NGROUPS
- ***************
- *** 90,96 ****
- usage ()
- {
- fprintf (stderr, "usage: newgrp [ - ] [ group ]\n");
- - exit (1);
- }
-
- /*
- --- 90,95 ----
- ***************
- *** 106,114 ****
- int needspasswd = 0;
- int i;
- char *cp;
- - #ifdef DOUBLESIZE
- - int longpass;
- - #endif
-
- /*
- * save my name for error messages and save my real gid incase
- --- 105,110 ----
- ***************
- *** 132,140 ****
- * i just use the login group id of this user.
- */
-
- ! if (argc > 0 && strcmp (argv[0], "-") == 0) {
- ! initflag = 1;
- ! argc--; argv++;
- }
- #ifdef NGROUPS
-
- --- 128,141 ----
- * i just use the login group id of this user.
- */
-
- ! if (argc > 0 && argv[0][0] == '-') {
- ! if (strcmp (argv[0], "-") == 0) {
- ! initflag = 1;
- ! argc--; argv++;
- ! } else {
- ! usage ();
- ! goto failure;
- ! }
- }
- #ifdef NGROUPS
-
- Index: newusers.8
- *** /dev/null Thu Sep 12 08:46:59 1991
- --- newusers.8 Thu Sep 12 08:48:46 1991
- ***************
- *** 0 ****
- --- 1,47 ----
- + .\" Copyright 1991, John F. Haugh II
- + .\" All rights reserved.
- + .\"
- + .\" Permission is granted to copy and create derivative works for any
- + .\" non-commercial purpose, provided this copyright notice is preserved
- + .\" in all copies of source code, or included in human readable form
- + .\" and conspicuously displayed on all copies of object code or
- + .\" distribution media.
- + .\"
- + .\" @(#)newusers.8 3.1 16:49:47 8/4/91
- + .\"
- + .TH NEWUSERS 8
- + .SH NAME
- + \fBnewusers\fR - update and create new users in batch
- + .SH SYNOPSIS
- + \fBnewusers\fR
- + [ \fI new_users \fR ]
- + .SH DESCRIPTION
- + \fBnewusers\fR reads a file of user name and cleartext password pairs
- + and uses this information to update a group of existing users or to
- + create new users.
- + Each line is in the same format as the standard password file (see
- + \fIpasswd(4)\fR) with the following exceptions.
- + .IP "pw_passwd"
- + This field will be encrypted and used as the new value
- + of the encrpted password.
- + .IP "pw_age"
- + This field will be ignored for shadow passwords if the user already
- + exists.
- + .IP "pw_gid"
- + This field may be the name of an existing group, in which case the
- + named user will be added as a member. If a non-existent numerical
- + group is given, a new group will be created having this number.
- + .IP "pw_dir"
- + This field will be checked for existence as a directory and a new
- + directory will the same name created if it does not already exist.
- + The ownership of the directory will be set to be that of the user
- + being created or updated.
- + .PP
- + This command is intended to be used in a large system environment where
- + many accounts are updated at a single time.
- + .SH CAVEATS
- + The \fImkpasswd\fR command must be executed afterwards to update the
- + DBM password files.
- + The input file must be protected since it contains unencrypted passwords.
- + .SH SEE ALSO
- + mkpasswd(8), passwd(1), useradd(1)
- Index: chpasswd.8
- *** /dev/null Thu Sep 12 08:46:59 1991
- --- chpasswd.8 Thu Sep 12 08:48:47 1991
- ***************
- *** 0 ****
- --- 1,37 ----
- + .\" Copyright 1991, John F. Haugh II
- + .\" All rights reserved.
- + .\"
- + .\" Permission is granted to copy and create derivative works for any
- + .\" non-commercial purpose, provided this copyright notice is preserved
- + .\" in all copies of source code, or included in human readable form
- + .\" and conspicuously displayed on all copies of object code or
- + .\" distribution media.
- + .\"
- + .\" @(#)chpasswd.8 3.1 16:50:16 8/4/91
- + .\"
- + .TH CHPASSWD 8
- + .SH NAME
- + \fBchpasswd\fR - update password file in batch
- + .SH SYNOPSIS
- + \fBchpasswd\fR
- + .SH DESCRIPTION
- + \fBchpasswd\fR reads a file of user name and cleartext password pairs
- + from standard input and uses this information
- + to update a group of existing users.
- + Each line is of the format
- + .DS
- + \fIuser_name\fR:\fIpassword\fR
- + .DE
- + The named user must exist.
- + The supplied password will be encrypted and the password age updated,
- + if present.
- + .PP
- + This command is intended to be used in a large system environment where
- + many accounts are created at a single time.
- + .SH CAVEATS
- + The \fImkpasswd\fR command must be executed afterwards to update the
- + DBM password files.
- + The input file must be protected since it contains unencrypted passwords.
- + This command may be discarded in favor of the newusers(8) command.
- + .SH SEE ALSO
- + mkpasswd(8), passwd(1), useradd(1)
- Index: Makefile
- *** rel3/Makefile Thu Sep 12 08:47:51 1991
- --- Makefile Thu Sep 12 08:48:49 1991
- ***************
- *** 8,16 ****
- # and conspicuously displayed on all copies of object code or
- # distribution media.
- #
- ! # @(#)Makefile 3.18 17:45:45 - Shadow password system
- #
- ! # @(#)Makefile 3.18 17:45:45 7/14/91
- #
- SHELL = /bin/sh
-
- --- 8,16 ----
- # and conspicuously displayed on all copies of object code or
- # distribution media.
- #
- ! # @(#)Makefile 3.20 09:37:18 - Shadow password system
- #
- ! # @(#)Makefile 3.20 09:37:18 8/14/91
- #
- SHELL = /bin/sh
-
- ***************
- *** 174,180 ****
- useradd.1 userdel.1 usermod.1 groupadd.1 groupdel.1 groupmod.1
- MAN_3 = shadow.3
- MAN_4 = faillog.4 passwd.4 porttime.4 shadow.4
- ! MAN_8 = faillog.8 pwconv.8 pwunconv.8 sulogin.8 mkpasswd.8
-
- DOCS = $(MAN_1) $(MAN_3) $(MAN_4) $(MAN_8)
-
- --- 174,181 ----
- useradd.1 userdel.1 usermod.1 groupadd.1 groupdel.1 groupmod.1
- MAN_3 = shadow.3
- MAN_4 = faillog.4 passwd.4 porttime.4 shadow.4
- ! MAN_8 = chpasswd.8 dpasswd.8 faillog.8 newusers.8 pwconv.8 pwunconv.8 \
- ! sulogin.8 mkpasswd.8
-
- DOCS = $(MAN_1) $(MAN_3) $(MAN_4) $(MAN_8)
-
- Index: dialup.c
- *** rel3/dialup.c Thu Sep 12 08:47:07 1991
- --- dialup.c Thu Sep 12 08:48:51 1991
- ***************
- *** 20,26 ****
- #include "dialup.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)dialup.c 3.4 07:58:44 5/30/91";
- #endif
-
- static FILE *dialpwd;
- --- 20,26 ----
- #include "dialup.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)dialup.c 3.5 17:31:19 8/4/91";
- #endif
-
- static FILE *dialpwd;
- ***************
- *** 65,70 ****
- --- 65,73 ----
-
- if (feof (fp))
- return ((struct dialup *) 0);
- +
- + if (cp = strchr (buf, '\n'))
- + *cp = '\0';
-
- if (! (cp = strchr (buf, ':')))
- return ((struct dialup *) 0);
- Index: dpmain.c
- *** rel3/dpmain.c Thu Sep 12 08:47:54 1991
- --- dpmain.c Thu Sep 12 08:48:52 1991
- ***************
- *** 1,5 ****
- /*
- ! * Copyright 1990, John F. Haugh II
- * All rights reserved.
- *
- * Permission is granted to copy and create derivative works for any
- --- 1,5 ----
- /*
- ! * Copyright 1990, 1991 John F. Haugh II
- * All rights reserved.
- *
- * Permission is granted to copy and create derivative works for any
- ***************
- *** 21,27 ****
- #include "dialup.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)dpmain.c 3.3 08:56:25 7/10/91";
- #endif
-
- #ifdef USG
- --- 21,27 ----
- #include "dialup.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)dpmain.c 3.4 17:31:55 8/4/91";
- #endif
-
- #ifdef USG
- ***************
- *** 48,54 ****
-
- usage ()
- {
- ! fprintf (stderr, "Usage: %s -a|c|d shell\n", Prog);
- exit (1);
- }
-
- --- 48,54 ----
-
- usage ()
- {
- ! fprintf (stderr, "Usage: %s [ -(a|d) ] shell\n", Prog);
- exit (1);
- }
-
- ***************
- *** 88,116 ****
- usage ();
- }
- }
- if (aflg + dflg != 1)
- usage ();
-
- if (aflg) {
- dent.du_shell = shell;
- dent.du_passwd = "";
-
- ! if (! (cp = getpass (PASS1))) {
- ! unlink (DTMP);
- exit (1);
- ! }
- strcpy (pass, cp);
- bzero (cp, strlen (cp));
-
- ! if (! (cp = getpass (PASS2))) {
- ! unlink (DTMP);
- exit (1);
- ! }
- if (strcmp (pass, cp)) {
- bzero (pass, strlen (pass));
- bzero (cp, strlen (cp));
- fprintf (stderr, NOMATCH, Prog);
- ! unlink (DTMP);
- exit (1);
- }
- bzero (cp, strlen (cp));
- --- 88,135 ----
- usage ();
- }
- }
- + if (! aflg && ! dflg)
- + aflg++;
- +
- + if (! shell) {
- + if (optind >= argc)
- + usage ();
- + else
- + shell = argv[optind];
- + }
- if (aflg + dflg != 1)
- usage ();
-
- + /*
- + * Add a new shell to the password file, or update an existing
- + * entry. Begin by getting an encrypted password for this
- + * shell.
- + */
- +
- if (aflg) {
- + int tries = 3;
- +
- dent.du_shell = shell;
- dent.du_passwd = "";
-
- ! again:
- ! if (! (cp = getpass (PASS1)))
- exit (1);
- !
- strcpy (pass, cp);
- bzero (cp, strlen (cp));
-
- ! if (! (cp = getpass (PASS2)))
- exit (1);
- !
- if (strcmp (pass, cp)) {
- bzero (pass, strlen (pass));
- bzero (cp, strlen (cp));
- fprintf (stderr, NOMATCH, Prog);
- !
- ! if (--tries)
- ! goto again;
- !
- exit (1);
- }
- bzero (cp, strlen (cp));
- ***************
- *** 117,122 ****
- --- 136,148 ----
- dent.du_passwd = pw_encrypt (pass, (char *) 0);
- bzero (pass, strlen (pass));
- }
- +
- + /*
- + * Create the temporary file for the updated dialup password
- + * information to be placed into. Turn it into a (FILE *)
- + * for use by putduent().
- + */
- +
- if ((fd = open (DTMP, O_CREAT|O_EXCL|O_RDWR, 0600)) < 0) {
- sprintf (pass, "%s: can't create %s", Prog, DTMP);
- perror (pass);
- ***************
- *** 127,132 ****
- --- 153,165 ----
- perror (pass);
- exit (1);
- }
- +
- + /*
- + * Scan the dialup password file for the named entry,
- + * copying out other entries along the way. Copying
- + * stops when a match is found or the file runs out.
- + */
- +
- while (dial = getduent ()) {
- if (strcmp (dial->du_shell, shell) == 0) {
- found = 1;
- ***************
- *** 135,140 ****
- --- 168,180 ----
- if (putduent (dial, fp))
- goto failure;
- }
- +
- + /*
- + * To delete the entry, just don't copy it. To update
- + * the entry, output the modified version - works with
- + * new entries as well.
- + */
- +
- if (dflg && ! found) {
- fprintf (stderr, NOMATCH, Prog, shell);
- exit (1);
- ***************
- *** 143,148 ****
- --- 183,195 ----
- if (putduent (&dent, fp))
- goto failure;
-
- + /*
- + * Now copy out the remaining entries. Flush and close the
- + * new file before doing anything nasty to the existing
- + * file.
- + */
- +
- +
- while (dial = getduent ())
- if (putduent (dial, fp))
- goto failure;
- ***************
- *** 149,154 ****
- --- 196,211 ----
-
- if (fflush (fp))
- goto failure;
- +
- + fclose (fp);
- +
- + /*
- + * If the original file did not exist, we must create a new
- + * file with owner "root" and mode 400. Otherwise we copy
- + * the modes from the existing file to the new file.
- + *
- + * After this is done the new file will replace the old file.
- + */
-
- if (! stat (DIALPWD, &sb)) {
- chown (DTMP, sb.st_uid, sb.st_gid);
- Index: dpasswd.8
- *** /dev/null Thu Sep 12 08:46:59 1991
- --- dpasswd.8 Thu Sep 12 08:48:53 1991
- ***************
- *** 0 ****
- --- 1,34 ----
- + .\" Copyright 1991, John F. Haugh II
- + .\" All rights reserved.
- + .\"
- + .\" Permission is granted to copy and create derivative works for any
- + .\" non-commercial purpose, provided this copyright notice is preserved
- + .\" in all copies of source code, or included in human readable form
- + .\" and conspicuously displayed on all copies of object code or
- + .\" distribution media.
- + .\"
- + .\" @(#)dpasswd.8 3.1 17:36:06 8/4/91
- + .\"
- + .TH DPASSWD 8
- + .SH NAME
- + \fBdpasswd\fR - change dialup password
- + .SH SYNOPSIS
- + \fBdpasswd\fR
- + [ \fI-(a|d)\fR ] \fIshell\fR
- + .SH DESCRIPTION
- + \fBdpasswd\fR adds, deletes, and updates dialup passwords for user
- + login shells.
- + The dialup password is prompted for after a user's password has been
- + authenticated whenever the user logs in over a dialup line.
- + \fBdpasswd\fR will prompt for the new password twice to insure it
- + has been entered correctly.
- + .PP
- + The \fIshell\fR argument must be the complete pathname of the login
- + program.
- + .SH FILES
- + .br
- + /etc/d_passwd
- + .br
- + /etc/dialups
- + .SH SEE ALSO
- + login(1)
- Index: chage.c
- *** rel3/chage.c Thu Sep 12 08:47:46 1991
- --- chage.c Thu Sep 12 08:48:55 1991
- ***************
- *** 17,23 ****
- #include <time.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)chage.c 3.8 09:01:54 6/26/91";
- #endif
-
- /*
- --- 17,23 ----
- #include <time.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)chage.c 3.9 10:14:30 8/15/91";
- #endif
-
- /*
- ***************
- *** 677,682 ****
- --- 677,683 ----
- }
- #if defined(DBM) || defined(NDBM)
- (void) pw_dbm_update (&pwent);
- + endpwent ();
- #endif
- }
-
- ***************
- *** 718,723 ****
- --- 719,725 ----
- #endif
- exit (1);
- }
- + endspent ();
- #endif /* NDBM */
-
- /*
- Index: chfn.c
- *** rel3/chfn.c Thu Sep 12 08:48:05 1991
- --- chfn.c Thu Sep 12 08:48:58 1991
- ***************
- *** 15,21 ****
- #include <signal.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)chfn.c 3.6 08:51:33 7/10/91";
- #endif
-
- /*
- --- 15,21 ----
- #include <signal.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)chfn.c 3.7 10:14:35 8/15/91";
- #endif
-
- /*
- ***************
- *** 534,539 ****
- --- 534,540 ----
- #endif
- exit (1);
- }
- + endpwent ();
- #endif
-
- /*
- Index: chsh.c
- *** rel3/chsh.c Thu Sep 12 08:46:46 1991
- --- chsh.c Thu Sep 12 08:49:00 1991
- ***************
- *** 15,21 ****
- #include <signal.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)chsh.c 3.4 09:07:12 5/28/91";
- #endif
-
- /*
- --- 15,21 ----
- #include <signal.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)chsh.c 3.6 20:58:54 8/15/91";
- #endif
-
- /*
- ***************
- *** 57,62 ****
- --- 57,63 ----
-
- extern struct passwd *getpwuid ();
- extern struct passwd *getpwnam ();
- + extern void change_field ();
- extern int optind;
- extern char *optarg;
- extern char *getlogin ();
- ***************
- *** 439,444 ****
- --- 440,446 ----
- #endif
- exit (1);
- }
- + endpwent ();
- #endif
-
- /*
- Index: gpmain.c
- *** rel3/gpmain.c Thu Sep 12 08:47:56 1991
- --- gpmain.c Thu Aug 15 21:04:40 1991
- ***************
- *** 43,49 ****
- #endif
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)gpmain.c 3.8 09:11:39 7/17/91";
- #endif
-
- char name[BUFSIZ];
- --- 43,49 ----
- #endif
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)gpmain.c 3.9 10:14:40 8/15/91";
- #endif
-
- char name[BUFSIZ];
- ***************
- *** 524,534 ****
- --- 524,536 ----
- fprintf (stderr, "%s: can't update DBM files\n", Prog);
- exit (1);
- }
- + endgrent ();
- #ifdef SHADOWGRP
- if (access ("/etc/gshadow.pag", 0) == 0 && ! sgr_dbm_update (&sgent)) {
- fprintf (stderr, "%s: can't update DBM shadow files\n", Prog);
- exit (1);
- }
- + endsgent ();
- #endif
- #endif
- exit (0);
- Index: groupadd.c
- *** rel3/groupadd.c Thu Sep 12 08:47:33 1991
- --- groupadd.c Thu Sep 12 08:49:03 1991
- ***************
- *** 10,16 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)groupadd.c 3.1 22:59:04 6/13/91";
- #endif
-
- #include <sys/types.h>
- --- 10,16 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)groupadd.c 3.3 08:43:44 9/12/91";
- #endif
-
- #include <sys/types.h>
- ***************
- *** 120,126 ****
- void
- grp_update ()
- {
- - int i;
- struct group grp;
- #ifdef SHADOWGRP
- struct sgrp sgrp;
- --- 120,125 ----
- ***************
- *** 153,158 ****
- --- 152,158 ----
- fprintf (stderr, "%s: cannot add new dbm group entry\n", Prog);
- exit (1);
- }
- + endgrent ();
- #endif /* NDBM */
-
- #ifdef SHADOWGRP
- ***************
- *** 175,180 ****
- --- 175,181 ----
- fprintf (stderr, "%s: cannot add new dbm group entry\n", Prog);
- exit (1);
- }
- + endsgent ();
- #endif /* NDBM */
- #endif /* SHADOWGRP */
- #ifdef USE_SYSLOG
- ***************
- *** 191,197 ****
- * uniqueness.
- */
-
- ! int
- find_new_gid ()
- {
- struct group *grp;
- --- 192,198 ----
- * uniqueness.
- */
-
- ! void
- find_new_gid ()
- {
- struct group *grp;
- ***************
- *** 241,249 ****
- {
- extern int optind;
- extern char *optarg;
- - struct group *grp;
- char *end;
- - int anyflag = 0;
- int arg;
-
- while ((arg = getopt (argc, argv, "og:")) != EOF) {
- --- 242,248 ----
- ***************
- *** 269,276 ****
- default:
- usage ();
- }
- - anyflag++;
- }
- if (optind == argc - 1)
- strcpy (group_name, argv[argc - 1]);
- else
- --- 268,277 ----
- default:
- usage ();
- }
- }
- + if (! gflg)
- + find_new_gid ();
- +
- if (optind == argc - 1)
- strcpy (group_name, argv[argc - 1]);
- else
- Index: groupdel.c
- *** rel3/groupdel.c Thu Sep 12 08:47:37 1991
- --- groupdel.c Thu Sep 12 08:49:04 1991
- ***************
- *** 10,16 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)groupdel.c 3.1 22:59:09 6/13/91";
- #endif
-
- #include <sys/types.h>
- --- 10,16 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)groupdel.c 3.3 08:43:48 9/12/91";
- #endif
-
- #include <sys/types.h>
- ***************
- *** 42,56 ****
- extern char *malloc();
-
- extern struct group *getgrnam();
- - extern struct group *gr_next();
- - extern struct group *gr_locate();
- extern int gr_lock();
- extern int gr_unlock();
- - extern int gr_rewind();
- extern int gr_open();
-
- #ifdef SHADOWGRP
- - extern struct sgrp *sgr_locate();
- extern int sgr_lock();
- extern int sgr_unlock();
- extern int sgr_open();
- --- 42,52 ----
- ***************
- *** 75,81 ****
- void
- grp_update ()
- {
- - int i;
- struct group *ogrp;
-
- if (! gr_remove (group_name)) {
- --- 71,76 ----
- ***************
- *** 96,101 ****
- --- 91,97 ----
- exit (1);
- }
- }
- + endgrent ();
- #endif /* NDBM */
-
- #ifdef SHADOWGRP
- ***************
- *** 123,128 ****
- --- 119,125 ----
- exit (1);
- }
- }
- + endsgent ();
- #endif /* NDBM */
- #endif /* SHADOWGRP */
- #ifdef USE_SYSLOG
- Index: groupmod.c
- *** rel3/groupmod.c Thu Sep 12 08:47:39 1991
- --- groupmod.c Thu Sep 12 08:49:06 1991
- ***************
- *** 10,16 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)groupmod.c 3.1 22:59:07 6/13/91";
- #endif
-
- #include <sys/types.h>
- --- 10,16 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)groupmod.c 3.3 08:43:51 9/12/91";
- #endif
-
- #include <sys/types.h>
- ***************
- *** 118,124 ****
- void
- grp_update ()
- {
- - int i;
- struct group grp;
- struct group *ogrp;
- #ifdef SHADOWGRP
- --- 118,123 ----
- ***************
- *** 166,171 ****
- --- 165,171 ----
- Prog);
- exit (1);
- }
- + endgrent ();
- }
- #endif /* NDBM */
-
- ***************
- *** 202,207 ****
- --- 202,208 ----
- Prog);
- exit (1);
- }
- + endsgent ();
- }
- #endif /* NDBM */
- #endif /* SHADOWGRP */
- ***************
- *** 259,267 ****
- {
- extern int optind;
- extern char *optarg;
- - struct group *grp;
- char *end;
- - int anyflag = 0;
- int arg;
-
- while ((arg = getopt (argc, argv, "og:n:")) != EOF) {
- --- 260,266 ----
- ***************
- *** 290,296 ****
- default:
- usage ();
- }
- - anyflag++;
- }
- if (optind == argc - 1)
- strcpy (group_name, argv[argc - 1]);
- --- 289,294 ----
- Index: passwd.c
- *** rel3/passwd.c Thu Sep 12 08:48:03 1991
- --- passwd.c Thu Sep 12 08:49:08 1991
- ***************
- *** 16,22 ****
- #include <signal.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)passwd.c 3.4 09:04:52 7/10/91";
- #endif
-
- /*
- --- 16,22 ----
- #include <signal.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)passwd.c 3.6 08:43:55 9/12/91";
- #endif
-
- /*
- ***************
- *** 153,158 ****
- --- 153,159 ----
- * new_password - validate old password and replace with new
- */
-
- + /*ARGSUSED*/
- int
- new_password (pw, sp)
- struct passwd *pw;
- ***************
- *** 246,251 ****
- --- 247,253 ----
- * password for the given user.
- */
-
- + /*ARGSUSED*/
- void
- check_password (pw, sp)
- struct passwd *pw;
- ***************
- *** 370,384 ****
- * print_status - print current password status
- */
-
- void
- ! print_status (sp)
- struct spwd *sp;
- {
- struct tm *tm;
- ! time_t time;
-
- ! time = sp->sp_lstchg * SCALE;
- ! tm = gmtime (&time);
-
- printf ("%s ", sp->sp_namp);
- printf ("%s ",
- --- 372,388 ----
- * print_status - print current password status
- */
-
- + /*ARGSUSED*/
- void
- ! print_status (pw, sp)
- ! struct passwd *pw;
- struct spwd *sp;
- {
- struct tm *tm;
- ! time_t last_time;
-
- ! last_time = sp->sp_lstchg * SCALE;
- ! tm = gmtime (&last_time);
-
- printf ("%s ", sp->sp_namp);
- printf ("%s ",
- ***************
- *** 640,646 ****
- tspwd.sp_pwdp = strdup (sp->sp_pwdp);
-
- if (Sflg) {
- ! print_status (sp);
- #ifdef USE_SYSLOG
- closelog ();
- #endif
- --- 644,650 ----
- tspwd.sp_pwdp = strdup (sp->sp_pwdp);
-
- if (Sflg) {
- ! print_status (pw, sp);
- #ifdef USE_SYSLOG
- closelog ();
- #endif
- ***************
- *** 766,771 ****
- --- 770,776 ----
- (void) spw_unlock ();
- exit (1);
- }
- + endspent ();
- #endif
-
- /*
- ***************
- *** 795,798 ****
- --- 800,804 ----
- closelog ();
- #endif
- exit (0);
- + /*NOTREACHED*/
- }
- Index: useradd.c
- *** rel3/useradd.c Thu Sep 12 08:47:40 1991
- --- useradd.c Thu Sep 12 08:49:12 1991
- ***************
- *** 10,16 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)useradd.c 3.4 09:39:58 6/26/91";
- #endif
-
- #include <sys/types.h>
- --- 10,16 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)useradd.c 3.5 10:14:59 8/15/91";
- #endif
-
- #include <sys/types.h>
- ***************
- *** 775,780 ****
- --- 775,781 ----
- Prog);
- exit (1);
- }
- + endgrent ();
- #endif
- #ifdef USE_SYSLOG
- syslog (LOG_INFO, "add `%s' to group `%s'\n",
- ***************
- *** 827,832 ****
- --- 828,834 ----
- Prog);
- exit (1);
- }
- + endsgent ();
- #endif
- #ifdef USE_SYSLOG
- syslog (LOG_INFO, "add `%s' to shadow group `%s'\n",
- ***************
- *** 1128,1133 ****
- --- 1130,1136 ----
- Prog);
- exit (1);
- }
- + endpwent ();
- #endif
- #ifdef NDBM
- if (access ("/etc/shadow.pag", 0) == 0 && ! sp_dbm_update (&spent)) {
- ***************
- *** 1135,1140 ****
- --- 1138,1144 ----
- Prog);
- exit (1);
- }
- + endspent ();
- #endif
- #ifdef USE_SYSLOG
- syslog (LOG_INFO,
- Index: userdel.c
- *** rel3/userdel.c Thu Sep 12 08:47:41 1991
- --- userdel.c Thu Sep 12 08:49:17 1991
- ***************
- *** 10,16 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)userdel.c 3.7 09:40:05 6/26/91";
- #endif
-
- #include <sys/types.h>
- --- 10,16 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)userdel.c 3.8 10:15:05 8/15/91";
- #endif
-
- #include <sys/types.h>
- ***************
- *** 205,210 ****
- --- 205,211 ----
- Prog);
- exit (1);
- }
- + endgrent ();
- #endif /* NDBM */
- #ifdef USE_SYSLOG
- syslog (LOG_INFO, "delete `%s' from group `%s'\n",
- ***************
- *** 261,266 ****
- --- 262,268 ----
- Prog);
- exit (1);
- }
- + endsgent ();
- #endif
- #ifdef USE_SYSLOG
- syslog (LOG_INFO, "delete `%s' from shadow group `%s'\n",
- ***************
- *** 374,379 ****
- --- 376,383 ----
- fprintf (stderr,
- "%s: error deleting password dbm entry\n",
- Prog);
- +
- + endpwent ();
- }
-
- /*
- ***************
- *** 385,390 ****
- --- 389,395 ----
- for (pw_rewind (), pwd = pw_next ();pwd;pwd = pw_next ()) {
- if (pwd->pw_uid == user_id) {
- pw_dbm_update (pwd);
- + endpwent ();
- break;
- }
- }
- ***************
- *** 393,398 ****
- --- 398,405 ----
- if (access ("/etc/shadow.pag", 0) == 0 && ! sp_dbm_remove (user_name))
- fprintf (stderr, "%s: error deleting shadow passwd dbm entry\n",
- Prog);
- +
- + endspent ();
- #endif
- #ifdef USE_SYSLOG
- syslog (LOG_INFO, "delete user `%s'\n", user_name);
- Index: usermod.c
- *** rel3/usermod.c Thu Sep 12 08:47:42 1991
- --- usermod.c Thu Sep 12 08:49:19 1991
- ***************
- *** 10,16 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)usermod.c 3.3 09:29:57 6/26/91";
- #endif
-
- #include <sys/types.h>
- --- 10,16 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)usermod.c 3.4 10:15:08 8/15/91";
- #endif
-
- #include <sys/types.h>
- ***************
- *** 621,626 ****
- --- 621,627 ----
- Prog);
- exit (1);
- }
- + endgrent ();
- #endif
- }
-
- ***************
- *** 723,728 ****
- --- 724,730 ----
- Prog);
- exit (1);
- }
- + endsgent ();
- #endif
- }
- #endif
- ***************
- *** 1036,1041 ****
- --- 1038,1044 ----
- Prog);
- exit (1);
- }
- + endpwent ();
- }
- #endif
- }
- ***************
- *** 1063,1068 ****
- --- 1066,1072 ----
- Prog);
- exit (1);
- }
- + endspent ();
- }
- #endif
- if (Gflg || lflg)
- Index: grdbm.c
- *** rel3/grdbm.c Thu Sep 12 08:47:31 1991
- --- grdbm.c Thu Sep 12 08:49:21 1991
- ***************
- *** 1,5 ****
- /*
- ! * Copyright 1990, John F. Haugh II
- * All rights reserved.
- *
- * Use, duplication, and disclosure prohibited without
- --- 1,5 ----
- /*
- ! * Copyright 1990, 1991, John F. Haugh II
- * All rights reserved.
- *
- * Use, duplication, and disclosure prohibited without
- ***************
- *** 7,13 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)grdbm.c 3.2 22:53:58 6/13/91";
- #endif
-
- #include <string.h>
- --- 7,13 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)grdbm.c 3.3 08:44:03 9/12/91";
- #endif
-
- #include <string.h>
- ***************
- *** 89,95 ****
-
- key.dsize = sizeof i + strlen (gr->gr_name);
- key.dptr = grpkey;
- ! memcpy (grpkey, &i, sizeof i);
- strcpy (grpkey + sizeof i, gr->gr_name);
- if (dbm_store (gr_dbm, key, content, DBM_REPLACE))
- return 0;
- --- 89,95 ----
-
- key.dsize = sizeof i + strlen (gr->gr_name);
- key.dptr = grpkey;
- ! memcpy (grpkey, (char *) &i, sizeof i);
- strcpy (grpkey + sizeof i, gr->gr_name);
- if (dbm_store (gr_dbm, key, content, DBM_REPLACE))
- return 0;
- ***************
- *** 96,103 ****
-
- key.dsize = sizeof i + sizeof gr->gr_gid;
- key.dptr = grpkey;
- ! memcpy (grpkey, &i, sizeof i);
- ! memcpy (grpkey + sizeof i, &gr->gr_gid,
- sizeof gr->gr_gid);
- if (dbm_store (gr_dbm, key, content, DBM_REPLACE))
- return 0;
- --- 96,103 ----
-
- key.dsize = sizeof i + sizeof gr->gr_gid;
- key.dptr = grpkey;
- ! memcpy (grpkey, (char *) &i, sizeof i);
- ! memcpy (grpkey + sizeof i, (char *) &gr->gr_gid,
- sizeof gr->gr_gid);
- if (dbm_store (gr_dbm, key, content, DBM_REPLACE))
- return 0;
- ***************
- *** 118,127 ****
- {
- datum key;
- datum content;
- - char data[BUFSIZ*8];
- char grpkey[60];
- - char *cp;
- - int len;
- int i;
- int cnt;
- int errors = 0;
- --- 118,124 ----
- ***************
- *** 137,154 ****
- return 0;
-
- key.dsize = strlen (gr->gr_name);
- ! key.dptr = gr->gr_name;
- content = dbm_fetch (gr_dbm, key);
- if (content.dptr == 0)
- ++errors;
- else {
- if (content.dsize == sizeof (int)) {
- ! memcpy (&cnt, content.dptr, sizeof cnt);
-
- for (i = 0;i < cnt;i++) {
- key.dsize = sizeof i + strlen (gr->gr_name);
- key.dptr = grpkey;
- ! memcpy (grpkey, &i, sizeof i);
- strcpy (grpkey + sizeof i, gr->gr_name);
- if (dbm_delete (gr_dbm, key))
- ++errors;
- --- 134,151 ----
- return 0;
-
- key.dsize = strlen (gr->gr_name);
- ! key.dptr = (char *) gr->gr_name;
- content = dbm_fetch (gr_dbm, key);
- if (content.dptr == 0)
- ++errors;
- else {
- if (content.dsize == sizeof (int)) {
- ! memcpy ((char *) &cnt, content.dptr, sizeof cnt);
-
- for (i = 0;i < cnt;i++) {
- key.dsize = sizeof i + strlen (gr->gr_name);
- key.dptr = grpkey;
- ! memcpy (grpkey, (char *) &i, sizeof i);
- strcpy (grpkey + sizeof i, gr->gr_name);
- if (dbm_delete (gr_dbm, key))
- ++errors;
- ***************
- *** 159,178 ****
- }
- }
- key.dsize = sizeof gr->gr_gid;
- ! key.dptr = &gr->gr_gid;
- content = dbm_fetch (gr_dbm, key);
- if (content.dptr == 0)
- ++errors;
- else {
- if (content.dsize == sizeof (int)) {
- ! memcpy (&cnt, content.dptr, sizeof cnt);
-
- for (i = 0;i < cnt;i++) {
- key.dsize = sizeof i + sizeof gr->gr_gid;
- key.dptr = grpkey;
- ! memcpy (grpkey, &i, sizeof i);
- ! memcpy (grpkey + sizeof i,
- ! &gr->gr_gid, sizeof gr->gr_gid);
-
- if (dbm_delete (gr_dbm, key))
- ++errors;
- --- 156,175 ----
- }
- }
- key.dsize = sizeof gr->gr_gid;
- ! key.dptr = (char *) &gr->gr_gid;
- content = dbm_fetch (gr_dbm, key);
- if (content.dptr == 0)
- ++errors;
- else {
- if (content.dsize == sizeof (int)) {
- ! memcpy ((char *) &cnt, content.dptr, sizeof cnt);
-
- for (i = 0;i < cnt;i++) {
- key.dsize = sizeof i + sizeof gr->gr_gid;
- key.dptr = grpkey;
- ! memcpy (grpkey, (char *) &i, sizeof i);
- ! memcpy (grpkey + sizeof i, (char *) &gr->gr_gid,
- ! sizeof gr->gr_gid);
-
- if (dbm_delete (gr_dbm, key))
- ++errors;
- Index: faillog.c
- *** rel3/faillog.c Thu Sep 12 08:45:09 1991
- --- faillog.c Thu Sep 12 08:49:23 1991
- ***************
- *** 26,32 ****
- #include "faillog.h"
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)faillog.c 3.1 12:30:41 12/12/90";
- #endif
-
- FILE *fail; /* failure file stream */
- --- 26,32 ----
- #include "faillog.h"
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)faillog.c 3.2 08:44:11 9/12/91";
- #endif
-
- FILE *fail; /* failure file stream */
- ***************
- *** 35,42 ****
- time_t seconds; /* that number of days in seconds */
- int max; /* maximum failure count for fail_max */
-
- - int mflg; /* set fail_max for a given user */
- - int rflg; /* reset fail_cnt for user or all user's */
- int uflg; /* set if user is a valid user id */
- int tflg; /* print is restricted to most recent days */
- struct faillog faillog; /* scratch structure to play with ... */
- --- 35,40 ----
- ***************
- *** 58,64 ****
- char **argv;
- {
- char *mode;
- - int uid = 0;
- int c;
- struct passwd *pwent;
-
- --- 56,61 ----
- ***************
- *** 101,106 ****
- --- 98,104 ----
- }
- fclose (fail);
- exit (0);
- + /*NOTREACHED*/
- }
-
- print ()
- ***************
- *** 135,142 ****
- }
- }
-
- ! print_one (faillog, uid)
- ! struct faillog *faillog;
- {
- static int once;
- char *cp;
- --- 133,140 ----
- }
- }
-
- ! print_one (uid)
- ! int uid;
- {
- static int once;
- char *cp;
- ***************
- *** 148,162 ****
- once++;
- }
- pwent = getpwuid (uid);
- ! tm = localtime (&faillog->fail_time);
- cp = asctime (tm);
- cp[24] = '\0';
-
- if (pwent) {
- printf ("%-16s %4d %4d",
- ! pwent->pw_name, faillog->fail_cnt, faillog->fail_max);
- ! if (faillog->fail_time)
- ! printf (" %s on %s\n", cp, faillog->fail_line);
- else
- putchar ('\n');
- }
- --- 146,160 ----
- once++;
- }
- pwent = getpwuid (uid);
- ! tm = localtime (&faillog.fail_time);
- cp = asctime (tm);
- cp[24] = '\0';
-
- if (pwent) {
- printf ("%-16s %4d %4d",
- ! pwent->pw_name, faillog.fail_cnt, faillog.fail_max);
- ! if (faillog.fail_time)
- ! printf (" %s on %s\n", cp, faillog.fail_line);
- else
- putchar ('\n');
- }
- ***************
- *** 210,216 ****
-
- setmax ()
- {
- - int uid = 0;
- struct passwd *pwent;
-
- if (uflg) {
- --- 208,213 ----
- Index: valid.c
- *** rel3/valid.c Thu Sep 12 08:45:28 1991
- --- valid.c Thu Sep 12 08:49:24 1991
- ***************
- *** 22,28 ****
- #include "config.h"
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)valid.c 3.3 08:00:20 2/6/91";
- #endif
-
- /*
- --- 22,28 ----
- #include "config.h"
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)valid.c 3.4 08:44:15 9/12/91";
- #endif
-
- /*
- ***************
- *** 43,49 ****
- char *encrypt;
- char *salt;
- char *pw_encrypt ();
- - char *shell;
-
- /*
- * Start with blank or empty password entries. Always encrypt
- --- 43,48 ----
- Index: age.c
- *** rel3/age.c Thu Sep 12 08:44:44 1991
- --- age.c Thu Sep 12 08:49:26 1991
- ***************
- *** 17,23 ****
- #include "shadow.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)age.c 3.3 07:52:49 1/30/91";
- #endif
-
- #define DAY (24L*3600L)
- --- 17,23 ----
- #include "shadow.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)age.c 3.4 08:44:18 9/12/91";
- #endif
-
- #define DAY (24L*3600L)
- ***************
- *** 105,110 ****
- --- 105,112 ----
- sp->sp_inact = -1;
- sp->sp_expire = -1;
- sp->sp_flag = -1;
- +
- + return sp;
- }
-
- /*
- ***************
- *** 114,119 ****
- --- 116,122 ----
- * password expiration criteria.
- */
-
- + /*ARGSUSED*/
- int
- isexpired (pw, sp)
- struct passwd *pw;
- ***************
- *** 243,248 ****
- --- 246,252 ----
- return 1;
-
- exit (1);
- + /*NOTREACHED*/
- }
-
- /*
- Index: failure.c
- *** rel3/failure.c Thu Sep 12 08:45:12 1991
- --- failure.c Thu Sep 12 08:49:27 1991
- ***************
- *** 1,9 ****
- /*
- ! * Copyright 1989, 1990, John F. Haugh II
- * All rights reserved.
- *
- ! * Use, duplication, and disclosure prohibited without
- ! * the express written permission of the author.
- */
-
- #include <sys/types.h>
- --- 1,12 ----
- /*
- ! * Copyright 1989, 1990, 1991, John F. Haugh II
- * All rights reserved.
- *
- ! * Permission is granted to copy and create derivative works for any
- ! * non-commercial purpose, provided this copyright notice is preserved
- ! * in all copies of source code, or included in human readable form
- ! * and conspicuously displayed on all copies of object code or
- ! * distribution media.
- */
-
- #include <sys/types.h>
- ***************
- *** 25,31 ****
- #endif
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)failure.c 2.3 19:23:48 7/29/90";
- #endif
-
- #ifdef FAILLOG
- --- 28,34 ----
- #endif
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)failure.c 2.4 08:44:22 9/12/91";
- #endif
-
- #ifdef FAILLOG
- ***************
- *** 114,123 ****
- */
-
- void
- ! failprint (uid, fail)
- struct faillog *fail;
- {
- - int fd;
- struct tm *tp;
- char *lasttime;
-
- --- 117,125 ----
- */
-
- void
- ! failprint (fail)
- struct faillog *fail;
- {
- struct tm *tp;
- char *lasttime;
-
- Index: mkpasswd.c
- *** rel3/mkpasswd.c Thu Sep 12 08:48:04 1991
- --- mkpasswd.c Thu Sep 12 08:49:29 1991
- ***************
- *** 10,16 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)mkpasswd.c 3.6 09:07:08 7/2/91";
- static char copyright[] = "Copyright 1990, 1991, John F. Haugh II";
- #endif
-
- --- 10,16 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)mkpasswd.c 3.8 08:44:25 9/12/91";
- static char copyright[] = "Copyright 1990, 1991, John F. Haugh II";
- #endif
-
- ***************
- *** 17,23 ****
- #include "config.h"
- #include <stdio.h>
-
- ! #if defined(DBM) || defined(NDBM) /*{*/
-
- main (argc, argv)
- int argc;
- --- 17,23 ----
- #include "config.h"
- #include <stdio.h>
-
- ! #if !defined(DBM) && !defined(NDBM) /*{*/
-
- main (argc, argv)
- int argc;
- ***************
- *** 52,62 ****
- --- 52,65 ----
- DBM *gr_dbm;
- DBM *sp_dbm;
- DBM *sgr_dbm;
- + char *fgetsx();
- #endif
-
- char *CANT_OPEN = "%s: cannot open file %s\n";
- char *CANT_OVERWRITE = "%s: cannot overwrite file %s\n";
- + #ifdef DBM
- char *CANT_CREATE = "%s: cannot create %s\n";
- + #endif
- char *DBM_OPEN_ERR = "%s: cannot open DBM files for %s\n";
- char *PARSE_ERR = "%s: error parsing line\n\"%s\"\n";
- char *LINE_TOO_LONG = "%s: the beginning with \"%.16s ...\" is too long\n";
- ***************
- *** 82,91 ****
- --- 85,98 ----
-
- extern char *malloc();
- extern struct passwd *sgetpwent();
- + extern int pw_dbm_update();
- #ifdef NDBM
- extern struct group *sgetgrent();
- extern struct spwd *sgetspent();
- extern struct sgrp *sgetsgent();
- + extern int sp_dbm_update();
- + extern int gr_dbm_update();
- + extern int sgr_dbm_update();
- #endif
-
- /*
- ***************
- *** 112,118 ****
- --- 119,127 ----
- char *pag; /* Name of .pag file */
- char *cp; /* Temporary character pointer */
- int flag; /* Flag for command line option */
- + #ifdef DBM
- int fd; /* File descriptor of open DBM file */
- + #endif
- int cnt = 0; /* Number of entries in database */
- int longest = 0; /* Longest entry in database */
- int len; /* Length of input line */
- ***************
- *** 124,129 ****
- --- 133,139 ----
- struct spwd *shadow; /* Pointer to shadow passwd entry */
- struct sgrp *gshadow; /* Pointer to shadow group entry */
- DBM *dbm; /* Pointer to new NDBM files */
- + DBM *dbm_open(); /* Function to open NDBM files */
- #endif
-
- /*
- Index: shadow.c
- *** rel3/shadow.c Thu Sep 12 08:45:14 1991
- --- shadow.c Thu Sep 12 08:49:31 1991
- ***************
- *** 33,39 ****
-
-
- #ifndef lint
- ! static char sccsid[] = "@(#)shadow.c 3.8 07:57:47 2/8/91";
- #endif
-
- static FILE *shadow;
- --- 33,39 ----
-
-
- #ifndef lint
- ! static char sccsid[] = "@(#)shadow.c 3.9 08:44:32 9/12/91";
- #endif
-
- static FILE *shadow;
- ***************
- *** 46,53 ****
- void
- setspent ()
- {
- - int mode;
- -
- if (shadow)
- rewind (shadow);
- else
- --- 46,51 ----
- Index: smain.c
- *** rel3/smain.c Thu Sep 12 08:48:15 1991
- --- smain.c Thu Sep 12 08:49:33 1991
- ***************
- *** 13,19 ****
- #include <stdio.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)smain.c 3.6 08:27:44 7/15/91";
- #endif
-
- /*
- --- 13,19 ----
- #include <stdio.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)smain.c 3.7 08:44:39 9/12/91";
- #endif
-
- /*
- ***************
- *** 181,187 ****
- char **argv;
- char **envp;
- {
- ! void (*oldsig)();
- char *cp;
- char *tty = 0; /* Name of tty SU is run from */
- int doshell = 0;
- --- 181,187 ----
- char **argv;
- char **envp;
- {
- ! int (*oldsig)();
- char *cp;
- char *tty = 0; /* Name of tty SU is run from */
- int doshell = 0;
- Index: sulogin.c
- *** rel3/sulogin.c Thu Sep 12 08:48:16 1991
- --- sulogin.c Thu Sep 12 08:49:35 1991
- ***************
- *** 24,30 ****
- #include "config.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)sulogin.c 3.5 08:31:00 7/15/91";
- #endif
-
- char name[BUFSIZ];
- --- 24,30 ----
- #include "config.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)sulogin.c 3.6 08:44:50 9/12/91";
- #endif
-
- char name[BUFSIZ];
- ***************
- *** 59,64 ****
- --- 59,65 ----
- #define RETRIES 3
- #endif
-
- + /*ARGSUSED*/
- int main (argc, argv, envp)
- int argc;
- char **argv;
- Index: lmain.c
- *** rel3/lmain.c Thu Sep 12 08:47:59 1991
- --- lmain.c Thu Sep 12 08:49:37 1991
- ***************
- *** 47,53 ****
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)lmain.c 3.12 21:49:36 7/16/91";
- #endif
-
- /* danger - side effects */
- --- 47,53 ----
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)lmain.c 3.13 08:44:55 9/12/91";
- #endif
-
- /* danger - side effects */
- ***************
- *** 75,81 ****
- --- 75,83 ----
- int pflg;
- int rflg;
- int fflg;
- + #ifdef RLOGIN
- int hflg;
- + #endif
- int preauth_flag;
- #ifndef BSD
- struct termio termio;
- ***************
- *** 105,111 ****
- extern void setenv ();
- extern unsigned alarm ();
- extern void login ();
- - extern void entry ();
- extern void setutmp ();
- extern void subsystem ();
- extern void log ();
- --- 107,112 ----
- ***************
- *** 185,192 ****
- }
-
- #ifdef RLOGIN
- ! rlogin (host, name, namelen)
- ! char *host;
- char *name;
- int namelen;
- {
- --- 186,193 ----
- }
-
- #ifdef RLOGIN
- ! rlogin (remote_host, name, namelen)
- ! char *remote_host;
- char *name;
- int namelen;
- {
- ***************
- *** 203,209 ****
- if (! (pwd = getpwnam (name)))
- return 0;
-
- ! return ruserok (host, pwd->pw_uid == 0, remote_name, name);
- }
-
- get_remote_string (buf, size)
- --- 204,210 ----
- if (! (pwd = getpwnam (name)))
- return 0;
-
- ! return ruserok (remote_host, pwd->pw_uid == 0, remote_name, name);
- }
-
- get_remote_string (buf, size)
- ***************
- *** 259,265 ****
- struct spwd *spwd;
- struct spwd *getspnam();
- #ifdef CONSOLE
- - int conflag;
- char console[BUFSIZ];
- FILE *fp;
- struct stat statbuf;
- --- 260,265 ----
- ***************
- *** 509,515 ****
- --- 509,517 ----
- * been authenticated and so on.
- */
-
- + #ifdef RLOGIN
- have_name:
- + #endif
- #ifdef DIALUP
- alarm (30);
- if (pwent.pw_name && ! dialcheck (tty,
- ***************
- *** 614,624 ****
- */
-
- if (pwent.pw_uid != 0 && access (NOLOGINS, 0) == 0) {
- ! FILE *fp;
- int c;
-
- ! if (fp = fopen (NOLOGINS, "r")) {
- ! while ((c = getc (fp)) != EOF) {
- if (c == '\n')
- putchar ('\r');
-
- --- 616,626 ----
- */
-
- if (pwent.pw_uid != 0 && access (NOLOGINS, 0) == 0) {
- ! FILE *nlfp;
- int c;
-
- ! if (nlfp = fopen (NOLOGINS, "r")) {
- ! while ((c = getc (nlfp)) != EOF) {
- if (c == '\n')
- putchar ('\r');
-
- ***************
- *** 625,631 ****
- putchar (c);
- }
- fflush (stdout);
- ! fclose (fp);
- } else
- printf ("\r\nSystem closed for routine maintenance\n");
-
- --- 627,633 ----
- putchar (c);
- }
- fflush (stdout);
- ! fclose (nlfp);
- } else
- printf ("\r\nSystem closed for routine maintenance\n");
-
- ***************
- *** 684,690 ****
- #endif
- #ifdef FAILLOG
- if (faillog.fail_cnt != 0)
- ! failprint (pwent.pw_uid, &faillog);
- #endif /* FAILLOG */
- #ifdef LASTLOG
- #ifdef HUSHLOGIN
- --- 686,692 ----
- #endif
- #ifdef FAILLOG
- if (faillog.fail_cnt != 0)
- ! failprint (&faillog);
- #endif /* FAILLOG */
- #ifdef LASTLOG
- #ifdef HUSHLOGIN
- Index: obscure.c
- *** rel3/obscure.c Thu Sep 12 08:47:47 1991
- --- obscure.c Thu Sep 12 08:49:39 1991
- ***************
- *** 21,27 ****
- #include "config.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)obscure.c 3.3 09:05:34 6/26/91";
- #endif
-
- #ifdef NO_STRSTR
- --- 21,27 ----
- #include "config.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)obscure.c 3.4 08:45:08 9/12/91";
- #endif
-
- #ifdef NO_STRSTR
- ***************
- *** 57,62 ****
- --- 57,63 ----
- * check passwords.
- */
-
- + /*ARGSUSED*/
- int obscure (old, new)
- char *old;
- char *new;
- ***************
- *** 114,119 ****
- --- 115,121 ----
- * can't be a palindrome - like `R A D A R' or `M A D A M'
- */
-
- + /*ARGSUSED*/
- int palindrome (old, new)
- char *old;
- char *new;
- ***************
- *** 134,139 ****
- --- 136,142 ----
- * more than half of the characters are different ones.
- */
-
- + /*ARGSUSED*/
- int similiar (old, new)
- char *old;
- char *new;
- ***************
- *** 156,161 ****
- --- 159,165 ----
- * a nice mix of characters.
- */
-
- + /*ARGSUSED*/
- int simple (old, new)
- char *old;
- char *new;
- ***************
- *** 166,172 ****
- int others = 0;
- int size;
- int i;
- - double complexity;
-
- for (i = 0;new[i];i++) {
- if (isdigit (new[i]))
- --- 170,175 ----
- Index: mkrmdir.c
- *** rel3/mkrmdir.c Thu Sep 12 08:47:25 1991
- --- mkrmdir.c Thu Sep 12 08:49:40 1991
- ***************
- *** 14,20 ****
- #include "config.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)mkrmdir.c 3.1 10:09:21 6/13/91";
- #endif
-
- #ifdef NEED_MKDIR
- --- 14,20 ----
- #include "config.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)mkrmdir.c 3.2 08:45:12 9/12/91";
- #endif
-
- #ifdef NEED_MKDIR
- ***************
- *** 46,51 ****
- --- 46,52 ----
- umask (0777 & ~ mode);
- execl ("/bin/mkdir", "mkdir", dir, 0);
- _exit (128);
- + /*NOTREACHED*/
- }
- #endif
- #ifdef NEED_RMDIR
- ***************
- *** 72,76 ****
- --- 73,78 ----
- open ("/dev/null", O_WRONLY);
- execl ("/bin/rmdir", "rmdir", dir, 0);
- _exit (128);
- + /*NOTREACHED*/
- }
- #endif
- Index: getpass.c
- *** rel3/getpass.c Thu Sep 12 08:47:55 1991
- --- getpass.c Thu Sep 12 08:49:42 1991
- ***************
- *** 22,28 ****
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)getpass.c 3.5 08:58:53 7/10/91";
- #endif
-
- /*
- --- 22,28 ----
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)getpass.c 3.6 08:45:21 9/12/91";
- #endif
-
- /*
- ***************
- *** 78,84 ****
- char *cp;
- FILE *fp;
- int tty_opened = 0;
- ! void (*old_signal)();
- TERMIO new_modes;
- TERMIO old_modes;
-
- --- 78,84 ----
- char *cp;
- FILE *fp;
- int tty_opened = 0;
- ! int (*old_signal)();
- TERMIO new_modes;
- TERMIO old_modes;
-
- Index: grent.c
- *** rel3/grent.c Thu Sep 12 08:47:57 1991
- --- grent.c Thu Sep 12 08:49:43 1991
- ***************
- *** 32,38 ****
- #endif /* NDBM */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)grent.c 3.9 09:00:44 7/10/91";
- #endif /* !lint */
-
- #define NFIELDS 4
- --- 32,38 ----
- #endif /* NDBM */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)grent.c 3.10 08:45:25 9/12/91";
- #endif /* !lint */
-
- #define NFIELDS 4
- ***************
- *** 56,62 ****
- int cnt;
- FILE *f;
- {
- - int c;
- char *cp = buf;
- char *ep;
-
- --- 56,61 ----
- ***************
- *** 285,295 ****
- return 0;
-
- if (content.dsize == sizeof (int)) {
- ! memcpy (&cnt, content.dptr, content.dsize);
- for (cp = grpbuf, i = 0;i < cnt;i++) {
- ! memcpy (grpkey, &i, sizeof i);
- ! memcpy (grpkey + sizeof i, &grent.gr_gid,
- ! sizeof grent.gr_gid);
-
- key.dsize = sizeof i + sizeof grent.gr_gid;
- key.dptr = grpkey;
- --- 284,295 ----
- return 0;
-
- if (content.dsize == sizeof (int)) {
- ! memcpy ((char *) &cnt, content.dptr, content.dsize);
- for (cp = grpbuf, i = 0;i < cnt;i++) {
- ! memcpy (grpkey, (char *) &i, (int) sizeof i);
- ! memcpy (grpkey + sizeof i,
- ! (char *) &grent.gr_gid,
- ! (int) sizeof grent.gr_gid);
-
- key.dsize = sizeof i + sizeof grent.gr_gid;
- key.dptr = grpkey;
- ***************
- *** 380,388 ****
- return 0;
-
- if (content.dsize == sizeof (int)) {
- ! memcpy (&cnt, content.dptr, content.dsize);
- for (cp = grpbuf, i = 0;i < cnt;i++) {
- ! memcpy (grpkey, &i, sizeof i);
- strcpy (grpkey + sizeof i, name);
-
- key.dsize = sizeof i + strlen (name);
- --- 380,388 ----
- return 0;
-
- if (content.dsize == sizeof (int)) {
- ! memcpy ((char *) &cnt, content.dptr, content.dsize);
- for (cp = grpbuf, i = 0;i < cnt;i++) {
- ! memcpy (grpkey, (char *) &i, (int) sizeof i);
- strcpy (grpkey + sizeof i, name);
-
- key.dsize = sizeof i + strlen (name);
- Index: groupio.c
- *** rel3/groupio.c Thu Sep 12 08:47:43 1991
- --- groupio.c Thu Sep 12 08:49:45 1991
- ***************
- *** 36,42 ****
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)groupio.c 3.8 09:03:34 6/26/91";
- #endif
-
- static int islocked;
- --- 36,42 ----
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)groupio.c 3.9 08:45:35 9/12/91";
- #endif
-
- static int islocked;
- ***************
- *** 123,129 ****
- for (i = 0;grent->gr_mem[i];i++)
- free (grent->gr_mem[i]);
-
- ! free (grent->gr_mem);
- }
-
- /*
- --- 123,129 ----
- for (i = 0;grent->gr_mem[i];i++)
- free (grent->gr_mem[i]);
-
- ! free ((char *) grent->gr_mem);
- }
-
- /*
- ***************
- *** 357,370 ****
- gr_close ()
- {
- char backup[BUFSIZ];
- - int fd;
- int mask;
- int c;
- - int i;
- int errors = 0;
- FILE *bkfp;
- struct gr_file_entry *grf;
- - struct gr_file_entry *ogrf;
- struct stat sb;
-
- if (! isopen) {
- --- 357,367 ----
- ***************
- *** 443,454 ****
-
- if (grf->grf_entry) {
- gr_free (grf->grf_entry);
- ! free (grf->grf_entry);
- }
- if (grf->grf_line)
- free (grf->grf_line);
-
- ! free (grf);
- }
- grf_tail = 0;
- isopen = 0;
- --- 440,451 ----
-
- if (grf->grf_entry) {
- gr_free (grf->grf_entry);
- ! free ((char *) grf->grf_entry);
- }
- if (grf->grf_line)
- free (grf->grf_line);
-
- ! free ((char *) grf);
- }
- grf_tail = 0;
- isopen = 0;
- Index: grpack.c
- *** rel3/grpack.c Thu Sep 12 08:45:57 1991
- --- grpack.c Thu Sep 12 08:49:50 1991
- ***************
- *** 19,25 ****
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)grpack.c 3.2 08:11:20 11/21/90";
- #endif
-
- int gr_pack (group, buf)
- --- 19,25 ----
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)grpack.c 3.3 08:45:46 9/12/91";
- #endif
-
- int gr_pack (group, buf)
- ***************
- *** 36,42 ****
- strcpy (cp, group->gr_passwd);
- cp += strlen (cp) + 1;
-
- ! memcpy (cp, (void *) &group->gr_gid, sizeof group->gr_gid);
- cp += sizeof group->gr_gid;
-
- for (i = 0;group->gr_mem[i];i++) {
- --- 36,42 ----
- strcpy (cp, group->gr_passwd);
- cp += strlen (cp) + 1;
-
- ! memcpy (cp, (char *) &group->gr_gid, sizeof group->gr_gid);
- cp += sizeof group->gr_gid;
-
- for (i = 0;group->gr_mem[i];i++) {
- ***************
- *** 66,72 ****
- if (buf - org > len)
- return -1;
-
- ! memcpy ((void *) &group->gr_gid, (void *) buf, sizeof group->gr_gid);
- buf += sizeof group->gr_gid;
- if (buf - org > len)
- return -1;
- --- 66,72 ----
- if (buf - org > len)
- return -1;
-
- ! memcpy ((char *) &group->gr_gid, (char *) buf, sizeof group->gr_gid);
- buf += sizeof group->gr_gid;
- if (buf - org > len)
- return -1;
- Index: gsdbm.c
- *** rel3/gsdbm.c Thu Sep 12 08:47:31 1991
- --- gsdbm.c Thu Sep 12 08:49:51 1991
- ***************
- *** 1,5 ****
- /*
- ! * Copyright 1990, John F. Haugh II
- * All rights reserved.
- *
- * Permission is granted to copy and create derivative works for any
- --- 1,5 ----
- /*
- ! * Copyright 1990, 1991, John F. Haugh II
- * All rights reserved.
- *
- * Permission is granted to copy and create derivative works for any
- ***************
- *** 10,16 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)gsdbm.c 3.4 22:55:17 6/13/91";
- #endif
-
- #include <string.h>
- --- 10,16 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)gsdbm.c 3.5 08:45:49 9/12/91";
- #endif
-
- #include <string.h>
- ***************
- *** 81,87 ****
-
- key.dsize = sizeof i + strlen (sgr->sg_name);
- key.dptr = sgrpkey;
- ! memcpy (sgrpkey, &i, sizeof i);
- strcpy (sgrpkey + sizeof i, sgr->sg_name);
- if (dbm_store (sgr_dbm, key, content, DBM_REPLACE))
- return 0;
- --- 81,87 ----
-
- key.dsize = sizeof i + strlen (sgr->sg_name);
- key.dptr = sgrpkey;
- ! memcpy (sgrpkey, (char *) &i, sizeof i);
- strcpy (sgrpkey + sizeof i, sgr->sg_name);
- if (dbm_store (sgr_dbm, key, content, DBM_REPLACE))
- return 0;
- ***************
- *** 103,109 ****
- datum key;
- datum content;
- char grpkey[60];
- - char *cp;
- int i;
- int cnt;
- int errors = 0;
- --- 103,108 ----
- ***************
- *** 125,136 ****
- ++errors;
- else {
- if (content.dsize == sizeof (int)) {
- ! memcpy (&cnt, content.dptr, sizeof cnt);
-
- for (i = 0;i < cnt;i++) {
- key.dsize = sizeof i + strlen (name);
- key.dptr = grpkey;
- ! memcpy (grpkey, &i, sizeof i);
- strcpy (grpkey + sizeof i, name);
- if (dbm_delete (sgr_dbm, key))
- ++errors;
- --- 124,135 ----
- ++errors;
- else {
- if (content.dsize == sizeof (int)) {
- ! memcpy ((char *) &cnt, content.dptr, sizeof cnt);
-
- for (i = 0;i < cnt;i++) {
- key.dsize = sizeof i + strlen (name);
- key.dptr = grpkey;
- ! memcpy (grpkey, (char *) &i, sizeof i);
- strcpy (grpkey + sizeof i, name);
- if (dbm_delete (sgr_dbm, key))
- ++errors;
- Index: gshadow.c
- *** rel3/gshadow.c Thu Sep 12 08:47:58 1991
- --- gshadow.c Thu Sep 12 08:49:53 1991
- ***************
- *** 32,38 ****
-
-
- #ifndef lint
- ! static char sccsid[] = "@(#)gshadow.c 3.6 09:02:02 7/10/91";
- #endif
-
- #define MAXMEM 1024
- --- 32,38 ----
-
-
- #ifndef lint
- ! static char sccsid[] = "@(#)gshadow.c 3.7 08:45:58 9/12/91";
- #endif
-
- #define MAXMEM 1024
- ***************
- *** 125,136 ****
- {
- char *fields[FIELDS];
- char *cp;
- - char *cpp;
- int atoi ();
- long atol ();
- int i;
-
- ! strncpy (sgrbuf, string, sizeof sgrbuf - 1);
- sgrbuf[sizeof sgrbuf - 1] = '\0';
-
- if (cp = strrchr (sgrbuf, '\n'))
- --- 125,135 ----
- {
- char *fields[FIELDS];
- char *cp;
- int atoi ();
- long atol ();
- int i;
-
- ! strncpy (sgrbuf, string, (int) sizeof sgrbuf - 1);
- sgrbuf[sizeof sgrbuf - 1] = '\0';
-
- if (cp = strrchr (sgrbuf, '\n'))
- ***************
- *** 225,231 ****
- {
- char buf[sizeof sgrbuf];
- char *cp = buf;
- - int errors = 0;
- int i;
-
- if (! fp || ! sgrp)
- --- 224,229 ----
- Index: newusers.c
- *** rel3/newusers.c Thu Sep 12 08:46:53 1991
- --- newusers.c Thu Sep 12 08:49:54 1991
- ***************
- *** 26,37 ****
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)newusers.c 3.3 09:07:46 5/28/91";
- #endif
-
- char *Prog;
-
- extern char *pw_encrypt();
-
- int pw_lock(), gr_lock();
- int pw_open(), gr_open();
- --- 26,38 ----
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)newusers.c 3.4 08:46:03 9/12/91";
- #endif
-
- char *Prog;
-
- extern char *pw_encrypt();
- + extern char *malloc();
-
- int pw_lock(), gr_lock();
- int pw_open(), gr_open();
- ***************
- *** 60,66 ****
- int status;
- int pid;
- int i;
- - char buf[BUFSIZ];
-
- mode = (~mode & 0777);
- mask = umask (mode);
- --- 61,66 ----
- ***************
- *** 92,100 ****
- */
-
- int
- ! add_group (name, uid, gid, ngid)
- char *name;
- - char *uid;
- char *gid;
- int *ngid;
- {
- --- 92,99 ----
- */
-
- int
- ! add_group (name, gid, ngid)
- char *name;
- char *gid;
- int *ngid;
- {
- ***************
- *** 176,182 ****
- */
-
- if (i == -1) {
- ! for (i = 100, gr_rewind;grp = gr_next ();)
- if (grp->gr_gid >= i)
- i = grp->gr_gid + 1;
- }
- --- 175,181 ----
- */
-
- if (i == -1) {
- ! for (i = 100, gr_rewind ();grp = gr_next ();)
- if (grp->gr_gid >= i)
- i = grp->gr_gid + 1;
- }
- ***************
- *** 270,277 ****
- struct spwd *sp;
- struct spwd spent;
- #endif
- - struct passwd *pw;
- - struct passwd pwent;
- static char newage[5];
- extern char *l64a();
-
- --- 269,274 ----
- ***************
- *** 364,384 ****
- char buf[BUFSIZ];
- char *fields[8];
- int nfields;
- - char *name;
- - char *newpwd;
- char *cp;
- #ifdef SHADOWPWD
- - struct spwd *sp;
- - struct spwd newsp;
- struct spwd *spw_locate();
- #endif
- struct passwd *pw;
- struct passwd newpw;
- struct passwd *pw_locate();
- - char newage[5];
- int errors = 0;
- int line = 0;
- - long now = time ((long *) 0) / (24L*3600L);
- int uid;
- int gid;
- int i;
- --- 361,375 ----
- ***************
- *** 496,502 ****
- */
-
- if (! (pw = pw_locate (fields[0])) &&
- ! add_group (fields[0], fields[2], fields[3], &gid)) {
- fprintf (stderr, "%s: %d: can't create GID\n",
- Prog, line);
- errors++;
- --- 487,493 ----
- */
-
- if (! (pw = pw_locate (fields[0])) &&
- ! add_group (fields[0], fields[3], &gid)) {
- fprintf (stderr, "%s: %d: can't create GID\n",
- Prog, line);
- errors++;
- ***************
- *** 611,614 ****
- --- 602,606 ----
- (void) pw_unlock ();
-
- exit (0);
- + /*NOTREACHED*/
- }
- Index: pwio.c
- *** rel3/pwio.c Thu Sep 12 08:47:45 1991
- --- pwio.c Thu Sep 12 08:49:56 1991
- ***************
- *** 37,43 ****
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)pwio.c 3.8 09:04:48 6/26/91";
- #endif
-
- static int islocked;
- --- 37,43 ----
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)pwio.c 3.9 08:46:13 9/12/91";
- #endif
-
- static int islocked;
- ***************
- *** 64,69 ****
- --- 64,71 ----
-
- static char pw_filename[BUFSIZ] = PASSWD;
-
- + extern int fputs();
- + extern char *fgets();
- extern char *strdup();
- extern char *malloc();
- extern struct passwd *sgetpwent();
- ***************
- *** 353,366 ****
- pw_close ()
- {
- char backup[BUFSIZ];
- - int fd;
- int mask;
- int c;
- - int i;
- int errors = 0;
- FILE *bkfp;
- struct pw_file_entry *pwf;
- - struct pw_file_entry *opwf;
- struct stat sb;
-
- if (! isopen) {
- --- 355,365 ----
- Index: spdbm.c
- *** rel3/spdbm.c Thu Sep 12 08:47:13 1991
- --- spdbm.c Thu Sep 12 08:49:58 1991
- ***************
- *** 7,13 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)spdbm.c 3.2 09:29:53 6/6/91";
- #endif
-
- #include <string.h>
- --- 7,13 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)spdbm.c 3.3 08:46:22 9/12/91";
- #endif
-
- #include <string.h>
- ***************
- *** 32,42 ****
- datum key;
- datum content;
- char data[BUFSIZ];
- - char spwdkey[60];
- - char *cp;
- int len;
- - int i;
- - int cnt;
- static int once;
-
- if (! once) {
- --- 32,38 ----
- Index: sppack.c
- *** rel3/sppack.c Thu Sep 12 08:45:42 1991
- --- sppack.c Thu Sep 12 08:49:59 1991
- ***************
- *** 1,13 ****
- /*
- ! * Copyright 1990, John F. Haugh II
- * All rights reserved.
- *
- ! * Use, duplication, and disclosure prohibited without
- ! * the express written permission of the author.
- ! *
- ! * Duplication is permitted for non-commercial [ profit making ]
- ! * purposes provided this and other copyright notices remain
- ! * intact.
- */
-
- #include <stdio.h>
- --- 1,12 ----
- /*
- ! * Copyright 1990, 1991, John F. Haugh II
- * All rights reserved.
- *
- ! * Permission is granted to copy and create derivative works for any
- ! * non-commercial purpose, provided this copyright notice is preserved
- ! * in all copies of source code, or included in human readable form
- ! * and conspicuously displayed on all copies of object code or
- ! * distribution media.
- */
-
- #include <stdio.h>
- ***************
- *** 20,26 ****
- #include "shadow.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)sppack.c 3.1 08:16:27 11/21/90";
- #endif
-
- int spw_pack (spwd, buf)
- --- 19,25 ----
- #include "shadow.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)sppack.c 3.2 08:46:24 9/12/91";
- #endif
-
- int spw_pack (spwd, buf)
- ***************
- *** 66,72 ****
- struct spwd *spwd;
- {
- char *org = buf;
- - char *cp;
-
- spwd->sp_namp = buf;
- buf += strlen (buf) + 1;
- --- 65,70 ----
- --
- John F. Haugh II | I am the NRA. | UUCP: ...!cs.utexas.edu!rpp386!jfh
- Ma Bell: (512) 255-8251 | Shoot a friend today!| Domain: jfh@rpp386.cactus.org
- "I think we should call `cowboys' Bovine Custodial Officers ..."
- -- Jack Vogel
-