home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 4 / 4040 < prev    next >
Text File  |  1991-09-12  |  65KB  |  3,081 lines

  1. Path: wupost!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!natinst!sequoia!rpp386!jfh
  2. From: jfh@rpp386.cactus.org (John F Haugh II)
  3. Newsgroups: alt.sources
  4. Subject: Shadow Login Suite, patch 8
  5. Message-ID: <19839@rpp386.cactus.org>
  6. Date: 12 Sep 91 13:57:09 GMT
  7. Distribution: alt
  8. Organization: River Parishes Programming, Austin TX
  9. Lines: 3070
  10.  
  11. This is the latest patch for my shadow login suite.  It includes a
  12. number of minor bug fixes, plus changes needed to make the code
  13. lint cleaner.  This is the third to last scheduled patch before the
  14. code is sent to comp.sources.misc for general release.  The next
  15. patch includes soft-configuration changes made by Chip Rosenthal,
  16. plus any bugs found in this patch.  The final patch will contain
  17. only bug fixes, no new features.  So please, send your bug reports
  18. to me.
  19.  
  20. I did want to make a point - there are now enough utilities in this
  21. suite to make it useful even if you don't want to include the login
  22. and su commands (that is, you don't trust this code or you don't
  23. trust me).  There are now general utilities for adding, modifying
  24. and deleting users and groups.  So, don't hestitate to pick and
  25. chose.
  26. --
  27. Prereq: "3.0.7"
  28. Index: patchlevel.h
  29. *** rel3/patchlevel.h    Thu Sep 12 08:47:50 1991
  30. --- patchlevel.h    Thu Aug 15 09:56:58 1991
  31. ***************
  32. *** 10,14 ****
  33.    */
  34.   
  35.   #define    RELEASE        3
  36. ! #define    PATCHLEVEL    7
  37. ! #define    VERSION        "3.0.7"
  38. --- 10,14 ----
  39.    */
  40.   
  41.   #define    RELEASE        3
  42. ! #define    PATCHLEVEL    8
  43. ! #define    VERSION        "3.0.8"
  44. Index: utmp.c
  45. *** rel3/utmp.c    Thu Sep 12 08:48:01 1991
  46. --- utmp.c    Thu Sep 12 08:48:38 1991
  47. ***************
  48. *** 31,37 ****
  49.   #endif    /* SUN || BSD */
  50.   
  51.   #ifndef    lint
  52. ! static    char    sccsid[] = "@(#)utmp.c    3.9    08:46:57    7/15/91";
  53.   #endif
  54.   
  55.   extern    struct    utmp    utent;
  56. --- 31,37 ----
  57.   #endif    /* SUN || BSD */
  58.   
  59.   #ifndef    lint
  60. ! static    char    sccsid[] = "@(#)utmp.c    3.11    08:43:33    9/12/91";
  61.   #endif
  62.   
  63.   extern    struct    utmp    utent;
  64. ***************
  65. *** 92,110 ****
  66.   
  67.           endutent ();
  68.   
  69.           if (utent.ut_line[0] == '\0') {
  70.               if (! (line = ttyname (0))) {
  71.                   (void) puts (NO_TTY);
  72.                   exit (1);
  73.               }
  74. !             (void) strncpy (utent.ut_line, line + 5,
  75. !                 sizeof utent.ut_line);
  76.           }
  77. -         if (ut && utent.ut_pid == pid)
  78. -             return;
  79. -          (void) puts (NO_UTENT);
  80. -         exit (1);
  81.       } else {
  82.           if (! (line = ttyname (0))) {
  83.               puts (NO_TTY);
  84. --- 92,111 ----
  85.   
  86.           endutent ();
  87.   
  88. +         if (!ut || utent.ut_pid != pid) {
  89. +              (void) puts (NO_UTENT);
  90. +             exit (1);
  91. +         }
  92.           if (utent.ut_line[0] == '\0') {
  93.               if (! (line = ttyname (0))) {
  94.                   (void) puts (NO_TTY);
  95.                   exit (1);
  96.               }
  97. !             if (strncmp (line, "/dev/", 5) == 0)
  98. !                 line += 5;
  99. !             (void) strncpy (utent.ut_line, line,
  100. !                     (int) sizeof utent.ut_line);
  101.           }
  102.       } else {
  103.           if (! (line = ttyname (0))) {
  104.               puts (NO_TTY);
  105. ***************
  106. *** 126,142 ****
  107.       }
  108.   #else    /* !USG */
  109.       bzero (&utent, sizeof utent);
  110. !     if (line = ttyname (0)) {
  111. !         if (strncmp (line, "/dev/", 5))
  112. !             line += 5;
  113. !         (void) strncpy (utent.ut_line, line, sizeof utent.ut_line);
  114. !         (void) time (&utent.ut_time);
  115. !         return;
  116.       }
  117.   #endif    /* !USG */
  118. -     puts (NO_TTY);
  119. -     exit (1);
  120.   }
  121.   
  122.   /*
  123. --- 127,142 ----
  124.       }
  125.   #else    /* !USG */
  126.       bzero (&utent, sizeof utent);
  127. !     if (! (line = ttyname (0))) {
  128. !         puts (NO_TTY);
  129. !         exit (1);
  130.       }
  131. +     if (strncmp (line, "/dev/", 5))
  132. +         line += 5;
  133. +     (void) strncpy (utent.ut_line, line, sizeof utent.ut_line);
  134. +     (void) time (&utent.ut_time);
  135.   #endif    /* !USG */
  136.   }
  137.   
  138.   /*
  139. Index: id.c
  140. *** rel3/id.c    Thu Sep 12 08:46:32 1991
  141. --- id.c    Thu Sep 12 08:48:40 1991
  142. ***************
  143. *** 1,19 ****
  144.   /*
  145. !  * id - print current process user identification information
  146.    *
  147. !  * This program was written by John F. Haugh II (jfh@rpp386.UUCP)
  148. !  * on 7/9/89 and placed into the public domain.
  149.    *
  150. -  * Syntax:
  151. -  *    id
  152. -  * Synopsis:
  153.    *    Print the current process identifiers.  This includes the
  154. !  *    UID, GID, effective-UID and effective-GID.
  155. !  *
  156. !  * Notes:
  157. !  *    Straightforward implementation.  Get the IDs and print
  158. !  *    them out.  This is being included as a means of exercising
  159. !  *    the low level user database routines.
  160.    */
  161.   
  162.   #include <sys/types.h>
  163. --- 1,20 ----
  164.   /*
  165. !  * Copyright 1991, John F. Haugh II
  166. !  * All rights reserved.
  167.    *
  168. !  * Permission is granted to copy and create derivative works for any
  169. !  * non-commercial purpose, provided this copyright notice is preserved
  170. !  * in all copies of source code, or included in human readable form
  171. !  * and conspicuously displayed on all copies of object code or
  172. !  * distribution media.
  173. !  */
  174. ! /*
  175. !  * id - print current process user identification information
  176.    *
  177.    *    Print the current process identifiers.  This includes the
  178. !  *    UID, GID, effective-UID and effective-GID.  Optionally print
  179. !  *    the concurrent group set if the current system supports it.
  180.    */
  181.   
  182.   #include <sys/types.h>
  183. ***************
  184. *** 22,41 ****
  185.   #include "pwd.h"
  186.   
  187.   #ifndef    lint
  188. ! static    char    sccsid[] = "@(#)id.c    3.1    12:30:47    12/12/90";
  189.   #endif
  190.   
  191.   main (argc, argv)
  192.   int    argc;
  193.   char    **argv;
  194.   {
  195.       int    id;
  196. !     int    i;
  197.       struct    passwd    *pw,
  198.               *getpwuid();
  199.       struct    group    *gr,
  200.               *getgrgid();
  201.   
  202.       if (pw = getpwuid (id = getuid ()))
  203.           printf ("uid=%d(%s)", id, pw->pw_name);
  204.       else
  205. --- 23,83 ----
  206.   #include "pwd.h"
  207.   
  208.   #ifndef    lint
  209. ! static    char    sccsid[] = "@(#)id.c    3.4    08:43:37    9/12/91";
  210. ! #endif
  211. ! usage ()
  212. ! {
  213. ! #if NGROUPS > 0
  214. !     fprintf (stderr, "usage: id [ -a ]\n");
  215. ! #else
  216. !     fprintf (stderr, "usage: id\n");
  217.   #endif
  218. +     exit (1);
  219. + }
  220.   
  221. + /*ARGSUSED*/
  222.   main (argc, argv)
  223.   int    argc;
  224.   char    **argv;
  225.   {
  226.       int    id;
  227. ! #if NGROUPS > 0
  228. ! #if NGROUPS > 100
  229. !     int    *groups;
  230. ! #else
  231. !     int    groups[NGROUPS];
  232. ! #endif
  233. !     int    ngroups;
  234. !     int    aflg = 0;
  235. ! #endif
  236.       struct    passwd    *pw,
  237.               *getpwuid();
  238.       struct    group    *gr,
  239.               *getgrgid();
  240.   
  241. + #if NGROUPS > 0
  242. +     /*
  243. +      * See if the -a flag has been given to print out the
  244. +      * concurrent group set.
  245. +      */
  246. +     if (argc > 1) {
  247. +         if (argc > 2 || strcmp (argv[1], "-a"))
  248. +             usage ();
  249. +         else
  250. +             aflg = 1;
  251. +     }
  252. + #else
  253. +     if (argc > 1)
  254. +         usage ();
  255. + #endif
  256. +     /*
  257. +      * Print out the real user ID and group ID.  If the user or
  258. +      * group does not exist, just give the numerical value.
  259. +      */
  260.       if (pw = getpwuid (id = getuid ()))
  261.           printf ("uid=%d(%s)", id, pw->pw_name);
  262.       else
  263. ***************
  264. *** 46,51 ****
  265. --- 88,98 ----
  266.       else
  267.           printf (" gid=%d", id);
  268.   
  269. +     /*
  270. +      * Print out the effective user ID and group ID if they are
  271. +      * different from the real values.
  272. +      */
  273.       if (getuid () != geteuid ()) {
  274.           if (pw = getpwuid (id = geteuid ()))
  275.               printf (" euid=%d(%s)", id, pw->pw_name);
  276. ***************
  277. *** 58,62 ****
  278. --- 105,160 ----
  279.           else
  280.               printf (" egid=%d", id);
  281.       }
  282. + #if NGROUPS > 0
  283. +     /*
  284. +      * Print out the concurrent group set if the user has requested
  285. +      * it.  The group numbers will be printed followed by their
  286. +      * names.
  287. +      */
  288. +     if (aflg && (ngroups = getgroups (0, 0)) != -1) {
  289. + #if NGROUPS > 100
  290. +         /*
  291. +          * The size of the group set is determined so an array
  292. +          * large enough to hold it can be allocated.
  293. +          */
  294. +         if (groups = (int *) malloc (ngroups * sizeof *groups)) {
  295. +             putchar ('\n');
  296. +             perror ("out of memory");
  297. +             exit (1);
  298. +         }
  299. + #endif
  300. +         /*
  301. +          * Start off the group message.  It will be of the format
  302. +          *
  303. +          *    groups=###(aaa),###(aaa),###(aaa)
  304. +          *
  305. +          * where "###" is a numerical value and "aaa" is the
  306. +          * corresponding name for each respective numerical value.
  307. +          */
  308. +         getgroups (ngroups, groups);
  309. +         printf (" groups=");
  310. +         for (i = 0;i < ngroups;i++) {
  311. +             if (i)
  312. +                 putchar (',');
  313. +             if (gr = getgrgid (groups[i]))
  314. +                 printf ("%d(%s)", groups[i], gr->gr_name);
  315. +             else
  316. +                 printf ("%d", groups[i]);
  317. +         }
  318. +     }
  319. + #endif
  320. +     /*
  321. +      * Finish off the line.
  322. +      */
  323.       putchar ('\n');
  324. +     exit (0);
  325. +     /*NOTREACHED*/
  326.   }
  327. Index: newgrp.c
  328. *** rel3/newgrp.c    Thu Sep 12 08:48:00 1991
  329. --- newgrp.c    Thu Sep 12 08:48:44 1991
  330. ***************
  331. *** 29,35 ****
  332.   #endif
  333.   
  334.   #ifndef    lint
  335. ! static    char    sccsid[] = "@(#)newgrp.c    3.6    08:51:45    7/23/91";
  336.   #endif
  337.   
  338.   #ifdef    NGROUPS
  339. --- 29,35 ----
  340.   #endif
  341.   
  342.   #ifndef    lint
  343. ! static    char    sccsid[] = "@(#)newgrp.c    3.7    08:43:39    9/12/91";
  344.   #endif
  345.   
  346.   #ifdef    NGROUPS
  347. ***************
  348. *** 90,96 ****
  349.   usage ()
  350.   {
  351.       fprintf (stderr, "usage: newgrp [ - ] [ group ]\n");
  352. -     exit (1);
  353.   }
  354.   
  355.   /*
  356. --- 90,95 ----
  357. ***************
  358. *** 106,114 ****
  359.       int    needspasswd = 0;
  360.       int    i;
  361.       char    *cp;
  362. - #ifdef    DOUBLESIZE
  363. -     int    longpass;
  364. - #endif
  365.   
  366.       /*
  367.        * save my name for error messages and save my real gid incase
  368. --- 105,110 ----
  369. ***************
  370. *** 132,140 ****
  371.        * i just use the login group id of this user.
  372.        */
  373.   
  374. !     if (argc > 0 && strcmp (argv[0], "-") == 0) {
  375. !         initflag = 1;
  376. !         argc--; argv++;
  377.       }
  378.   #ifdef    NGROUPS
  379.   
  380. --- 128,141 ----
  381.        * i just use the login group id of this user.
  382.        */
  383.   
  384. !     if (argc > 0 && argv[0][0] == '-') {
  385. !         if (strcmp (argv[0], "-") == 0) {
  386. !             initflag = 1;
  387. !             argc--; argv++;
  388. !         } else {
  389. !             usage ();
  390. !             goto failure;
  391. !         }
  392.       }
  393.   #ifdef    NGROUPS
  394.   
  395. Index: newusers.8
  396. *** /dev/null    Thu Sep 12 08:46:59 1991
  397. --- newusers.8    Thu Sep 12 08:48:46 1991
  398. ***************
  399. *** 0 ****
  400. --- 1,47 ----
  401. + .\" Copyright 1991, John F. Haugh II
  402. + .\" All rights reserved.
  403. + .\"
  404. + .\" Permission is granted to copy and create derivative works for any
  405. + .\" non-commercial purpose, provided this copyright notice is preserved
  406. + .\" in all copies of source code, or included in human readable form
  407. + .\" and conspicuously displayed on all copies of object code or
  408. + .\" distribution media.
  409. + .\"
  410. + .\"    @(#)newusers.8    3.1    16:49:47    8/4/91
  411. + .\"
  412. + .TH NEWUSERS 8
  413. + .SH NAME
  414. + \fBnewusers\fR - update and create new users in batch
  415. + .SH SYNOPSIS
  416. + \fBnewusers\fR
  417. + [ \fI new_users \fR ]
  418. + .SH DESCRIPTION
  419. + \fBnewusers\fR reads a file of user name and cleartext password pairs
  420. + and uses this information to update a group of existing users or to
  421. + create new users.
  422. + Each line is in the same format as the standard password file (see
  423. + \fIpasswd(4)\fR) with the following exceptions.
  424. + .IP "pw_passwd"
  425. + This field will be encrypted and used as the new value
  426. + of the encrpted password.
  427. + .IP "pw_age"
  428. + This field will be ignored for shadow passwords if the user already
  429. + exists.
  430. + .IP "pw_gid"
  431. + This field may be the name of an existing group, in which case the
  432. + named user will be added as a member.  If a non-existent numerical
  433. + group is given, a new group will be created having this number.
  434. + .IP "pw_dir"
  435. + This field will be checked for existence as a directory and a new
  436. + directory will the same name created if it does not already exist.
  437. + The ownership of the directory will be set to be that of the user
  438. + being created or updated.
  439. + .PP
  440. + This command is intended to be used in a large system environment where
  441. + many accounts are updated at a single time.
  442. + .SH CAVEATS
  443. + The \fImkpasswd\fR command must be executed afterwards to update the
  444. + DBM password files.
  445. + The input file must be protected since it contains unencrypted passwords.
  446. + .SH SEE ALSO
  447. + mkpasswd(8), passwd(1), useradd(1)
  448. Index: chpasswd.8
  449. *** /dev/null    Thu Sep 12 08:46:59 1991
  450. --- chpasswd.8    Thu Sep 12 08:48:47 1991
  451. ***************
  452. *** 0 ****
  453. --- 1,37 ----
  454. + .\" Copyright 1991, John F. Haugh II
  455. + .\" All rights reserved.
  456. + .\"
  457. + .\" Permission is granted to copy and create derivative works for any
  458. + .\" non-commercial purpose, provided this copyright notice is preserved
  459. + .\" in all copies of source code, or included in human readable form
  460. + .\" and conspicuously displayed on all copies of object code or
  461. + .\" distribution media.
  462. + .\"
  463. + .\"    @(#)chpasswd.8    3.1    16:50:16    8/4/91
  464. + .\"
  465. + .TH CHPASSWD 8
  466. + .SH NAME
  467. + \fBchpasswd\fR - update password file in batch
  468. + .SH SYNOPSIS
  469. + \fBchpasswd\fR
  470. + .SH DESCRIPTION
  471. + \fBchpasswd\fR reads a file of user name and cleartext password pairs
  472. + from standard input and uses this information
  473. + to update a group of existing users.
  474. + Each line is of the format
  475. + .DS
  476. +       \fIuser_name\fR:\fIpassword\fR
  477. + .DE
  478. + The named user must exist.
  479. + The supplied password will be encrypted and the password age updated,
  480. + if present.
  481. + .PP
  482. + This command is intended to be used in a large system environment where
  483. + many accounts are created at a single time.
  484. + .SH CAVEATS
  485. + The \fImkpasswd\fR command must be executed afterwards to update the
  486. + DBM password files.
  487. + The input file must be protected since it contains unencrypted passwords.
  488. + This command may be discarded in favor of the newusers(8) command.
  489. + .SH SEE ALSO
  490. + mkpasswd(8), passwd(1), useradd(1)
  491. Index: Makefile
  492. *** rel3/Makefile    Thu Sep 12 08:47:51 1991
  493. --- Makefile    Thu Sep 12 08:48:49 1991
  494. ***************
  495. *** 8,16 ****
  496.   # and conspicuously displayed on all copies of object code or
  497.   # distribution media.
  498.   #
  499. ! #    @(#)Makefile    3.18    17:45:45  - Shadow password system
  500.   #
  501. ! #    @(#)Makefile    3.18    17:45:45    7/14/91
  502.   #
  503.   SHELL = /bin/sh
  504.   
  505. --- 8,16 ----
  506.   # and conspicuously displayed on all copies of object code or
  507.   # distribution media.
  508.   #
  509. ! #    @(#)Makefile    3.20    09:37:18  - Shadow password system
  510.   #
  511. ! #    @(#)Makefile    3.20    09:37:18    8/14/91
  512.   #
  513.   SHELL = /bin/sh
  514.   
  515. ***************
  516. *** 174,180 ****
  517.       useradd.1 userdel.1 usermod.1 groupadd.1 groupdel.1 groupmod.1
  518.   MAN_3 = shadow.3
  519.   MAN_4 = faillog.4 passwd.4 porttime.4 shadow.4
  520. ! MAN_8 = faillog.8 pwconv.8 pwunconv.8 sulogin.8 mkpasswd.8
  521.   
  522.   DOCS = $(MAN_1) $(MAN_3) $(MAN_4) $(MAN_8)
  523.   
  524. --- 174,181 ----
  525.       useradd.1 userdel.1 usermod.1 groupadd.1 groupdel.1 groupmod.1
  526.   MAN_3 = shadow.3
  527.   MAN_4 = faillog.4 passwd.4 porttime.4 shadow.4
  528. ! MAN_8 = chpasswd.8 dpasswd.8 faillog.8 newusers.8 pwconv.8 pwunconv.8 \
  529. !     sulogin.8 mkpasswd.8
  530.   
  531.   DOCS = $(MAN_1) $(MAN_3) $(MAN_4) $(MAN_8)
  532.   
  533. Index: dialup.c
  534. *** rel3/dialup.c    Thu Sep 12 08:47:07 1991
  535. --- dialup.c    Thu Sep 12 08:48:51 1991
  536. ***************
  537. *** 20,26 ****
  538.   #include "dialup.h"
  539.   
  540.   #ifndef    lint
  541. ! static    char    sccsid[] = "@(#)dialup.c    3.4    07:58:44    5/30/91";
  542.   #endif
  543.   
  544.   static    FILE    *dialpwd;
  545. --- 20,26 ----
  546.   #include "dialup.h"
  547.   
  548.   #ifndef    lint
  549. ! static    char    sccsid[] = "@(#)dialup.c    3.5    17:31:19    8/4/91";
  550.   #endif
  551.   
  552.   static    FILE    *dialpwd;
  553. ***************
  554. *** 65,70 ****
  555. --- 65,73 ----
  556.   
  557.       if (feof (fp))
  558.           return ((struct dialup *) 0);
  559. +     if (cp = strchr (buf, '\n'))
  560. +         *cp = '\0';
  561.   
  562.       if (! (cp = strchr (buf, ':')))
  563.           return ((struct dialup *) 0);
  564. Index: dpmain.c
  565. *** rel3/dpmain.c    Thu Sep 12 08:47:54 1991
  566. --- dpmain.c    Thu Sep 12 08:48:52 1991
  567. ***************
  568. *** 1,5 ****
  569.   /*
  570. !  * Copyright 1990, John F. Haugh II
  571.    * All rights reserved.
  572.    *
  573.    * Permission is granted to copy and create derivative works for any
  574. --- 1,5 ----
  575.   /*
  576. !  * Copyright 1990, 1991 John F. Haugh II
  577.    * All rights reserved.
  578.    *
  579.    * Permission is granted to copy and create derivative works for any
  580. ***************
  581. *** 21,27 ****
  582.   #include "dialup.h"
  583.   
  584.   #ifndef    lint
  585. ! static    char    sccsid[] = "@(#)dpmain.c    3.3    08:56:25    7/10/91";
  586.   #endif
  587.   
  588.   #ifdef    USG
  589. --- 21,27 ----
  590.   #include "dialup.h"
  591.   
  592.   #ifndef    lint
  593. ! static    char    sccsid[] = "@(#)dpmain.c    3.4    17:31:55    8/4/91";
  594.   #endif
  595.   
  596.   #ifdef    USG
  597. ***************
  598. *** 48,54 ****
  599.   
  600.   usage ()
  601.   {
  602. !     fprintf (stderr, "Usage: %s -a|c|d shell\n", Prog);
  603.       exit (1);
  604.   }
  605.   
  606. --- 48,54 ----
  607.   
  608.   usage ()
  609.   {
  610. !     fprintf (stderr, "Usage: %s [ -(a|d) ] shell\n", Prog);
  611.       exit (1);
  612.   }
  613.   
  614. ***************
  615. *** 88,116 ****
  616.                   usage ();
  617.           }
  618.       }
  619.       if (aflg + dflg != 1)
  620.           usage ();
  621.   
  622.       if (aflg) {
  623.           dent.du_shell = shell;
  624.           dent.du_passwd = "";
  625.   
  626. !         if (! (cp = getpass (PASS1))) {
  627. !             unlink (DTMP);
  628.               exit (1);
  629. !         }
  630.           strcpy (pass, cp);
  631.           bzero (cp, strlen (cp));
  632.   
  633. !         if (! (cp = getpass (PASS2))) {
  634. !             unlink (DTMP);
  635.               exit (1);
  636. !         }
  637.           if (strcmp (pass, cp)) {
  638.               bzero (pass, strlen (pass));
  639.               bzero (cp, strlen (cp));
  640.               fprintf (stderr, NOMATCH, Prog);
  641. !             unlink (DTMP);
  642.               exit (1);
  643.           }
  644.           bzero (cp, strlen (cp));
  645. --- 88,135 ----
  646.                   usage ();
  647.           }
  648.       }
  649. +     if (! aflg && ! dflg)
  650. +         aflg++;
  651. +     if (! shell) {
  652. +         if (optind >= argc)
  653. +             usage ();
  654. +         else
  655. +             shell = argv[optind];
  656. +     }
  657.       if (aflg + dflg != 1)
  658.           usage ();
  659.   
  660. +     /*
  661. +      * Add a new shell to the password file, or update an existing
  662. +      * entry.  Begin by getting an encrypted password for this
  663. +      * shell.
  664. +      */
  665.       if (aflg) {
  666. +         int    tries = 3;
  667.           dent.du_shell = shell;
  668.           dent.du_passwd = "";
  669.   
  670. ! again:
  671. !         if (! (cp = getpass (PASS1)))
  672.               exit (1);
  673.           strcpy (pass, cp);
  674.           bzero (cp, strlen (cp));
  675.   
  676. !         if (! (cp = getpass (PASS2)))
  677.               exit (1);
  678.           if (strcmp (pass, cp)) {
  679.               bzero (pass, strlen (pass));
  680.               bzero (cp, strlen (cp));
  681.               fprintf (stderr, NOMATCH, Prog);
  682. !             if (--tries)
  683. !                 goto again;
  684.               exit (1);
  685.           }
  686.           bzero (cp, strlen (cp));
  687. ***************
  688. *** 117,122 ****
  689. --- 136,148 ----
  690.           dent.du_passwd = pw_encrypt (pass, (char *) 0);
  691.           bzero (pass, strlen (pass));
  692.       }
  693. +     /*
  694. +      * Create the temporary file for the updated dialup password
  695. +      * information to be placed into.  Turn it into a (FILE *)
  696. +      * for use by putduent().
  697. +      */
  698.       if ((fd = open (DTMP, O_CREAT|O_EXCL|O_RDWR, 0600)) < 0) {
  699.           sprintf (pass, "%s: can't create %s", Prog, DTMP);
  700.           perror (pass);
  701. ***************
  702. *** 127,132 ****
  703. --- 153,165 ----
  704.           perror (pass);
  705.           exit (1);
  706.       }
  707. +     /*
  708. +      * Scan the dialup password file for the named entry,
  709. +      * copying out other entries along the way.  Copying
  710. +      * stops when a match is found or the file runs out.
  711. +      */
  712.       while (dial = getduent ()) {
  713.           if (strcmp (dial->du_shell, shell) == 0) {
  714.               found = 1;
  715. ***************
  716. *** 135,140 ****
  717. --- 168,180 ----
  718.           if (putduent (dial, fp))
  719.               goto failure;
  720.       }
  721. +     /*
  722. +      * To delete the entry, just don't copy it.  To update
  723. +      * the entry, output the modified version - works with
  724. +      * new entries as well.
  725. +      */
  726.       if (dflg && ! found) {
  727.           fprintf (stderr, NOMATCH, Prog, shell);
  728.           exit (1);
  729. ***************
  730. *** 143,148 ****
  731. --- 183,195 ----
  732.           if (putduent (&dent, fp))
  733.               goto failure;
  734.   
  735. +     /*
  736. +      * Now copy out the remaining entries.  Flush and close the
  737. +      * new file before doing anything nasty to the existing
  738. +      * file.
  739. +      */
  740.       while (dial = getduent ())
  741.           if (putduent (dial, fp))
  742.               goto failure;
  743. ***************
  744. *** 149,154 ****
  745. --- 196,211 ----
  746.   
  747.       if (fflush (fp))
  748.           goto failure;
  749. +     fclose (fp);
  750. +     /*
  751. +      * If the original file did not exist, we must create a new
  752. +      * file with owner "root" and mode 400.  Otherwise we copy
  753. +      * the modes from the existing file to the new file.
  754. +      *
  755. +      * After this is done the new file will replace the old file.
  756. +      */
  757.   
  758.       if (! stat (DIALPWD, &sb)) {
  759.           chown (DTMP, sb.st_uid, sb.st_gid);
  760. Index: dpasswd.8
  761. *** /dev/null    Thu Sep 12 08:46:59 1991
  762. --- dpasswd.8    Thu Sep 12 08:48:53 1991
  763. ***************
  764. *** 0 ****
  765. --- 1,34 ----
  766. + .\" Copyright 1991, John F. Haugh II
  767. + .\" All rights reserved.
  768. + .\"
  769. + .\" Permission is granted to copy and create derivative works for any
  770. + .\" non-commercial purpose, provided this copyright notice is preserved
  771. + .\" in all copies of source code, or included in human readable form
  772. + .\" and conspicuously displayed on all copies of object code or
  773. + .\" distribution media.
  774. + .\"
  775. + .\"    @(#)dpasswd.8    3.1    17:36:06    8/4/91
  776. + .\"
  777. + .TH DPASSWD 8
  778. + .SH NAME
  779. + \fBdpasswd\fR - change dialup password
  780. + .SH SYNOPSIS
  781. + \fBdpasswd\fR
  782. + [ \fI-(a|d)\fR ] \fIshell\fR
  783. + .SH DESCRIPTION
  784. + \fBdpasswd\fR adds, deletes, and updates dialup passwords for user
  785. + login shells.
  786. + The dialup password is prompted for after a user's password has been
  787. + authenticated whenever the user logs in over a dialup line.
  788. + \fBdpasswd\fR will prompt for the new password twice to insure it
  789. + has been entered correctly.
  790. + .PP
  791. + The \fIshell\fR argument must be the complete pathname of the login
  792. + program.
  793. + .SH FILES
  794. + .br
  795. + /etc/d_passwd
  796. + .br
  797. + /etc/dialups
  798. + .SH SEE ALSO
  799. + login(1)
  800. Index: chage.c
  801. *** rel3/chage.c    Thu Sep 12 08:47:46 1991
  802. --- chage.c    Thu Sep 12 08:48:55 1991
  803. ***************
  804. *** 17,23 ****
  805.   #include <time.h>
  806.   
  807.   #ifndef    lint
  808. ! static    char    sccsid[] = "@(#)chage.c    3.8    09:01:54    6/26/91";
  809.   #endif
  810.   
  811.   /*
  812. --- 17,23 ----
  813.   #include <time.h>
  814.   
  815.   #ifndef    lint
  816. ! static    char    sccsid[] = "@(#)chage.c    3.9    10:14:30    8/15/91";
  817.   #endif
  818.   
  819.   /*
  820. ***************
  821. *** 677,682 ****
  822. --- 677,683 ----
  823.           }
  824.   #if defined(DBM) || defined(NDBM)
  825.           (void) pw_dbm_update (&pwent);
  826. +         endpwent ();
  827.   #endif
  828.       }
  829.   
  830. ***************
  831. *** 718,723 ****
  832. --- 719,725 ----
  833.   #endif
  834.           exit (1);
  835.       }
  836. +     endspent ();
  837.   #endif    /* NDBM */
  838.   
  839.       /*
  840. Index: chfn.c
  841. *** rel3/chfn.c    Thu Sep 12 08:48:05 1991
  842. --- chfn.c    Thu Sep 12 08:48:58 1991
  843. ***************
  844. *** 15,21 ****
  845.   #include <signal.h>
  846.   
  847.   #ifndef    lint
  848. ! static    char    sccsid[] = "@(#)chfn.c    3.6    08:51:33    7/10/91";
  849.   #endif
  850.   
  851.   /*
  852. --- 15,21 ----
  853.   #include <signal.h>
  854.   
  855.   #ifndef    lint
  856. ! static    char    sccsid[] = "@(#)chfn.c    3.7    10:14:35    8/15/91";
  857.   #endif
  858.   
  859.   /*
  860. ***************
  861. *** 534,539 ****
  862. --- 534,540 ----
  863.   #endif
  864.           exit (1);
  865.       }
  866. +     endpwent ();
  867.   #endif
  868.   
  869.       /*
  870. Index: chsh.c
  871. *** rel3/chsh.c    Thu Sep 12 08:46:46 1991
  872. --- chsh.c    Thu Sep 12 08:49:00 1991
  873. ***************
  874. *** 15,21 ****
  875.   #include <signal.h>
  876.   
  877.   #ifndef    lint
  878. ! static    char    sccsid[] = "@(#)chsh.c    3.4    09:07:12    5/28/91";
  879.   #endif
  880.   
  881.   /*
  882. --- 15,21 ----
  883.   #include <signal.h>
  884.   
  885.   #ifndef    lint
  886. ! static    char    sccsid[] = "@(#)chsh.c    3.6    20:58:54    8/15/91";
  887.   #endif
  888.   
  889.   /*
  890. ***************
  891. *** 57,62 ****
  892. --- 57,63 ----
  893.   
  894.   extern    struct    passwd    *getpwuid ();
  895.   extern    struct    passwd    *getpwnam ();
  896. + extern    void    change_field ();
  897.   extern    int    optind;
  898.   extern    char    *optarg;
  899.   extern    char    *getlogin ();
  900. ***************
  901. *** 439,444 ****
  902. --- 440,446 ----
  903.   #endif
  904.           exit (1);
  905.       }
  906. +     endpwent ();
  907.   #endif
  908.   
  909.       /*
  910. Index: gpmain.c
  911. *** rel3/gpmain.c    Thu Sep 12 08:47:56 1991
  912. --- gpmain.c    Thu Aug 15 21:04:40 1991
  913. ***************
  914. *** 43,49 ****
  915.   #endif
  916.   
  917.   #ifndef    lint
  918. ! static    char    _sccsid[] = "@(#)gpmain.c    3.8    09:11:39    7/17/91";
  919.   #endif
  920.   
  921.   char    name[BUFSIZ];
  922. --- 43,49 ----
  923.   #endif
  924.   
  925.   #ifndef    lint
  926. ! static    char    _sccsid[] = "@(#)gpmain.c    3.9    10:14:40    8/15/91";
  927.   #endif
  928.   
  929.   char    name[BUFSIZ];
  930. ***************
  931. *** 524,534 ****
  932. --- 524,536 ----
  933.           fprintf (stderr, "%s: can't update DBM files\n", Prog);
  934.           exit (1);
  935.       }
  936. +     endgrent ();
  937.   #ifdef    SHADOWGRP
  938.       if (access ("/etc/gshadow.pag", 0) == 0 && ! sgr_dbm_update (&sgent)) {
  939.           fprintf (stderr, "%s: can't update DBM shadow files\n", Prog);
  940.           exit (1);
  941.       }
  942. +     endsgent ();
  943.   #endif
  944.   #endif
  945.       exit (0);
  946. Index: groupadd.c
  947. *** rel3/groupadd.c    Thu Sep 12 08:47:33 1991
  948. --- groupadd.c    Thu Sep 12 08:49:03 1991
  949. ***************
  950. *** 10,16 ****
  951.    */
  952.   
  953.   #ifndef lint
  954. ! static    char    sccsid[] = "@(#)groupadd.c    3.1    22:59:04    6/13/91";
  955.   #endif
  956.   
  957.   #include <sys/types.h>
  958. --- 10,16 ----
  959.    */
  960.   
  961.   #ifndef lint
  962. ! static    char    sccsid[] = "@(#)groupadd.c    3.3    08:43:44    9/12/91";
  963.   #endif
  964.   
  965.   #include <sys/types.h>
  966. ***************
  967. *** 120,126 ****
  968.   void
  969.   grp_update ()
  970.   {
  971. -     int    i;
  972.       struct    group    grp;
  973.   #ifdef    SHADOWGRP
  974.       struct    sgrp    sgrp;
  975. --- 120,125 ----
  976. ***************
  977. *** 153,158 ****
  978. --- 152,158 ----
  979.           fprintf (stderr, "%s: cannot add new dbm group entry\n", Prog);
  980.           exit (1);
  981.       }
  982. +     endgrent ();
  983.   #endif    /* NDBM */
  984.   
  985.   #ifdef    SHADOWGRP
  986. ***************
  987. *** 175,180 ****
  988. --- 175,181 ----
  989.           fprintf (stderr, "%s: cannot add new dbm group entry\n", Prog);
  990.           exit (1);
  991.       }
  992. +     endsgent ();
  993.   #endif    /* NDBM */
  994.   #endif    /* SHADOWGRP */
  995.   #ifdef    USE_SYSLOG
  996. ***************
  997. *** 191,197 ****
  998.    *    uniqueness.
  999.    */
  1000.   
  1001. ! int
  1002.   find_new_gid ()
  1003.   {
  1004.       struct    group    *grp;
  1005. --- 192,198 ----
  1006.    *    uniqueness.
  1007.    */
  1008.   
  1009. ! void
  1010.   find_new_gid ()
  1011.   {
  1012.       struct    group    *grp;
  1013. ***************
  1014. *** 241,249 ****
  1015.   {
  1016.       extern    int    optind;
  1017.       extern    char    *optarg;
  1018. -     struct    group    *grp;
  1019.       char    *end;
  1020. -     int    anyflag = 0;
  1021.       int    arg;
  1022.   
  1023.       while ((arg = getopt (argc, argv, "og:")) != EOF) {
  1024. --- 242,248 ----
  1025. ***************
  1026. *** 269,276 ****
  1027.               default:
  1028.                   usage ();
  1029.           }
  1030. -         anyflag++;
  1031.       }
  1032.       if (optind == argc - 1)
  1033.           strcpy (group_name, argv[argc - 1]);
  1034.       else
  1035. --- 268,277 ----
  1036.               default:
  1037.                   usage ();
  1038.           }
  1039.       }
  1040. +     if (! gflg)
  1041. +         find_new_gid ();
  1042.       if (optind == argc - 1)
  1043.           strcpy (group_name, argv[argc - 1]);
  1044.       else
  1045. Index: groupdel.c
  1046. *** rel3/groupdel.c    Thu Sep 12 08:47:37 1991
  1047. --- groupdel.c    Thu Sep 12 08:49:04 1991
  1048. ***************
  1049. *** 10,16 ****
  1050.    */
  1051.   
  1052.   #ifndef lint
  1053. ! static    char    sccsid[] = "@(#)groupdel.c    3.1    22:59:09    6/13/91";
  1054.   #endif
  1055.   
  1056.   #include <sys/types.h>
  1057. --- 10,16 ----
  1058.    */
  1059.   
  1060.   #ifndef lint
  1061. ! static    char    sccsid[] = "@(#)groupdel.c    3.3    08:43:48    9/12/91";
  1062.   #endif
  1063.   
  1064.   #include <sys/types.h>
  1065. ***************
  1066. *** 42,56 ****
  1067.   extern    char    *malloc();
  1068.   
  1069.   extern    struct    group    *getgrnam();
  1070. - extern    struct    group    *gr_next();
  1071. - extern    struct    group    *gr_locate();
  1072.   extern    int    gr_lock();
  1073.   extern    int    gr_unlock();
  1074. - extern    int    gr_rewind();
  1075.   extern    int    gr_open();
  1076.   
  1077.   #ifdef    SHADOWGRP
  1078. - extern    struct    sgrp    *sgr_locate();
  1079.   extern    int    sgr_lock();
  1080.   extern    int    sgr_unlock();
  1081.   extern    int    sgr_open();
  1082. --- 42,52 ----
  1083. ***************
  1084. *** 75,81 ****
  1085.   void
  1086.   grp_update ()
  1087.   {
  1088. -     int    i;
  1089.       struct    group    *ogrp;
  1090.   
  1091.       if (! gr_remove (group_name)) {
  1092. --- 71,76 ----
  1093. ***************
  1094. *** 96,101 ****
  1095. --- 91,97 ----
  1096.               exit (1);
  1097.           }
  1098.       }
  1099. +     endgrent ();
  1100.   #endif    /* NDBM */
  1101.   
  1102.   #ifdef    SHADOWGRP
  1103. ***************
  1104. *** 123,128 ****
  1105. --- 119,125 ----
  1106.               exit (1);
  1107.           }
  1108.       }
  1109. +     endsgent ();
  1110.   #endif    /* NDBM */
  1111.   #endif    /* SHADOWGRP */
  1112.   #ifdef    USE_SYSLOG
  1113. Index: groupmod.c
  1114. *** rel3/groupmod.c    Thu Sep 12 08:47:39 1991
  1115. --- groupmod.c    Thu Sep 12 08:49:06 1991
  1116. ***************
  1117. *** 10,16 ****
  1118.    */
  1119.   
  1120.   #ifndef lint
  1121. ! static    char    sccsid[] = "@(#)groupmod.c    3.1    22:59:07    6/13/91";
  1122.   #endif
  1123.   
  1124.   #include <sys/types.h>
  1125. --- 10,16 ----
  1126.    */
  1127.   
  1128.   #ifndef lint
  1129. ! static    char    sccsid[] = "@(#)groupmod.c    3.3    08:43:51    9/12/91";
  1130.   #endif
  1131.   
  1132.   #include <sys/types.h>
  1133. ***************
  1134. *** 118,124 ****
  1135.   void
  1136.   grp_update ()
  1137.   {
  1138. -     int    i;
  1139.       struct    group    grp;
  1140.       struct    group    *ogrp;
  1141.   #ifdef    SHADOWGRP
  1142. --- 118,123 ----
  1143. ***************
  1144. *** 166,171 ****
  1145. --- 165,171 ----
  1146.                   Prog);
  1147.               exit (1);
  1148.           }
  1149. +         endgrent ();
  1150.       }
  1151.   #endif    /* NDBM */
  1152.   
  1153. ***************
  1154. *** 202,207 ****
  1155. --- 202,208 ----
  1156.                   Prog);
  1157.               exit (1);
  1158.           }
  1159. +         endsgent ();
  1160.       }
  1161.   #endif    /* NDBM */
  1162.   #endif    /* SHADOWGRP */
  1163. ***************
  1164. *** 259,267 ****
  1165.   {
  1166.       extern    int    optind;
  1167.       extern    char    *optarg;
  1168. -     struct    group    *grp;
  1169.       char    *end;
  1170. -     int    anyflag = 0;
  1171.       int    arg;
  1172.   
  1173.       while ((arg = getopt (argc, argv, "og:n:")) != EOF) {
  1174. --- 260,266 ----
  1175. ***************
  1176. *** 290,296 ****
  1177.               default:
  1178.                   usage ();
  1179.           }
  1180. -         anyflag++;
  1181.       }
  1182.       if (optind == argc - 1)
  1183.           strcpy (group_name, argv[argc - 1]);
  1184. --- 289,294 ----
  1185. Index: passwd.c
  1186. *** rel3/passwd.c    Thu Sep 12 08:48:03 1991
  1187. --- passwd.c    Thu Sep 12 08:49:08 1991
  1188. ***************
  1189. *** 16,22 ****
  1190.   #include <signal.h>
  1191.   
  1192.   #ifndef    lint
  1193. ! static    char    sccsid[] = "@(#)passwd.c    3.4    09:04:52    7/10/91";
  1194.   #endif
  1195.   
  1196.   /*
  1197. --- 16,22 ----
  1198.   #include <signal.h>
  1199.   
  1200.   #ifndef    lint
  1201. ! static    char    sccsid[] = "@(#)passwd.c    3.6    08:43:55    9/12/91";
  1202.   #endif
  1203.   
  1204.   /*
  1205. ***************
  1206. *** 153,158 ****
  1207. --- 153,159 ----
  1208.    * new_password - validate old password and replace with new
  1209.    */
  1210.   
  1211. + /*ARGSUSED*/
  1212.   int
  1213.   new_password (pw, sp)
  1214.   struct    passwd    *pw;
  1215. ***************
  1216. *** 246,251 ****
  1217. --- 247,253 ----
  1218.    *    password for the given user.
  1219.    */
  1220.   
  1221. + /*ARGSUSED*/
  1222.   void
  1223.   check_password (pw, sp)
  1224.   struct    passwd    *pw;
  1225. ***************
  1226. *** 370,384 ****
  1227.    * print_status - print current password status
  1228.    */
  1229.   
  1230.   void
  1231. ! print_status (sp)
  1232.   struct    spwd    *sp;
  1233.   {
  1234.       struct    tm    *tm;
  1235. !     time_t    time;
  1236.   
  1237. !     time = sp->sp_lstchg * SCALE;
  1238. !     tm = gmtime (&time);
  1239.   
  1240.       printf ("%s ", sp->sp_namp);
  1241.       printf ("%s ",
  1242. --- 372,388 ----
  1243.    * print_status - print current password status
  1244.    */
  1245.   
  1246. + /*ARGSUSED*/
  1247.   void
  1248. ! print_status (pw, sp)
  1249. ! struct    passwd    *pw;
  1250.   struct    spwd    *sp;
  1251.   {
  1252.       struct    tm    *tm;
  1253. !     time_t    last_time;
  1254.   
  1255. !     last_time = sp->sp_lstchg * SCALE;
  1256. !     tm = gmtime (&last_time);
  1257.   
  1258.       printf ("%s ", sp->sp_namp);
  1259.       printf ("%s ",
  1260. ***************
  1261. *** 640,646 ****
  1262.       tspwd.sp_pwdp = strdup (sp->sp_pwdp);
  1263.   
  1264.       if (Sflg) {
  1265. !         print_status (sp);
  1266.   #ifdef    USE_SYSLOG
  1267.           closelog ();
  1268.   #endif
  1269. --- 644,650 ----
  1270.       tspwd.sp_pwdp = strdup (sp->sp_pwdp);
  1271.   
  1272.       if (Sflg) {
  1273. !         print_status (pw, sp);
  1274.   #ifdef    USE_SYSLOG
  1275.           closelog ();
  1276.   #endif
  1277. ***************
  1278. *** 766,771 ****
  1279. --- 770,776 ----
  1280.           (void) spw_unlock ();
  1281.           exit (1);
  1282.       }
  1283. +     endspent ();
  1284.   #endif
  1285.   
  1286.       /*
  1287. ***************
  1288. *** 795,798 ****
  1289. --- 800,804 ----
  1290.       closelog ();
  1291.   #endif
  1292.       exit (0);
  1293. +     /*NOTREACHED*/
  1294.   }
  1295. Index: useradd.c
  1296. *** rel3/useradd.c    Thu Sep 12 08:47:40 1991
  1297. --- useradd.c    Thu Sep 12 08:49:12 1991
  1298. ***************
  1299. *** 10,16 ****
  1300.    */
  1301.   
  1302.   #ifndef lint
  1303. ! static    char    sccsid[] = "@(#)useradd.c    3.4    09:39:58    6/26/91";
  1304.   #endif
  1305.   
  1306.   #include <sys/types.h>
  1307. --- 10,16 ----
  1308.    */
  1309.   
  1310.   #ifndef lint
  1311. ! static    char    sccsid[] = "@(#)useradd.c    3.5    10:14:59    8/15/91";
  1312.   #endif
  1313.   
  1314.   #include <sys/types.h>
  1315. ***************
  1316. *** 775,780 ****
  1317. --- 775,781 ----
  1318.                   Prog);
  1319.               exit (1);
  1320.           }
  1321. +         endgrent ();
  1322.   #endif
  1323.   #ifdef    USE_SYSLOG
  1324.           syslog (LOG_INFO, "add `%s' to group `%s'\n",
  1325. ***************
  1326. *** 827,832 ****
  1327. --- 828,834 ----
  1328.                   Prog);
  1329.               exit (1);
  1330.           }
  1331. +         endsgent ();
  1332.   #endif
  1333.   #ifdef    USE_SYSLOG
  1334.           syslog (LOG_INFO, "add `%s' to shadow group `%s'\n",
  1335. ***************
  1336. *** 1128,1133 ****
  1337. --- 1130,1136 ----
  1338.               Prog);
  1339.           exit (1);
  1340.       }
  1341. +     endpwent ();
  1342.   #endif
  1343.   #ifdef    NDBM
  1344.       if (access ("/etc/shadow.pag", 0) == 0 && ! sp_dbm_update (&spent)) {
  1345. ***************
  1346. *** 1135,1140 ****
  1347. --- 1138,1144 ----
  1348.               Prog);
  1349.           exit (1);
  1350.       }
  1351. +     endspent ();
  1352.   #endif
  1353.   #ifdef    USE_SYSLOG
  1354.       syslog (LOG_INFO,
  1355. Index: userdel.c
  1356. *** rel3/userdel.c    Thu Sep 12 08:47:41 1991
  1357. --- userdel.c    Thu Sep 12 08:49:17 1991
  1358. ***************
  1359. *** 10,16 ****
  1360.    */
  1361.   
  1362.   #ifndef lint
  1363. ! static    char    sccsid[] = "@(#)userdel.c    3.7    09:40:05    6/26/91";
  1364.   #endif
  1365.   
  1366.   #include <sys/types.h>
  1367. --- 10,16 ----
  1368.    */
  1369.   
  1370.   #ifndef lint
  1371. ! static    char    sccsid[] = "@(#)userdel.c    3.8    10:15:05    8/15/91";
  1372.   #endif
  1373.   
  1374.   #include <sys/types.h>
  1375. ***************
  1376. *** 205,210 ****
  1377. --- 205,211 ----
  1378.                   Prog);
  1379.               exit (1);
  1380.           }
  1381. +         endgrent ();
  1382.   #endif    /* NDBM */
  1383.   #ifdef    USE_SYSLOG
  1384.           syslog (LOG_INFO, "delete `%s' from group `%s'\n",
  1385. ***************
  1386. *** 261,266 ****
  1387. --- 262,268 ----
  1388.                   Prog);
  1389.               exit (1);
  1390.           }
  1391. +         endsgent ();
  1392.   #endif
  1393.   #ifdef    USE_SYSLOG
  1394.           syslog (LOG_INFO, "delete `%s' from shadow group `%s'\n",
  1395. ***************
  1396. *** 374,379 ****
  1397. --- 376,383 ----
  1398.               fprintf (stderr,
  1399.                   "%s: error deleting password dbm entry\n",
  1400.                   Prog);
  1401. +         endpwent ();
  1402.       }
  1403.   
  1404.       /*
  1405. ***************
  1406. *** 385,390 ****
  1407. --- 389,395 ----
  1408.       for (pw_rewind (), pwd = pw_next ();pwd;pwd = pw_next ()) {
  1409.           if (pwd->pw_uid == user_id) {
  1410.               pw_dbm_update (pwd);
  1411. +             endpwent ();
  1412.               break;
  1413.           }
  1414.       }
  1415. ***************
  1416. *** 393,398 ****
  1417. --- 398,405 ----
  1418.       if (access ("/etc/shadow.pag", 0) == 0 && ! sp_dbm_remove (user_name))
  1419.           fprintf (stderr, "%s: error deleting shadow passwd dbm entry\n",
  1420.               Prog);
  1421. +     endspent ();
  1422.   #endif
  1423.   #ifdef    USE_SYSLOG
  1424.       syslog (LOG_INFO, "delete user `%s'\n", user_name);
  1425. Index: usermod.c
  1426. *** rel3/usermod.c    Thu Sep 12 08:47:42 1991
  1427. --- usermod.c    Thu Sep 12 08:49:19 1991
  1428. ***************
  1429. *** 10,16 ****
  1430.    */
  1431.   
  1432.   #ifndef lint
  1433. ! static    char    sccsid[] = "@(#)usermod.c    3.3    09:29:57    6/26/91";
  1434.   #endif
  1435.   
  1436.   #include <sys/types.h>
  1437. --- 10,16 ----
  1438.    */
  1439.   
  1440.   #ifndef lint
  1441. ! static    char    sccsid[] = "@(#)usermod.c    3.4    10:15:08    8/15/91";
  1442.   #endif
  1443.   
  1444.   #include <sys/types.h>
  1445. ***************
  1446. *** 621,626 ****
  1447. --- 621,627 ----
  1448.                   Prog);
  1449.               exit (1);
  1450.           }
  1451. +         endgrent ();
  1452.   #endif
  1453.       }
  1454.   
  1455. ***************
  1456. *** 723,728 ****
  1457. --- 724,730 ----
  1458.                   Prog);
  1459.               exit (1);
  1460.           }
  1461. +         endsgent ();
  1462.   #endif
  1463.       }
  1464.   #endif
  1465. ***************
  1466. *** 1036,1041 ****
  1467. --- 1038,1044 ----
  1468.                       Prog);
  1469.                   exit (1);
  1470.               }
  1471. +             endpwent ();
  1472.           }
  1473.   #endif
  1474.       }
  1475. ***************
  1476. *** 1063,1068 ****
  1477. --- 1066,1072 ----
  1478.                   Prog);
  1479.               exit (1);
  1480.           }
  1481. +         endspent ();
  1482.       }
  1483.   #endif
  1484.       if (Gflg || lflg)
  1485. Index: grdbm.c
  1486. *** rel3/grdbm.c    Thu Sep 12 08:47:31 1991
  1487. --- grdbm.c    Thu Sep 12 08:49:21 1991
  1488. ***************
  1489. *** 1,5 ****
  1490.   /*
  1491. !  * Copyright 1990, John F. Haugh II
  1492.    * All rights reserved.
  1493.    *
  1494.    * Use, duplication, and disclosure prohibited without
  1495. --- 1,5 ----
  1496.   /*
  1497. !  * Copyright 1990, 1991, John F. Haugh II
  1498.    * All rights reserved.
  1499.    *
  1500.    * Use, duplication, and disclosure prohibited without
  1501. ***************
  1502. *** 7,13 ****
  1503.    */
  1504.   
  1505.   #ifndef    lint
  1506. ! static    char    sccsid[] = "@(#)grdbm.c    3.2    22:53:58    6/13/91";
  1507.   #endif
  1508.   
  1509.   #include <string.h>
  1510. --- 7,13 ----
  1511.    */
  1512.   
  1513.   #ifndef    lint
  1514. ! static    char    sccsid[] = "@(#)grdbm.c    3.3    08:44:03    9/12/91";
  1515.   #endif
  1516.   
  1517.   #include <string.h>
  1518. ***************
  1519. *** 89,95 ****
  1520.   
  1521.               key.dsize = sizeof i + strlen (gr->gr_name);
  1522.               key.dptr = grpkey;
  1523. !             memcpy (grpkey, &i, sizeof i);
  1524.               strcpy (grpkey + sizeof i, gr->gr_name);
  1525.               if (dbm_store (gr_dbm, key, content, DBM_REPLACE))
  1526.                   return 0;
  1527. --- 89,95 ----
  1528.   
  1529.               key.dsize = sizeof i + strlen (gr->gr_name);
  1530.               key.dptr = grpkey;
  1531. !             memcpy (grpkey, (char *) &i, sizeof i);
  1532.               strcpy (grpkey + sizeof i, gr->gr_name);
  1533.               if (dbm_store (gr_dbm, key, content, DBM_REPLACE))
  1534.                   return 0;
  1535. ***************
  1536. *** 96,103 ****
  1537.   
  1538.               key.dsize = sizeof i + sizeof gr->gr_gid;
  1539.               key.dptr = grpkey;
  1540. !             memcpy (grpkey, &i, sizeof i);
  1541. !             memcpy (grpkey + sizeof i, &gr->gr_gid,
  1542.                   sizeof gr->gr_gid);
  1543.               if (dbm_store (gr_dbm, key, content, DBM_REPLACE))
  1544.                   return 0;
  1545. --- 96,103 ----
  1546.   
  1547.               key.dsize = sizeof i + sizeof gr->gr_gid;
  1548.               key.dptr = grpkey;
  1549. !             memcpy (grpkey, (char *) &i, sizeof i);
  1550. !             memcpy (grpkey + sizeof i, (char *) &gr->gr_gid,
  1551.                   sizeof gr->gr_gid);
  1552.               if (dbm_store (gr_dbm, key, content, DBM_REPLACE))
  1553.                   return 0;
  1554. ***************
  1555. *** 118,127 ****
  1556.   {
  1557.       datum    key;
  1558.       datum    content;
  1559. -     char    data[BUFSIZ*8];
  1560.       char    grpkey[60];
  1561. -     char    *cp;
  1562. -     int    len;
  1563.       int    i;
  1564.       int    cnt;
  1565.       int    errors = 0;
  1566. --- 118,124 ----
  1567. ***************
  1568. *** 137,154 ****
  1569.           return 0;
  1570.   
  1571.       key.dsize = strlen (gr->gr_name);
  1572. !     key.dptr = gr->gr_name;
  1573.       content = dbm_fetch (gr_dbm, key);
  1574.       if (content.dptr == 0)
  1575.           ++errors;
  1576.       else {
  1577.           if (content.dsize == sizeof (int)) {
  1578. !             memcpy (&cnt, content.dptr, sizeof cnt);
  1579.   
  1580.               for (i = 0;i < cnt;i++) {
  1581.                   key.dsize = sizeof i + strlen (gr->gr_name);
  1582.                   key.dptr = grpkey;
  1583. !                 memcpy (grpkey, &i, sizeof i);
  1584.                   strcpy (grpkey + sizeof i, gr->gr_name);
  1585.                   if (dbm_delete (gr_dbm, key))
  1586.                       ++errors;
  1587. --- 134,151 ----
  1588.           return 0;
  1589.   
  1590.       key.dsize = strlen (gr->gr_name);
  1591. !     key.dptr = (char *) gr->gr_name;
  1592.       content = dbm_fetch (gr_dbm, key);
  1593.       if (content.dptr == 0)
  1594.           ++errors;
  1595.       else {
  1596.           if (content.dsize == sizeof (int)) {
  1597. !             memcpy ((char *) &cnt, content.dptr, sizeof cnt);
  1598.   
  1599.               for (i = 0;i < cnt;i++) {
  1600.                   key.dsize = sizeof i + strlen (gr->gr_name);
  1601.                   key.dptr = grpkey;
  1602. !                 memcpy (grpkey, (char *) &i, sizeof i);
  1603.                   strcpy (grpkey + sizeof i, gr->gr_name);
  1604.                   if (dbm_delete (gr_dbm, key))
  1605.                       ++errors;
  1606. ***************
  1607. *** 159,178 ****
  1608.           }
  1609.       }
  1610.       key.dsize = sizeof gr->gr_gid;
  1611. !     key.dptr = &gr->gr_gid;
  1612.       content = dbm_fetch (gr_dbm, key);
  1613.       if (content.dptr == 0)
  1614.           ++errors;
  1615.       else {
  1616.           if (content.dsize == sizeof (int)) {
  1617. !             memcpy (&cnt, content.dptr, sizeof cnt);
  1618.   
  1619.               for (i = 0;i < cnt;i++) {
  1620.                   key.dsize = sizeof i + sizeof gr->gr_gid;
  1621.                   key.dptr = grpkey;
  1622. !                 memcpy (grpkey, &i, sizeof i);
  1623. !                 memcpy (grpkey + sizeof i,
  1624. !                     &gr->gr_gid, sizeof gr->gr_gid);
  1625.   
  1626.                   if (dbm_delete (gr_dbm, key))
  1627.                       ++errors;
  1628. --- 156,175 ----
  1629.           }
  1630.       }
  1631.       key.dsize = sizeof gr->gr_gid;
  1632. !     key.dptr = (char *) &gr->gr_gid;
  1633.       content = dbm_fetch (gr_dbm, key);
  1634.       if (content.dptr == 0)
  1635.           ++errors;
  1636.       else {
  1637.           if (content.dsize == sizeof (int)) {
  1638. !             memcpy ((char *) &cnt, content.dptr, sizeof cnt);
  1639.   
  1640.               for (i = 0;i < cnt;i++) {
  1641.                   key.dsize = sizeof i + sizeof gr->gr_gid;
  1642.                   key.dptr = grpkey;
  1643. !                 memcpy (grpkey, (char *) &i, sizeof i);
  1644. !                 memcpy (grpkey + sizeof i, (char *) &gr->gr_gid,
  1645. !                     sizeof gr->gr_gid);
  1646.   
  1647.                   if (dbm_delete (gr_dbm, key))
  1648.                       ++errors;
  1649. Index: faillog.c
  1650. *** rel3/faillog.c    Thu Sep 12 08:45:09 1991
  1651. --- faillog.c    Thu Sep 12 08:49:23 1991
  1652. ***************
  1653. *** 26,32 ****
  1654.   #include "faillog.h"
  1655.   
  1656.   #ifndef    lint
  1657. ! static    char    _sccsid[] = "@(#)faillog.c    3.1    12:30:41    12/12/90";
  1658.   #endif
  1659.   
  1660.   FILE    *fail;        /* failure file stream */
  1661. --- 26,32 ----
  1662.   #include "faillog.h"
  1663.   
  1664.   #ifndef    lint
  1665. ! static    char    _sccsid[] = "@(#)faillog.c    3.2    08:44:11    9/12/91";
  1666.   #endif
  1667.   
  1668.   FILE    *fail;        /* failure file stream */
  1669. ***************
  1670. *** 35,42 ****
  1671.   time_t    seconds;    /* that number of days in seconds */
  1672.   int    max;        /* maximum failure count for fail_max */
  1673.   
  1674. - int    mflg;        /* set fail_max for a given user */
  1675. - int    rflg;        /* reset fail_cnt for user or all user's */
  1676.   int    uflg;        /* set if user is a valid user id */
  1677.   int    tflg;        /* print is restricted to most recent days */
  1678.   struct    faillog    faillog; /* scratch structure to play with ... */
  1679. --- 35,40 ----
  1680. ***************
  1681. *** 58,64 ****
  1682.   char    **argv;
  1683.   {
  1684.       char    *mode;
  1685. -     int    uid = 0;
  1686.       int    c;
  1687.       struct    passwd    *pwent;
  1688.   
  1689. --- 56,61 ----
  1690. ***************
  1691. *** 101,106 ****
  1692. --- 98,104 ----
  1693.       }
  1694.       fclose (fail);
  1695.       exit (0);
  1696. +     /*NOTREACHED*/
  1697.   }
  1698.   
  1699.   print ()
  1700. ***************
  1701. *** 135,142 ****
  1702.       }
  1703.   }
  1704.   
  1705. ! print_one (faillog, uid)
  1706. ! struct    faillog    *faillog;
  1707.   {
  1708.       static    int    once;
  1709.       char    *cp;
  1710. --- 133,140 ----
  1711.       }
  1712.   }
  1713.   
  1714. ! print_one (uid)
  1715. ! int    uid;
  1716.   {
  1717.       static    int    once;
  1718.       char    *cp;
  1719. ***************
  1720. *** 148,162 ****
  1721.           once++;
  1722.       }
  1723.       pwent = getpwuid (uid);
  1724. !     tm = localtime (&faillog->fail_time);
  1725.       cp = asctime (tm);
  1726.       cp[24] = '\0';
  1727.   
  1728.       if (pwent) {
  1729.           printf ("%-16s    %4d       %4d",
  1730. !             pwent->pw_name, faillog->fail_cnt, faillog->fail_max);
  1731. !         if (faillog->fail_time)
  1732. !             printf ("     %s on %s\n", cp, faillog->fail_line);
  1733.           else
  1734.               putchar ('\n');
  1735.       }
  1736. --- 146,160 ----
  1737.           once++;
  1738.       }
  1739.       pwent = getpwuid (uid);
  1740. !     tm = localtime (&faillog.fail_time);
  1741.       cp = asctime (tm);
  1742.       cp[24] = '\0';
  1743.   
  1744.       if (pwent) {
  1745.           printf ("%-16s    %4d       %4d",
  1746. !             pwent->pw_name, faillog.fail_cnt, faillog.fail_max);
  1747. !         if (faillog.fail_time)
  1748. !             printf ("     %s on %s\n", cp, faillog.fail_line);
  1749.           else
  1750.               putchar ('\n');
  1751.       }
  1752. ***************
  1753. *** 210,216 ****
  1754.   
  1755.   setmax ()
  1756.   {
  1757. -     int    uid = 0;
  1758.       struct    passwd    *pwent;
  1759.   
  1760.       if (uflg) {
  1761. --- 208,213 ----
  1762. Index: valid.c
  1763. *** rel3/valid.c    Thu Sep 12 08:45:28 1991
  1764. --- valid.c    Thu Sep 12 08:49:24 1991
  1765. ***************
  1766. *** 22,28 ****
  1767.   #include "config.h"
  1768.   
  1769.   #ifndef    lint
  1770. ! static    char    _sccsid[] = "@(#)valid.c    3.3    08:00:20    2/6/91";
  1771.   #endif
  1772.   
  1773.   /*
  1774. --- 22,28 ----
  1775.   #include "config.h"
  1776.   
  1777.   #ifndef    lint
  1778. ! static    char    _sccsid[] = "@(#)valid.c    3.4    08:44:15    9/12/91";
  1779.   #endif
  1780.   
  1781.   /*
  1782. ***************
  1783. *** 43,49 ****
  1784.       char    *encrypt;
  1785.       char    *salt;
  1786.       char    *pw_encrypt ();
  1787. -     char    *shell;
  1788.   
  1789.       /*
  1790.        * Start with blank or empty password entries.  Always encrypt
  1791. --- 43,48 ----
  1792. Index: age.c
  1793. *** rel3/age.c    Thu Sep 12 08:44:44 1991
  1794. --- age.c    Thu Sep 12 08:49:26 1991
  1795. ***************
  1796. *** 17,23 ****
  1797.   #include "shadow.h"
  1798.   
  1799.   #ifndef    lint
  1800. ! static    char    sccsid[] = "@(#)age.c    3.3    07:52:49    1/30/91";
  1801.   #endif
  1802.   
  1803.   #define    DAY    (24L*3600L)
  1804. --- 17,23 ----
  1805.   #include "shadow.h"
  1806.   
  1807.   #ifndef    lint
  1808. ! static    char    sccsid[] = "@(#)age.c    3.4    08:44:18    9/12/91";
  1809.   #endif
  1810.   
  1811.   #define    DAY    (24L*3600L)
  1812. ***************
  1813. *** 105,110 ****
  1814. --- 105,112 ----
  1815.       sp->sp_inact = -1;
  1816.       sp->sp_expire = -1;
  1817.       sp->sp_flag = -1;
  1818. +     return sp;
  1819.   }
  1820.   
  1821.   /*
  1822. ***************
  1823. *** 114,119 ****
  1824. --- 116,122 ----
  1825.    *    password expiration criteria.
  1826.    */
  1827.   
  1828. + /*ARGSUSED*/
  1829.   int
  1830.   isexpired (pw, sp)
  1831.   struct    passwd    *pw;
  1832. ***************
  1833. *** 243,248 ****
  1834. --- 246,252 ----
  1835.           return 1;
  1836.   
  1837.       exit (1);
  1838. +     /*NOTREACHED*/
  1839.   }
  1840.   
  1841.   /*
  1842. Index: failure.c
  1843. *** rel3/failure.c    Thu Sep 12 08:45:12 1991
  1844. --- failure.c    Thu Sep 12 08:49:27 1991
  1845. ***************
  1846. *** 1,9 ****
  1847.   /*
  1848. !  * Copyright 1989, 1990, John F. Haugh II
  1849.    * All rights reserved.
  1850.    *
  1851. !  * Use, duplication, and disclosure prohibited without
  1852. !  * the express written permission of the author.
  1853.    */
  1854.   
  1855.   #include <sys/types.h>
  1856. --- 1,12 ----
  1857.   /*
  1858. !  * Copyright 1989, 1990, 1991, John F. Haugh II
  1859.    * All rights reserved.
  1860.    *
  1861. !  * Permission is granted to copy and create derivative works for any
  1862. !  * non-commercial purpose, provided this copyright notice is preserved
  1863. !  * in all copies of source code, or included in human readable form
  1864. !  * and conspicuously displayed on all copies of object code or
  1865. !  * distribution media.
  1866.    */
  1867.   
  1868.   #include <sys/types.h>
  1869. ***************
  1870. *** 25,31 ****
  1871.   #endif
  1872.   
  1873.   #ifndef    lint
  1874. ! static    char    _sccsid[] = "@(#)failure.c    2.3    19:23:48    7/29/90";
  1875.   #endif
  1876.   
  1877.   #ifdef    FAILLOG
  1878. --- 28,34 ----
  1879.   #endif
  1880.   
  1881.   #ifndef    lint
  1882. ! static    char    _sccsid[] = "@(#)failure.c    2.4    08:44:22    9/12/91";
  1883.   #endif
  1884.   
  1885.   #ifdef    FAILLOG
  1886. ***************
  1887. *** 114,123 ****
  1888.    */
  1889.   
  1890.   void
  1891. ! failprint (uid, fail)
  1892.   struct    faillog    *fail;
  1893.   {
  1894. -     int    fd;
  1895.       struct    tm    *tp;
  1896.       char    *lasttime;
  1897.   
  1898. --- 117,125 ----
  1899.    */
  1900.   
  1901.   void
  1902. ! failprint (fail)
  1903.   struct    faillog    *fail;
  1904.   {
  1905.       struct    tm    *tp;
  1906.       char    *lasttime;
  1907.   
  1908. Index: mkpasswd.c
  1909. *** rel3/mkpasswd.c    Thu Sep 12 08:48:04 1991
  1910. --- mkpasswd.c    Thu Sep 12 08:49:29 1991
  1911. ***************
  1912. *** 10,16 ****
  1913.    */
  1914.   
  1915.   #ifndef    lint
  1916. ! static    char    sccsid[] = "@(#)mkpasswd.c    3.6    09:07:08    7/2/91";
  1917.   static    char    copyright[] = "Copyright 1990, 1991, John F. Haugh II";
  1918.   #endif
  1919.   
  1920. --- 10,16 ----
  1921.    */
  1922.   
  1923.   #ifndef    lint
  1924. ! static    char    sccsid[] = "@(#)mkpasswd.c    3.8    08:44:25    9/12/91";
  1925.   static    char    copyright[] = "Copyright 1990, 1991, John F. Haugh II";
  1926.   #endif
  1927.   
  1928. ***************
  1929. *** 17,23 ****
  1930.   #include "config.h"
  1931.   #include <stdio.h>
  1932.   
  1933. ! #if defined(DBM) || defined(NDBM) /*{*/
  1934.   
  1935.   main (argc, argv)
  1936.   int    argc;
  1937. --- 17,23 ----
  1938.   #include "config.h"
  1939.   #include <stdio.h>
  1940.   
  1941. ! #if !defined(DBM) && !defined(NDBM) /*{*/
  1942.   
  1943.   main (argc, argv)
  1944.   int    argc;
  1945. ***************
  1946. *** 52,62 ****
  1947. --- 52,65 ----
  1948.   DBM    *gr_dbm;
  1949.   DBM    *sp_dbm;
  1950.   DBM    *sgr_dbm;
  1951. + char    *fgetsx();
  1952.   #endif
  1953.   
  1954.   char    *CANT_OPEN =    "%s: cannot open file %s\n";
  1955.   char    *CANT_OVERWRITE = "%s: cannot overwrite file %s\n";
  1956. + #ifdef    DBM
  1957.   char    *CANT_CREATE =    "%s: cannot create %s\n";
  1958. + #endif
  1959.   char    *DBM_OPEN_ERR =    "%s: cannot open DBM files for %s\n";
  1960.   char    *PARSE_ERR =    "%s: error parsing line\n\"%s\"\n";
  1961.   char    *LINE_TOO_LONG = "%s: the beginning with \"%.16s ...\" is too long\n";
  1962. ***************
  1963. *** 82,91 ****
  1964. --- 85,98 ----
  1965.   
  1966.   extern    char    *malloc();
  1967.   extern    struct    passwd    *sgetpwent();
  1968. + extern    int    pw_dbm_update();
  1969.   #ifdef    NDBM
  1970.   extern    struct    group    *sgetgrent();
  1971.   extern    struct    spwd    *sgetspent();
  1972.   extern    struct    sgrp    *sgetsgent();
  1973. + extern    int    sp_dbm_update();
  1974. + extern    int    gr_dbm_update();
  1975. + extern    int    sgr_dbm_update();
  1976.   #endif
  1977.   
  1978.   /*
  1979. ***************
  1980. *** 112,118 ****
  1981. --- 119,127 ----
  1982.       char    *pag;            /* Name of .pag file                  */
  1983.       char    *cp;            /* Temporary character pointer        */
  1984.       int    flag;            /* Flag for command line option       */
  1985. + #ifdef    DBM
  1986.       int    fd;            /* File descriptor of open DBM file   */
  1987. + #endif
  1988.       int    cnt = 0;        /* Number of entries in database      */
  1989.       int    longest = 0;        /* Longest entry in database          */
  1990.       int    len;            /* Length of input line               */
  1991. ***************
  1992. *** 124,129 ****
  1993. --- 133,139 ----
  1994.       struct    spwd    *shadow;    /* Pointer to shadow passwd entry     */
  1995.       struct    sgrp    *gshadow;    /* Pointer to shadow group entry      */
  1996.       DBM    *dbm;            /* Pointer to new NDBM files          */
  1997. +     DBM    *dbm_open();        /* Function to open NDBM files        */
  1998.   #endif
  1999.   
  2000.       /*
  2001. Index: shadow.c
  2002. *** rel3/shadow.c    Thu Sep 12 08:45:14 1991
  2003. --- shadow.c    Thu Sep 12 08:49:31 1991
  2004. ***************
  2005. *** 33,39 ****
  2006.   
  2007.   
  2008.   #ifndef    lint
  2009. ! static    char    sccsid[] = "@(#)shadow.c    3.8    07:57:47    2/8/91";
  2010.   #endif
  2011.   
  2012.   static    FILE    *shadow;
  2013. --- 33,39 ----
  2014.   
  2015.   
  2016.   #ifndef    lint
  2017. ! static    char    sccsid[] = "@(#)shadow.c    3.9    08:44:32    9/12/91";
  2018.   #endif
  2019.   
  2020.   static    FILE    *shadow;
  2021. ***************
  2022. *** 46,53 ****
  2023.   void
  2024.   setspent ()
  2025.   {
  2026. -     int    mode;
  2027.       if (shadow)
  2028.           rewind (shadow);
  2029.       else
  2030. --- 46,51 ----
  2031. Index: smain.c
  2032. *** rel3/smain.c    Thu Sep 12 08:48:15 1991
  2033. --- smain.c    Thu Sep 12 08:49:33 1991
  2034. ***************
  2035. *** 13,19 ****
  2036.   #include <stdio.h>
  2037.   
  2038.   #ifndef    lint
  2039. ! static    char    sccsid[] = "@(#)smain.c    3.6    08:27:44    7/15/91";
  2040.   #endif
  2041.   
  2042.   /*
  2043. --- 13,19 ----
  2044.   #include <stdio.h>
  2045.   
  2046.   #ifndef    lint
  2047. ! static    char    sccsid[] = "@(#)smain.c    3.7    08:44:39    9/12/91";
  2048.   #endif
  2049.   
  2050.   /*
  2051. ***************
  2052. *** 181,187 ****
  2053.   char    **argv;
  2054.   char    **envp;
  2055.   {
  2056. !     void    (*oldsig)();
  2057.       char    *cp;
  2058.       char    *tty = 0;        /* Name of tty SU is run from        */
  2059.       int    doshell = 0;
  2060. --- 181,187 ----
  2061.   char    **argv;
  2062.   char    **envp;
  2063.   {
  2064. !     int    (*oldsig)();
  2065.       char    *cp;
  2066.       char    *tty = 0;        /* Name of tty SU is run from        */
  2067.       int    doshell = 0;
  2068. Index: sulogin.c
  2069. *** rel3/sulogin.c    Thu Sep 12 08:48:16 1991
  2070. --- sulogin.c    Thu Sep 12 08:49:35 1991
  2071. ***************
  2072. *** 24,30 ****
  2073.   #include "config.h"
  2074.   
  2075.   #ifndef    lint
  2076. ! static    char    sccsid[] = "@(#)sulogin.c    3.5    08:31:00    7/15/91";
  2077.   #endif
  2078.   
  2079.   char    name[BUFSIZ];
  2080. --- 24,30 ----
  2081.   #include "config.h"
  2082.   
  2083.   #ifndef    lint
  2084. ! static    char    sccsid[] = "@(#)sulogin.c    3.6    08:44:50    9/12/91";
  2085.   #endif
  2086.   
  2087.   char    name[BUFSIZ];
  2088. ***************
  2089. *** 59,64 ****
  2090. --- 59,65 ----
  2091.   #define    RETRIES    3
  2092.   #endif
  2093.   
  2094. + /*ARGSUSED*/
  2095.   int    main (argc, argv, envp)
  2096.   int    argc;
  2097.   char    **argv;
  2098. Index: lmain.c
  2099. *** rel3/lmain.c    Thu Sep 12 08:47:59 1991
  2100. --- lmain.c    Thu Sep 12 08:49:37 1991
  2101. ***************
  2102. *** 47,53 ****
  2103.   #endif
  2104.   
  2105.   #ifndef    lint
  2106. ! static    char    sccsid[] = "@(#)lmain.c    3.12    21:49:36    7/16/91";
  2107.   #endif
  2108.   
  2109.                       /* danger - side effects */
  2110. --- 47,53 ----
  2111.   #endif
  2112.   
  2113.   #ifndef    lint
  2114. ! static    char    sccsid[] = "@(#)lmain.c    3.13    08:44:55    9/12/91";
  2115.   #endif
  2116.   
  2117.                       /* danger - side effects */
  2118. ***************
  2119. *** 75,81 ****
  2120. --- 75,83 ----
  2121.   int    pflg;
  2122.   int    rflg;
  2123.   int    fflg;
  2124. + #ifdef    RLOGIN
  2125.   int    hflg;
  2126. + #endif
  2127.   int    preauth_flag;
  2128.   #ifndef    BSD
  2129.   struct    termio    termio;
  2130. ***************
  2131. *** 105,111 ****
  2132.   extern    void    setenv ();
  2133.   extern    unsigned alarm ();
  2134.   extern    void    login ();
  2135. - extern    void    entry ();
  2136.   extern    void    setutmp ();
  2137.   extern    void    subsystem ();
  2138.   extern    void    log ();
  2139. --- 107,112 ----
  2140. ***************
  2141. *** 185,192 ****
  2142.   }
  2143.   
  2144.   #ifdef    RLOGIN
  2145. ! rlogin (host, name, namelen)
  2146. ! char    *host;
  2147.   char    *name;
  2148.   int    namelen;
  2149.   {
  2150. --- 186,193 ----
  2151.   }
  2152.   
  2153.   #ifdef    RLOGIN
  2154. ! rlogin (remote_host, name, namelen)
  2155. ! char    *remote_host;
  2156.   char    *name;
  2157.   int    namelen;
  2158.   {
  2159. ***************
  2160. *** 203,209 ****
  2161.       if (! (pwd = getpwnam (name)))
  2162.           return 0;
  2163.   
  2164. !     return ruserok (host, pwd->pw_uid == 0, remote_name, name);
  2165.   }
  2166.   
  2167.   get_remote_string (buf, size)
  2168. --- 204,210 ----
  2169.       if (! (pwd = getpwnam (name)))
  2170.           return 0;
  2171.   
  2172. !     return ruserok (remote_host, pwd->pw_uid == 0, remote_name, name);
  2173.   }
  2174.   
  2175.   get_remote_string (buf, size)
  2176. ***************
  2177. *** 259,265 ****
  2178.       struct    spwd    *spwd;
  2179.       struct    spwd    *getspnam();
  2180.   #ifdef    CONSOLE
  2181. -     int    conflag;
  2182.       char    console[BUFSIZ];
  2183.       FILE    *fp;
  2184.       struct    stat    statbuf;
  2185. --- 260,265 ----
  2186. ***************
  2187. *** 509,515 ****
  2188. --- 509,517 ----
  2189.            * been authenticated and so on.
  2190.            */
  2191.   
  2192. + #ifdef    RLOGIN
  2193.   have_name:
  2194. + #endif
  2195.   #ifdef    DIALUP
  2196.           alarm (30);
  2197.           if (pwent.pw_name && ! dialcheck (tty,
  2198. ***************
  2199. *** 614,624 ****
  2200.        */
  2201.   
  2202.       if (pwent.pw_uid != 0 && access (NOLOGINS, 0) == 0) {
  2203. !         FILE    *fp;
  2204.           int    c;
  2205.   
  2206. !         if (fp = fopen (NOLOGINS, "r")) {
  2207. !             while ((c = getc (fp)) != EOF) {
  2208.                   if (c == '\n')
  2209.                       putchar ('\r');
  2210.   
  2211. --- 616,626 ----
  2212.        */
  2213.   
  2214.       if (pwent.pw_uid != 0 && access (NOLOGINS, 0) == 0) {
  2215. !         FILE    *nlfp;
  2216.           int    c;
  2217.   
  2218. !         if (nlfp = fopen (NOLOGINS, "r")) {
  2219. !             while ((c = getc (nlfp)) != EOF) {
  2220.                   if (c == '\n')
  2221.                       putchar ('\r');
  2222.   
  2223. ***************
  2224. *** 625,631 ****
  2225.                   putchar (c);
  2226.               }
  2227.               fflush (stdout);
  2228. !             fclose (fp);
  2229.           } else
  2230.               printf ("\r\nSystem closed for routine maintenance\n");
  2231.   
  2232. --- 627,633 ----
  2233.                   putchar (c);
  2234.               }
  2235.               fflush (stdout);
  2236. !             fclose (nlfp);
  2237.           } else
  2238.               printf ("\r\nSystem closed for routine maintenance\n");
  2239.   
  2240. ***************
  2241. *** 684,690 ****
  2242.   #endif
  2243.   #ifdef    FAILLOG
  2244.       if (faillog.fail_cnt != 0)
  2245. !         failprint (pwent.pw_uid, &faillog);
  2246.   #endif    /* FAILLOG */
  2247.   #ifdef    LASTLOG
  2248.   #ifdef    HUSHLOGIN
  2249. --- 686,692 ----
  2250.   #endif
  2251.   #ifdef    FAILLOG
  2252.       if (faillog.fail_cnt != 0)
  2253. !         failprint (&faillog);
  2254.   #endif    /* FAILLOG */
  2255.   #ifdef    LASTLOG
  2256.   #ifdef    HUSHLOGIN
  2257. Index: obscure.c
  2258. *** rel3/obscure.c    Thu Sep 12 08:47:47 1991
  2259. --- obscure.c    Thu Sep 12 08:49:39 1991
  2260. ***************
  2261. *** 21,27 ****
  2262.   #include "config.h"
  2263.   
  2264.   #ifndef    lint
  2265. ! static    char    sccsid[] = "@(#)obscure.c    3.3    09:05:34    6/26/91";
  2266.   #endif
  2267.   
  2268.   #ifdef    NO_STRSTR
  2269. --- 21,27 ----
  2270.   #include "config.h"
  2271.   
  2272.   #ifndef    lint
  2273. ! static    char    sccsid[] = "@(#)obscure.c    3.4    08:45:08    9/12/91";
  2274.   #endif
  2275.   
  2276.   #ifdef    NO_STRSTR
  2277. ***************
  2278. *** 57,62 ****
  2279. --- 57,63 ----
  2280.    *    check passwords.
  2281.    */
  2282.   
  2283. + /*ARGSUSED*/
  2284.   int    obscure (old, new)
  2285.   char    *old;
  2286.   char    *new;
  2287. ***************
  2288. *** 114,119 ****
  2289. --- 115,121 ----
  2290.    * can't be a palindrome - like `R A D A R' or `M A D A M'
  2291.    */
  2292.   
  2293. + /*ARGSUSED*/
  2294.   int    palindrome (old, new)
  2295.   char    *old;
  2296.   char    *new;
  2297. ***************
  2298. *** 134,139 ****
  2299. --- 136,142 ----
  2300.    * more than half of the characters are different ones.
  2301.    */
  2302.   
  2303. + /*ARGSUSED*/
  2304.   int    similiar (old, new)
  2305.   char    *old;
  2306.   char    *new;
  2307. ***************
  2308. *** 156,161 ****
  2309. --- 159,165 ----
  2310.    * a nice mix of characters.
  2311.    */
  2312.   
  2313. + /*ARGSUSED*/
  2314.   int    simple (old, new)
  2315.   char    *old;
  2316.   char    *new;
  2317. ***************
  2318. *** 166,172 ****
  2319.       int    others = 0;
  2320.       int    size;
  2321.       int    i;
  2322. -     double    complexity;
  2323.   
  2324.       for (i = 0;new[i];i++) {
  2325.           if (isdigit (new[i]))
  2326. --- 170,175 ----
  2327. Index: mkrmdir.c
  2328. *** rel3/mkrmdir.c    Thu Sep 12 08:47:25 1991
  2329. --- mkrmdir.c    Thu Sep 12 08:49:40 1991
  2330. ***************
  2331. *** 14,20 ****
  2332.   #include "config.h"
  2333.   
  2334.   #ifndef lint
  2335. ! static    char    sccsid[] = "@(#)mkrmdir.c    3.1    10:09:21    6/13/91";
  2336.   #endif
  2337.   
  2338.   #ifdef    NEED_MKDIR
  2339. --- 14,20 ----
  2340.   #include "config.h"
  2341.   
  2342.   #ifndef lint
  2343. ! static    char    sccsid[] = "@(#)mkrmdir.c    3.2    08:45:12    9/12/91";
  2344.   #endif
  2345.   
  2346.   #ifdef    NEED_MKDIR
  2347. ***************
  2348. *** 46,51 ****
  2349. --- 46,52 ----
  2350.       umask (0777 & ~ mode);
  2351.       execl ("/bin/mkdir", "mkdir", dir, 0);
  2352.       _exit (128);
  2353. +     /*NOTREACHED*/
  2354.   }
  2355.   #endif
  2356.   #ifdef    NEED_RMDIR
  2357. ***************
  2358. *** 72,76 ****
  2359. --- 73,78 ----
  2360.       open ("/dev/null", O_WRONLY);
  2361.       execl ("/bin/rmdir", "rmdir", dir, 0);
  2362.       _exit (128);
  2363. +     /*NOTREACHED*/
  2364.   }
  2365.   #endif
  2366. Index: getpass.c
  2367. *** rel3/getpass.c    Thu Sep 12 08:47:55 1991
  2368. --- getpass.c    Thu Sep 12 08:49:42 1991
  2369. ***************
  2370. *** 22,28 ****
  2371.   #endif
  2372.   
  2373.   #ifndef    lint
  2374. ! static    char    sccsid[] = "@(#)getpass.c    3.5    08:58:53    7/10/91";
  2375.   #endif
  2376.   
  2377.   /*
  2378. --- 22,28 ----
  2379.   #endif
  2380.   
  2381.   #ifndef    lint
  2382. ! static    char    sccsid[] = "@(#)getpass.c    3.6    08:45:21    9/12/91";
  2383.   #endif
  2384.   
  2385.   /*
  2386. ***************
  2387. *** 78,84 ****
  2388.       char    *cp;
  2389.       FILE    *fp;
  2390.       int    tty_opened = 0;
  2391. !     void    (*old_signal)();
  2392.       TERMIO    new_modes;
  2393.       TERMIO    old_modes;
  2394.   
  2395. --- 78,84 ----
  2396.       char    *cp;
  2397.       FILE    *fp;
  2398.       int    tty_opened = 0;
  2399. !     int    (*old_signal)();
  2400.       TERMIO    new_modes;
  2401.       TERMIO    old_modes;
  2402.   
  2403. Index: grent.c
  2404. *** rel3/grent.c    Thu Sep 12 08:47:57 1991
  2405. --- grent.c    Thu Sep 12 08:49:43 1991
  2406. ***************
  2407. *** 32,38 ****
  2408.   #endif    /* NDBM */
  2409.   
  2410.   #ifndef    lint
  2411. ! static    char    sccsid[] = "@(#)grent.c    3.9    09:00:44    7/10/91";
  2412.   #endif    /* !lint */
  2413.   
  2414.   #define    NFIELDS    4
  2415. --- 32,38 ----
  2416.   #endif    /* NDBM */
  2417.   
  2418.   #ifndef    lint
  2419. ! static    char    sccsid[] = "@(#)grent.c    3.10    08:45:25    9/12/91";
  2420.   #endif    /* !lint */
  2421.   
  2422.   #define    NFIELDS    4
  2423. ***************
  2424. *** 56,62 ****
  2425.   int    cnt;
  2426.   FILE    *f;
  2427.   {
  2428. -     int    c;
  2429.       char    *cp = buf;
  2430.       char    *ep;
  2431.   
  2432. --- 56,61 ----
  2433. ***************
  2434. *** 285,295 ****
  2435.               return 0;
  2436.   
  2437.           if (content.dsize == sizeof (int)) {
  2438. !             memcpy (&cnt, content.dptr, content.dsize);
  2439.               for (cp = grpbuf, i = 0;i < cnt;i++) {
  2440. !                 memcpy (grpkey, &i, sizeof i);
  2441. !                 memcpy (grpkey + sizeof i, &grent.gr_gid,
  2442. !                     sizeof grent.gr_gid);
  2443.   
  2444.                   key.dsize = sizeof i + sizeof grent.gr_gid;
  2445.                   key.dptr = grpkey;
  2446. --- 284,295 ----
  2447.               return 0;
  2448.   
  2449.           if (content.dsize == sizeof (int)) {
  2450. !             memcpy ((char *) &cnt, content.dptr, content.dsize);
  2451.               for (cp = grpbuf, i = 0;i < cnt;i++) {
  2452. !                 memcpy (grpkey, (char *) &i, (int) sizeof i);
  2453. !                 memcpy (grpkey + sizeof i,
  2454. !                     (char *) &grent.gr_gid,
  2455. !                     (int) sizeof grent.gr_gid);
  2456.   
  2457.                   key.dsize = sizeof i + sizeof grent.gr_gid;
  2458.                   key.dptr = grpkey;
  2459. ***************
  2460. *** 380,388 ****
  2461.               return 0;
  2462.   
  2463.           if (content.dsize == sizeof (int)) {
  2464. !             memcpy (&cnt, content.dptr, content.dsize);
  2465.               for (cp = grpbuf, i = 0;i < cnt;i++) {
  2466. !                 memcpy (grpkey, &i, sizeof i);
  2467.                   strcpy (grpkey + sizeof i, name);
  2468.   
  2469.                   key.dsize = sizeof i + strlen (name);
  2470. --- 380,388 ----
  2471.               return 0;
  2472.   
  2473.           if (content.dsize == sizeof (int)) {
  2474. !             memcpy ((char *) &cnt, content.dptr, content.dsize);
  2475.               for (cp = grpbuf, i = 0;i < cnt;i++) {
  2476. !                 memcpy (grpkey, (char *) &i, (int) sizeof i);
  2477.                   strcpy (grpkey + sizeof i, name);
  2478.   
  2479.                   key.dsize = sizeof i + strlen (name);
  2480. Index: groupio.c
  2481. *** rel3/groupio.c    Thu Sep 12 08:47:43 1991
  2482. --- groupio.c    Thu Sep 12 08:49:45 1991
  2483. ***************
  2484. *** 36,42 ****
  2485.   #endif
  2486.   
  2487.   #ifndef    lint
  2488. ! static    char    sccsid[] = "@(#)groupio.c    3.8 09:03:34 6/26/91";
  2489.   #endif
  2490.   
  2491.   static    int    islocked;
  2492. --- 36,42 ----
  2493.   #endif
  2494.   
  2495.   #ifndef    lint
  2496. ! static    char    sccsid[] = "@(#)groupio.c    3.9 08:45:35 9/12/91";
  2497.   #endif
  2498.   
  2499.   static    int    islocked;
  2500. ***************
  2501. *** 123,129 ****
  2502.       for (i = 0;grent->gr_mem[i];i++)
  2503.           free (grent->gr_mem[i]);
  2504.   
  2505. !     free (grent->gr_mem);
  2506.   }
  2507.   
  2508.   /*
  2509. --- 123,129 ----
  2510.       for (i = 0;grent->gr_mem[i];i++)
  2511.           free (grent->gr_mem[i]);
  2512.   
  2513. !     free ((char *) grent->gr_mem);
  2514.   }
  2515.   
  2516.   /*
  2517. ***************
  2518. *** 357,370 ****
  2519.   gr_close ()
  2520.   {
  2521.       char    backup[BUFSIZ];
  2522. -     int    fd;
  2523.       int    mask;
  2524.       int    c;
  2525. -     int    i;
  2526.       int    errors = 0;
  2527.       FILE    *bkfp;
  2528.       struct    gr_file_entry *grf;
  2529. -     struct    gr_file_entry *ogrf;
  2530.       struct    stat    sb;
  2531.   
  2532.       if (! isopen) {
  2533. --- 357,367 ----
  2534. ***************
  2535. *** 443,454 ****
  2536.   
  2537.           if (grf->grf_entry) {
  2538.               gr_free (grf->grf_entry);
  2539. !             free (grf->grf_entry);
  2540.           }
  2541.           if (grf->grf_line)
  2542.               free (grf->grf_line);
  2543.   
  2544. !         free (grf);
  2545.       }
  2546.       grf_tail = 0;
  2547.       isopen = 0;
  2548. --- 440,451 ----
  2549.   
  2550.           if (grf->grf_entry) {
  2551.               gr_free (grf->grf_entry);
  2552. !             free ((char *) grf->grf_entry);
  2553.           }
  2554.           if (grf->grf_line)
  2555.               free (grf->grf_line);
  2556.   
  2557. !         free ((char *) grf);
  2558.       }
  2559.       grf_tail = 0;
  2560.       isopen = 0;
  2561. Index: grpack.c
  2562. *** rel3/grpack.c    Thu Sep 12 08:45:57 1991
  2563. --- grpack.c    Thu Sep 12 08:49:50 1991
  2564. ***************
  2565. *** 19,25 ****
  2566.   #endif
  2567.   
  2568.   #ifndef    lint
  2569. ! static    char    sccsid[] = "@(#)grpack.c    3.2    08:11:20    11/21/90";
  2570.   #endif
  2571.   
  2572.   int    gr_pack (group, buf)
  2573. --- 19,25 ----
  2574.   #endif
  2575.   
  2576.   #ifndef    lint
  2577. ! static    char    sccsid[] = "@(#)grpack.c    3.3    08:45:46    9/12/91";
  2578.   #endif
  2579.   
  2580.   int    gr_pack (group, buf)
  2581. ***************
  2582. *** 36,42 ****
  2583.       strcpy (cp, group->gr_passwd);
  2584.       cp += strlen (cp) + 1;
  2585.   
  2586. !     memcpy (cp, (void *) &group->gr_gid, sizeof group->gr_gid);
  2587.       cp += sizeof group->gr_gid;
  2588.   
  2589.       for (i = 0;group->gr_mem[i];i++) {
  2590. --- 36,42 ----
  2591.       strcpy (cp, group->gr_passwd);
  2592.       cp += strlen (cp) + 1;
  2593.   
  2594. !     memcpy (cp, (char *) &group->gr_gid, sizeof group->gr_gid);
  2595.       cp += sizeof group->gr_gid;
  2596.   
  2597.       for (i = 0;group->gr_mem[i];i++) {
  2598. ***************
  2599. *** 66,72 ****
  2600.       if (buf - org > len)
  2601.           return -1;
  2602.   
  2603. !     memcpy ((void *) &group->gr_gid, (void *) buf, sizeof group->gr_gid);
  2604.       buf += sizeof group->gr_gid;
  2605.       if (buf - org > len)
  2606.           return -1;
  2607. --- 66,72 ----
  2608.       if (buf - org > len)
  2609.           return -1;
  2610.   
  2611. !     memcpy ((char *) &group->gr_gid, (char *) buf, sizeof group->gr_gid);
  2612.       buf += sizeof group->gr_gid;
  2613.       if (buf - org > len)
  2614.           return -1;
  2615. Index: gsdbm.c
  2616. *** rel3/gsdbm.c    Thu Sep 12 08:47:31 1991
  2617. --- gsdbm.c    Thu Sep 12 08:49:51 1991
  2618. ***************
  2619. *** 1,5 ****
  2620.   /*
  2621. !  * Copyright 1990, John F. Haugh II
  2622.    * All rights reserved.
  2623.    *
  2624.    * Permission is granted to copy and create derivative works for any
  2625. --- 1,5 ----
  2626.   /*
  2627. !  * Copyright 1990, 1991, John F. Haugh II
  2628.    * All rights reserved.
  2629.    *
  2630.    * Permission is granted to copy and create derivative works for any
  2631. ***************
  2632. *** 10,16 ****
  2633.    */
  2634.   
  2635.   #ifndef    lint
  2636. ! static    char    sccsid[] = "@(#)gsdbm.c    3.4    22:55:17    6/13/91";
  2637.   #endif
  2638.   
  2639.   #include <string.h>
  2640. --- 10,16 ----
  2641.    */
  2642.   
  2643.   #ifndef    lint
  2644. ! static    char    sccsid[] = "@(#)gsdbm.c    3.5    08:45:49    9/12/91";
  2645.   #endif
  2646.   
  2647.   #include <string.h>
  2648. ***************
  2649. *** 81,87 ****
  2650.   
  2651.               key.dsize = sizeof i + strlen (sgr->sg_name);
  2652.               key.dptr = sgrpkey;
  2653. !             memcpy (sgrpkey, &i, sizeof i);
  2654.               strcpy (sgrpkey + sizeof i, sgr->sg_name);
  2655.               if (dbm_store (sgr_dbm, key, content, DBM_REPLACE))
  2656.                   return 0;
  2657. --- 81,87 ----
  2658.   
  2659.               key.dsize = sizeof i + strlen (sgr->sg_name);
  2660.               key.dptr = sgrpkey;
  2661. !             memcpy (sgrpkey, (char *) &i, sizeof i);
  2662.               strcpy (sgrpkey + sizeof i, sgr->sg_name);
  2663.               if (dbm_store (sgr_dbm, key, content, DBM_REPLACE))
  2664.                   return 0;
  2665. ***************
  2666. *** 103,109 ****
  2667.       datum    key;
  2668.       datum    content;
  2669.       char    grpkey[60];
  2670. -     char    *cp;
  2671.       int    i;
  2672.       int    cnt;
  2673.       int    errors = 0;
  2674. --- 103,108 ----
  2675. ***************
  2676. *** 125,136 ****
  2677.           ++errors;
  2678.       else {
  2679.           if (content.dsize == sizeof (int)) {
  2680. !             memcpy (&cnt, content.dptr, sizeof cnt);
  2681.   
  2682.               for (i = 0;i < cnt;i++) {
  2683.                   key.dsize = sizeof i + strlen (name);
  2684.                   key.dptr = grpkey;
  2685. !                 memcpy (grpkey, &i, sizeof i);
  2686.                   strcpy (grpkey + sizeof i, name);
  2687.                   if (dbm_delete (sgr_dbm, key))
  2688.                       ++errors;
  2689. --- 124,135 ----
  2690.           ++errors;
  2691.       else {
  2692.           if (content.dsize == sizeof (int)) {
  2693. !             memcpy ((char *) &cnt, content.dptr, sizeof cnt);
  2694.   
  2695.               for (i = 0;i < cnt;i++) {
  2696.                   key.dsize = sizeof i + strlen (name);
  2697.                   key.dptr = grpkey;
  2698. !                 memcpy (grpkey, (char *) &i, sizeof i);
  2699.                   strcpy (grpkey + sizeof i, name);
  2700.                   if (dbm_delete (sgr_dbm, key))
  2701.                       ++errors;
  2702. Index: gshadow.c
  2703. *** rel3/gshadow.c    Thu Sep 12 08:47:58 1991
  2704. --- gshadow.c    Thu Sep 12 08:49:53 1991
  2705. ***************
  2706. *** 32,38 ****
  2707.   
  2708.   
  2709.   #ifndef    lint
  2710. ! static    char    sccsid[] = "@(#)gshadow.c    3.6    09:02:02    7/10/91";
  2711.   #endif
  2712.   
  2713.   #define    MAXMEM    1024
  2714. --- 32,38 ----
  2715.   
  2716.   
  2717.   #ifndef    lint
  2718. ! static    char    sccsid[] = "@(#)gshadow.c    3.7    08:45:58    9/12/91";
  2719.   #endif
  2720.   
  2721.   #define    MAXMEM    1024
  2722. ***************
  2723. *** 125,136 ****
  2724.   {
  2725.       char    *fields[FIELDS];
  2726.       char    *cp;
  2727. -     char    *cpp;
  2728.       int    atoi ();
  2729.       long    atol ();
  2730.       int    i;
  2731.   
  2732. !     strncpy (sgrbuf, string, sizeof sgrbuf - 1);
  2733.       sgrbuf[sizeof sgrbuf - 1] = '\0';
  2734.   
  2735.       if (cp = strrchr (sgrbuf, '\n'))
  2736. --- 125,135 ----
  2737.   {
  2738.       char    *fields[FIELDS];
  2739.       char    *cp;
  2740.       int    atoi ();
  2741.       long    atol ();
  2742.       int    i;
  2743.   
  2744. !     strncpy (sgrbuf, string, (int) sizeof sgrbuf - 1);
  2745.       sgrbuf[sizeof sgrbuf - 1] = '\0';
  2746.   
  2747.       if (cp = strrchr (sgrbuf, '\n'))
  2748. ***************
  2749. *** 225,231 ****
  2750.   {
  2751.       char    buf[sizeof sgrbuf];
  2752.       char    *cp = buf;
  2753. -     int    errors = 0;
  2754.       int    i;
  2755.   
  2756.       if (! fp || ! sgrp)
  2757. --- 224,229 ----
  2758. Index: newusers.c
  2759. *** rel3/newusers.c    Thu Sep 12 08:46:53 1991
  2760. --- newusers.c    Thu Sep 12 08:49:54 1991
  2761. ***************
  2762. *** 26,37 ****
  2763.   #endif
  2764.   
  2765.   #ifndef    lint
  2766. ! static    char    sccsid[] = "@(#)newusers.c    3.3    09:07:46    5/28/91";
  2767.   #endif
  2768.   
  2769.   char    *Prog;
  2770.   
  2771.   extern    char    *pw_encrypt();
  2772.   
  2773.   int    pw_lock(), gr_lock();
  2774.   int    pw_open(), gr_open();
  2775. --- 26,38 ----
  2776.   #endif
  2777.   
  2778.   #ifndef    lint
  2779. ! static    char    sccsid[] = "@(#)newusers.c    3.4    08:46:03    9/12/91";
  2780.   #endif
  2781.   
  2782.   char    *Prog;
  2783.   
  2784.   extern    char    *pw_encrypt();
  2785. + extern    char    *malloc();
  2786.   
  2787.   int    pw_lock(), gr_lock();
  2788.   int    pw_open(), gr_open();
  2789. ***************
  2790. *** 60,66 ****
  2791.       int    status;
  2792.       int    pid;
  2793.       int    i;
  2794. -     char    buf[BUFSIZ];
  2795.   
  2796.       mode = (~mode & 0777);
  2797.       mask = umask (mode);
  2798. --- 61,66 ----
  2799. ***************
  2800. *** 92,100 ****
  2801.    */
  2802.   
  2803.   int
  2804. ! add_group (name, uid, gid, ngid)
  2805.   char    *name;
  2806. - char    *uid;
  2807.   char    *gid;
  2808.   int    *ngid;
  2809.   {
  2810. --- 92,99 ----
  2811.    */
  2812.   
  2813.   int
  2814. ! add_group (name, gid, ngid)
  2815.   char    *name;
  2816.   char    *gid;
  2817.   int    *ngid;
  2818.   {
  2819. ***************
  2820. *** 176,182 ****
  2821.        */
  2822.   
  2823.       if (i == -1) {
  2824. !         for (i = 100, gr_rewind;grp = gr_next ();)
  2825.               if (grp->gr_gid >= i)
  2826.                   i = grp->gr_gid + 1;
  2827.       }
  2828. --- 175,181 ----
  2829.        */
  2830.   
  2831.       if (i == -1) {
  2832. !         for (i = 100, gr_rewind ();grp = gr_next ();)
  2833.               if (grp->gr_gid >= i)
  2834.                   i = grp->gr_gid + 1;
  2835.       }
  2836. ***************
  2837. *** 270,277 ****
  2838.       struct    spwd    *sp;
  2839.       struct    spwd    spent;
  2840.   #endif
  2841. -     struct    passwd    *pw;
  2842. -     struct    passwd    pwent;
  2843.       static    char    newage[5];
  2844.       extern    char    *l64a();
  2845.   
  2846. --- 269,274 ----
  2847. ***************
  2848. *** 364,384 ****
  2849.       char    buf[BUFSIZ];
  2850.       char    *fields[8];
  2851.       int    nfields;
  2852. -     char    *name;
  2853. -     char    *newpwd;
  2854.       char    *cp;
  2855.   #ifdef    SHADOWPWD
  2856. -     struct    spwd    *sp;
  2857. -     struct    spwd    newsp;
  2858.       struct    spwd    *spw_locate();
  2859.   #endif
  2860.       struct    passwd    *pw;
  2861.       struct    passwd    newpw;
  2862.       struct    passwd    *pw_locate();
  2863. -     char    newage[5];
  2864.       int    errors = 0;
  2865.       int    line = 0;
  2866. -     long    now = time ((long *) 0) / (24L*3600L);
  2867.       int    uid;
  2868.       int    gid;
  2869.       int    i;
  2870. --- 361,375 ----
  2871. ***************
  2872. *** 496,502 ****
  2873.            */
  2874.           
  2875.           if (! (pw = pw_locate (fields[0])) &&
  2876. !             add_group (fields[0], fields[2], fields[3], &gid)) {
  2877.               fprintf (stderr, "%s: %d: can't create GID\n",
  2878.                   Prog, line);
  2879.               errors++;
  2880. --- 487,493 ----
  2881.            */
  2882.           
  2883.           if (! (pw = pw_locate (fields[0])) &&
  2884. !             add_group (fields[0], fields[3], &gid)) {
  2885.               fprintf (stderr, "%s: %d: can't create GID\n",
  2886.                   Prog, line);
  2887.               errors++;
  2888. ***************
  2889. *** 611,614 ****
  2890. --- 602,606 ----
  2891.       (void) pw_unlock ();
  2892.   
  2893.       exit (0);
  2894. +     /*NOTREACHED*/
  2895.   }
  2896. Index: pwio.c
  2897. *** rel3/pwio.c    Thu Sep 12 08:47:45 1991
  2898. --- pwio.c    Thu Sep 12 08:49:56 1991
  2899. ***************
  2900. *** 37,43 ****
  2901.   #endif
  2902.   
  2903.   #ifndef lint
  2904. ! static    char    sccsid[] = "@(#)pwio.c    3.8    09:04:48    6/26/91";
  2905.   #endif
  2906.   
  2907.   static    int    islocked;
  2908. --- 37,43 ----
  2909.   #endif
  2910.   
  2911.   #ifndef lint
  2912. ! static    char    sccsid[] = "@(#)pwio.c    3.9    08:46:13    9/12/91";
  2913.   #endif
  2914.   
  2915.   static    int    islocked;
  2916. ***************
  2917. *** 64,69 ****
  2918. --- 64,71 ----
  2919.   
  2920.   static    char    pw_filename[BUFSIZ] = PASSWD;
  2921.   
  2922. + extern    int    fputs();
  2923. + extern    char    *fgets();
  2924.   extern    char    *strdup();
  2925.   extern    char    *malloc();
  2926.   extern    struct    passwd    *sgetpwent();
  2927. ***************
  2928. *** 353,366 ****
  2929.   pw_close ()
  2930.   {
  2931.       char    backup[BUFSIZ];
  2932. -     int    fd;
  2933.       int    mask;
  2934.       int    c;
  2935. -     int    i;
  2936.       int    errors = 0;
  2937.       FILE    *bkfp;
  2938.       struct    pw_file_entry *pwf;
  2939. -     struct    pw_file_entry *opwf;
  2940.       struct    stat    sb;
  2941.   
  2942.       if (! isopen) {
  2943. --- 355,365 ----
  2944. Index: spdbm.c
  2945. *** rel3/spdbm.c    Thu Sep 12 08:47:13 1991
  2946. --- spdbm.c    Thu Sep 12 08:49:58 1991
  2947. ***************
  2948. *** 7,13 ****
  2949.    */
  2950.   
  2951.   #ifndef    lint
  2952. ! static    char    sccsid[] = "@(#)spdbm.c    3.2    09:29:53    6/6/91";
  2953.   #endif
  2954.   
  2955.   #include <string.h>
  2956. --- 7,13 ----
  2957.    */
  2958.   
  2959.   #ifndef    lint
  2960. ! static    char    sccsid[] = "@(#)spdbm.c    3.3    08:46:22    9/12/91";
  2961.   #endif
  2962.   
  2963.   #include <string.h>
  2964. ***************
  2965. *** 32,42 ****
  2966.       datum    key;
  2967.       datum    content;
  2968.       char    data[BUFSIZ];
  2969. -     char    spwdkey[60];
  2970. -     char    *cp;
  2971.       int    len;
  2972. -     int    i;
  2973. -     int    cnt;
  2974.       static    int    once;
  2975.   
  2976.       if (! once) {
  2977. --- 32,38 ----
  2978. Index: sppack.c
  2979. *** rel3/sppack.c    Thu Sep 12 08:45:42 1991
  2980. --- sppack.c    Thu Sep 12 08:49:59 1991
  2981. ***************
  2982. *** 1,13 ****
  2983.   /*
  2984. !  * Copyright 1990, John F. Haugh II
  2985.    * All rights reserved.
  2986.    *
  2987. !  * Use, duplication, and disclosure prohibited without
  2988. !  * the express written permission of the author.
  2989. !  *
  2990. !  * Duplication is permitted for non-commercial [ profit making ]
  2991. !  * purposes provided this and other copyright notices remain
  2992. !  * intact.
  2993.    */
  2994.   
  2995.   #include <stdio.h>
  2996. --- 1,12 ----
  2997.   /*
  2998. !  * Copyright 1990, 1991, John F. Haugh II
  2999.    * All rights reserved.
  3000.    *
  3001. !  * Permission is granted to copy and create derivative works for any
  3002. !  * non-commercial purpose, provided this copyright notice is preserved
  3003. !  * in all copies of source code, or included in human readable form
  3004. !  * and conspicuously displayed on all copies of object code or
  3005. !  * distribution media.
  3006.    */
  3007.   
  3008.   #include <stdio.h>
  3009. ***************
  3010. *** 20,26 ****
  3011.   #include "shadow.h"
  3012.   
  3013.   #ifndef    lint
  3014. ! static    char    sccsid[] = "@(#)sppack.c    3.1    08:16:27    11/21/90";
  3015.   #endif
  3016.   
  3017.   int    spw_pack (spwd, buf)
  3018. --- 19,25 ----
  3019.   #include "shadow.h"
  3020.   
  3021.   #ifndef    lint
  3022. ! static    char    sccsid[] = "@(#)sppack.c    3.2    08:46:24    9/12/91";
  3023.   #endif
  3024.   
  3025.   int    spw_pack (spwd, buf)
  3026. ***************
  3027. *** 66,72 ****
  3028.   struct    spwd    *spwd;
  3029.   {
  3030.       char    *org = buf;
  3031. -     char    *cp;
  3032.   
  3033.       spwd->sp_namp = buf;
  3034.       buf += strlen (buf) + 1;
  3035. --- 65,70 ----
  3036. -- 
  3037. John F. Haugh II        | I am the NRA.    | UUCP: ...!cs.utexas.edu!rpp386!jfh
  3038. Ma Bell: (512) 255-8251 | Shoot a friend today!|  Domain: jfh@rpp386.cactus.org
  3039. "I think we should call `cowboys' Bovine Custodial Officers ..."
  3040.         -- Jack Vogel
  3041.