home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume32 / shadow / patch06a < prev    next >
Encoding:
Text File  |  1992-10-14  |  57.5 KB  |  2,197 lines

  1. Newsgroups: comp.sources.misc
  2. From: jfh@rpp386.cactus.org (John F Haugh II)
  3. Subject:  v32i098:  shadow - Shadow Login/Password Suite, Patch06a/3
  4. Message-ID: <csm-v32i098=shadow.101926@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 117be586259212287f3466f9a68117a9
  6. Date: Mon, 12 Oct 1992 15:20:46 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: jfh@rpp386.cactus.org (John F Haugh II)
  10. Posting-number: Volume 32, Issue 98
  11. Archive-name: shadow/patch06a
  12. Environment: UNIX
  13. Patch-To: shadow: Volume 26, Issue 54-64
  14.  
  15. This is the first of three parts that make up patch #6 for the Shadow
  16. Password Suite.  Your source code must be at version 3.2.1 in order to
  17. apply this patch kit.  You will have version 3.2.2 when you are done.
  18.  
  19. The most significant change made for this patch is the addition of
  20. administrator defined authentication mechanisms.  This allows the system
  21. administrator to replace the standard encrypted password with a program
  22. which performs the authentication.  Any user written program may be used.
  23. This feature may be used to add any of a number of authentication schemes.
  24.  
  25. Also, I have begun removing the requirement that you define SHADOWPWD.
  26. This is because people keep writing me saying that they like the tools,
  27. but don't want to use shadowed passwords.  So the user and group commands
  28. ({user,group}{add,del,mod}) have all be fixed so that they work with the
  29. old style password file.  This means that those 6 commands may now be
  30. used on an unaltered BSD system.  The remaining commands will be changed
  31. as time permits.
  32. --
  33. Prereq: "3.2.1"
  34. Index: patchlevel.h
  35. *** patchlevel.h.old    Sat Oct 10 11:11:57 1992
  36. --- patchlevel.h    Sat Oct 10 11:11:56 1992
  37. ***************
  38. *** 19,26 ****
  39.    *        Changes for SVR4, plus bug fixes
  40.    *    04/03/92    3.2.1    patchlevel 18
  41.    *        Minor bug fixes, new baseline
  42.    */
  43.   
  44.   #define    RELEASE        3
  45. ! #define    PATCHLEVEL    18
  46. ! #define    VERSION        "3.2.1"
  47. --- 19,28 ----
  48.    *        Changes for SVR4, plus bug fixes
  49.    *    04/03/92    3.2.1    patchlevel 18
  50.    *        Minor bug fixes, new baseline
  51. +  *    07/07/92    3.2.2    patchlevel 20
  52. +  *        Added administrator defined authentication
  53.    */
  54.   
  55.   #define    RELEASE        3
  56. ! #define    PATCHLEVEL    20
  57. ! #define    VERSION        "3.2.2"
  58. Index: dpmain.c
  59. *** dpmain.c.old    Sat Oct 10 11:12:13 1992
  60. --- dpmain.c    Sat Oct 10 11:12:13 1992
  61. ***************
  62. *** 12,17 ****
  63. --- 12,18 ----
  64.   #include <sys/types.h>
  65.   #include <sys/stat.h>
  66.   #include <stdio.h>
  67. + #include <signal.h>
  68.   #include <fcntl.h>
  69.   #ifdef    BSD
  70.   #include <strings.h>
  71. ***************
  72. *** 21,27 ****
  73.   #include "dialup.h"
  74.   
  75.   #ifndef    lint
  76. ! static    char    sccsid[] = "@(#)dpmain.c    3.6    07:49:11    4/29/92";
  77.   #endif
  78.   
  79.   #ifdef    USG
  80. --- 22,28 ----
  81.   #include "dialup.h"
  82.   
  83.   #ifndef    lint
  84. ! static    char    sccsid[] = "@(#)dpmain.c    3.7    15:41:44    6/16/92";
  85.   #endif
  86.   
  87.   #ifdef    USG
  88. Index: Makefile
  89. *** Makefile.old    Sat Oct 10 11:12:31 1992
  90. --- Makefile    Sat Oct 10 11:12:29 1992
  91. ***************
  92. *** 8,17 ****
  93.   # and conspicuously displayed on all copies of object code or
  94.   # distribution media.
  95.   #
  96. ! #    @(#)Makefile    3.25.1.10    14:47:00  - Shadow password system
  97.   #
  98. ! #    @(#)Makefile    3.25.1.10    14:47:00    4/28/92
  99.   #
  100.   SHELL = /bin/sh
  101.   
  102.   #
  103. --- 8,20 ----
  104.   # and conspicuously displayed on all copies of object code or
  105.   # distribution media.
  106.   #
  107. ! # This software is provided on an AS-IS basis and the author makes
  108. ! # no warrantee of any kind.
  109.   #
  110. ! #    @(#)Makefile    3.25.1.13    08:23:37  - Shadow password system
  111.   #
  112. + #    @(#)Makefile    3.25.1.13    08:23:37    10/1/92
  113. + #
  114.   SHELL = /bin/sh
  115.   
  116.   #
  117. ***************
  118. *** 176,182 ****
  119.       spdbm.c dpmain.c gshadow.c gsdbm.c gspack.c sgroupio.c useradd.c \
  120.       userdel.c patchlevel.h usermod.c copydir.c mkrmdir.c groupadd.c \
  121.       groupdel.c groupmod.c tz.c console.c hushed.c getdef.c scologin.c \
  122. !     logoutd.c groups.c
  123.   
  124.   FILES1 = README patchlevel.h newgrp.c Makefile config.h pwunconv.c obscure.c \
  125.       age.c id.c
  126. --- 179,185 ----
  127.       spdbm.c dpmain.c gshadow.c gsdbm.c gspack.c sgroupio.c useradd.c \
  128.       userdel.c patchlevel.h usermod.c copydir.c mkrmdir.c groupadd.c \
  129.       groupdel.c groupmod.c tz.c console.c hushed.c getdef.c scologin.c \
  130. !     logoutd.c groups.c pwauth.c
  131.   
  132.   FILES1 = README patchlevel.h newgrp.c Makefile config.h pwunconv.c obscure.c \
  133.       age.c id.c
  134. ***************
  135. *** 195,201 ****
  136.       fields.c gsdbm.c utmp.c failure.c
  137.   
  138.   FILES7 = groupio.c shadowio.c sgroupio.c groups.c copydir.c mkrmdir.c \
  139. !     mkpasswd.c
  140.   
  141.   FILES8 = useradd.c usermod.c login.defs
  142.   
  143. --- 198,204 ----
  144.       fields.c gsdbm.c utmp.c failure.c
  145.   
  146.   FILES7 = groupio.c shadowio.c sgroupio.c groups.c copydir.c mkrmdir.c \
  147. !     mkpasswd.c pwauth.c pwauth.h
  148.   
  149.   FILES8 = useradd.c usermod.c login.defs
  150.   
  151. ***************
  152. *** 208,218 ****
  153.   MAN_1 = chage.1 chfn.1 chsh.1 id.1 login.1 newgrp.1 passwd.1 su.1 \
  154.       useradd.1 userdel.1 usermod.1 groupadd.1 groupdel.1 groupmod.1 \
  155.       groups.1
  156. ! MAN_3 = shadow.3
  157.   MAN_4 = faillog.4 passwd.4 porttime.4 shadow.4
  158.   MAN_5 = login.5
  159.   MAN_8 = chpasswd.8 dpasswd.8 faillog.8 newusers.8 pwconv.8 pwunconv.8 \
  160. !     sulogin.8 mkpasswd.8 logoutd.8
  161.   
  162.   DOCS1 = $(MAN_1) $(MAN_3) $(MAN_4)
  163.   DOCS2 = $(MAN_5) $(MAN_8)
  164. --- 211,221 ----
  165.   MAN_1 = chage.1 chfn.1 chsh.1 id.1 login.1 newgrp.1 passwd.1 su.1 \
  166.       useradd.1 userdel.1 usermod.1 groupadd.1 groupdel.1 groupmod.1 \
  167.       groups.1
  168. ! MAN_3 = shadow.3 pwauth.3
  169.   MAN_4 = faillog.4 passwd.4 porttime.4 shadow.4
  170.   MAN_5 = login.5
  171.   MAN_8 = chpasswd.8 dpasswd.8 faillog.8 newusers.8 pwconv.8 pwunconv.8 \
  172. !     sulogin.8 mkpasswd.8 logoutd.8 pwauth.8
  173.   
  174.   DOCS1 = $(MAN_1) $(MAN_3) $(MAN_4)
  175.   DOCS2 = $(MAN_5) $(MAN_8)
  176. ***************
  177. *** 246,251 ****
  178. --- 249,255 ----
  179.       libshadow.a(pwent.o) \
  180.       libshadow.a(pwio.o) \
  181.       libshadow.a(pwpack.o) \
  182. +     libshadow.a(pwauth.o) \
  183.       libshadow.a(rad64.o) \
  184.       libshadow.a(spdbm.o) \
  185.       libshadow.a(shadow.o) \
  186. ***************
  187. *** 256,261 ****
  188. --- 260,288 ----
  189.   libsec: $(LIBSEC)(shadow.o)
  190.       $(RANLIB) $(LIBSEC)
  191.   
  192. + save:
  193. +     [ ! -d save ] && mkdir save
  194. +     -cp $(LOGINDIR)/login save
  195. +     -cp /etc/mkpasswd /etc/pwconv /etc/pwunconv /etc/sulogin /etc/chpasswd \
  196. +         /etc/newusers /etc/useradd /etc/userdel /etc/usermod \
  197. +         /etc/groupadd /etc/groupdel /etc/groupmod /etc/logoutd \
  198. +         /etc/login.defs save
  199. +     -cp /bin/su /bin/passwd /bin/gpasswd /bin/dpasswd /bin/faillog \
  200. +         /bin/newgrp /bin/chfn /bin/chsh /bin/chage /bin/id \
  201. +         /bin/scologin save
  202. +     -cp $(DEST_INCLUDE_DIR)/dialup.h $(DEST_INCLUDE_DIR)/shadow.h \
  203. +         $(DEST_INCLUDE_DIR)/pwd.h save
  204. + restore:
  205. +     [ -d save ]
  206. +     -(cd save ; cp login $(LOGINDIR) )
  207. +     -(cd save ; -cp mkpasswd pwconv pwunconv sulogin chpasswd \
  208. +         newusers useradd userdel usermod groupadd groupdel groupmod \
  209. +         logoutd login.defs /etc)
  210. +     -(cd save ; cp su passwd gpasswd dpasswd faillog newgrp chfn chsh \
  211. +         chage id scologin /bin)
  212. +     -(cd save ; cp dialup.h shadow.h pwd.h $(DEST_INCLUDE_DIR) )
  213.   install: all
  214.       strip $(BINS)
  215.       cp login $(LOGINDIR)/login
  216. ***************
  217. *** 506,514 ****
  218.   scologin: scologin.o
  219.       $(CC) -o scologin $(LDFLAGS) scologin.o -lsocket
  220.   
  221. ! passwd.o: config.h shadow.h pwd.h
  222. ! lmain.o: config.h lastlog.h faillog.h pwd.h
  223. ! smain.o: config.h lastlog.h pwd.h shadow.h
  224.   sub.o: pwd.h
  225.   setup.o: config.h pwd.h
  226.   mkrmdir.o: config.h
  227. --- 533,541 ----
  228.   scologin: scologin.o
  229.       $(CC) -o scologin $(LDFLAGS) scologin.o -lsocket
  230.   
  231. ! passwd.o: config.h shadow.h pwd.h pwauth.h
  232. ! lmain.o: config.h lastlog.h faillog.h pwd.h pwauth.h
  233. ! smain.o: config.h lastlog.h pwd.h shadow.h pwauth.h
  234.   sub.o: pwd.h
  235.   setup.o: config.h pwd.h
  236.   mkrmdir.o: config.h
  237. ***************
  238. *** 535,548 ****
  239.   id.o: pwd.h
  240.   newusers.o: config.h shadow.h pwd.h
  241.   dpmain.o: dialup.h
  242. ! useradd.o: config.h shadow.h pwd.h
  243. ! userdel.o: config.h shadow.h pwd.h
  244. ! usermod.o: config.h shadow.h pwd.h
  245.   groupadd.o: config.h shadow.h
  246.   groupdel.o: config.h shadow.h
  247.   groupmod.o: config.h shadow.h
  248.   logoutd.o: config.h
  249. ! sulogin.o: config.h
  250.   
  251.   libshadow.a(shadow.o): shadow.h config.h
  252.   libshadow.a(shadowio.o): shadow.h
  253. --- 562,575 ----
  254.   id.o: pwd.h
  255.   newusers.o: config.h shadow.h pwd.h
  256.   dpmain.o: dialup.h
  257. ! useradd.o: config.h shadow.h pwd.h pwauth.h
  258. ! userdel.o: config.h shadow.h pwd.h pwauth.h
  259. ! usermod.o: config.h shadow.h pwd.h pwauth.h
  260.   groupadd.o: config.h shadow.h
  261.   groupdel.o: config.h shadow.h
  262.   groupmod.o: config.h shadow.h
  263.   logoutd.o: config.h
  264. ! sulogin.o: config.h pwauth.h
  265.   
  266.   libshadow.a(shadow.o): shadow.h config.h
  267.   libshadow.a(shadowio.o): shadow.h
  268. ***************
  269. *** 554,560 ****
  270. --- 581,589 ----
  271.   libshadow.a(pwdbm.o): config.h pwd.h
  272.   libshadow.a(spdbm.o): config.h shadow.h
  273.   libshadow.a(grdbm.o): config.h
  274. + libshadow.a(gshadow.o): config.h
  275.   libshadow.a(gsdbm.o): config.h shadow.h
  276. + libshadow.a(pwauth.o): config.h pwauth.h
  277.   libshadow.a(pwpack.o): config.h pwd.h
  278.   libshadow.a(pwent.o): config.h pwd.h
  279.   libshadow.a(pwio.o): pwd.h
  280. Index: Makefile.svr4
  281. *** Makefile.svr4.old    Sat Oct 10 11:12:48 1992
  282. --- Makefile.svr4    Sat Oct 10 11:12:47 1992
  283. ***************
  284. *** 8,17 ****
  285.   # and conspicuously displayed on all copies of object code or
  286.   # distribution media.
  287.   #
  288. ! #    @(#)Makefile.svr4    3.3    11:27:39  - Shadow password system (SVR4)
  289.   #
  290. ! #    @(#)Makefile.svr4    3.3    11:27:39    3/19/92
  291.   #
  292.   SHELL = /sbin/sh
  293.   
  294.   #
  295. --- 8,20 ----
  296.   # and conspicuously displayed on all copies of object code or
  297.   # distribution media.
  298.   #
  299. ! # This software is provided on an AS-IS basis and the author makes
  300. ! # no warrantee of any kind.
  301.   #
  302. ! #    @(#)Makefile.svr4    3.5    08:28:03  - Shadow password system (SVR4)
  303.   #
  304. + #    @(#)Makefile.svr4    3.5    08:28:03    10/1/92
  305. + #
  306.   SHELL = /sbin/sh
  307.   
  308.   #
  309. ***************
  310. *** 143,149 ****
  311.       spdbm.c dpmain.c gshadow.c gsdbm.c gspack.c sgroupio.c useradd.c \
  312.       userdel.c patchlevel.h usermod.c copydir.c mkrmdir.c groupadd.c \
  313.       groupdel.c groupmod.c tz.c console.c hushed.c getdef.c scologin.c \
  314. !     logoutd.c groups.c
  315.   
  316.   FILES1 = README patchlevel.h newgrp.c Makefile config.h pwunconv.c obscure.c \
  317.       age.c id.c
  318. --- 146,152 ----
  319.       spdbm.c dpmain.c gshadow.c gsdbm.c gspack.c sgroupio.c useradd.c \
  320.       userdel.c patchlevel.h usermod.c copydir.c mkrmdir.c groupadd.c \
  321.       groupdel.c groupmod.c tz.c console.c hushed.c getdef.c scologin.c \
  322. !     logoutd.c groups.c pwauth.c
  323.   
  324.   FILES1 = README patchlevel.h newgrp.c Makefile config.h pwunconv.c obscure.c \
  325.       age.c id.c
  326. ***************
  327. *** 162,168 ****
  328.       fields.c gsdbm.c utmp.c failure.c
  329.   
  330.   FILES7 = groupio.c shadowio.c sgroupio.c groups.c copydir.c mkrmdir.c \
  331. !     mkpasswd.c
  332.   
  333.   FILES8 = useradd.c usermod.c login.defs
  334.   
  335. --- 165,171 ----
  336.       fields.c gsdbm.c utmp.c failure.c
  337.   
  338.   FILES7 = groupio.c shadowio.c sgroupio.c groups.c copydir.c mkrmdir.c \
  339. !     mkpasswd.c pwauth.c pwauth.h
  340.   
  341.   FILES8 = useradd.c usermod.c login.defs
  342.   
  343. ***************
  344. *** 175,185 ****
  345.   MAN_1 = chage.1 chfn.1 chsh.1 id.1 login.1 newgrp.1 passwd.1 su.1 \
  346.       useradd.1 userdel.1 usermod.1 groupadd.1 groupdel.1 groupmod.1 \
  347.       groups.1
  348. ! MAN_3 = shadow.3
  349.   MAN_4 = faillog.4 passwd.4 porttime.4 shadow.4
  350.   MAN_5 = login.5
  351.   MAN_8 = chpasswd.8 dpasswd.8 faillog.8 newusers.8 pwconv.8 pwunconv.8 \
  352. !     sulogin.8 mkpasswd.8 logoutd.8
  353.   
  354.   DOCS1 = $(MAN_1) $(MAN_3) $(MAN_4)
  355.   DOCS2 = $(MAN_5) $(MAN_8)
  356. --- 178,188 ----
  357.   MAN_1 = chage.1 chfn.1 chsh.1 id.1 login.1 newgrp.1 passwd.1 su.1 \
  358.       useradd.1 userdel.1 usermod.1 groupadd.1 groupdel.1 groupmod.1 \
  359.       groups.1
  360. ! MAN_3 = shadow.3 pwauth.3
  361.   MAN_4 = faillog.4 passwd.4 porttime.4 shadow.4
  362.   MAN_5 = login.5
  363.   MAN_8 = chpasswd.8 dpasswd.8 faillog.8 newusers.8 pwconv.8 pwunconv.8 \
  364. !     sulogin.8 mkpasswd.8 logoutd.8 pwauth.8
  365.   
  366.   DOCS1 = $(MAN_1) $(MAN_3) $(MAN_4)
  367.   DOCS2 = $(MAN_5) $(MAN_8)
  368. ***************
  369. *** 213,218 ****
  370. --- 216,222 ----
  371.       libshadow.a(pwent.o) \
  372.       libshadow.a(pwio.o) \
  373.       libshadow.a(pwpack.o) \
  374. +     libshadow.a(pwauth.o) \
  375.       libshadow.a(rad64.o) \
  376.       libshadow.a(spdbm.o) \
  377.       libshadow.a(shadow.o) \
  378. ***************
  379. *** 222,227 ****
  380. --- 226,255 ----
  381.   
  382.   libsec: $(LIBSEC)(shadow.o)
  383.       $(RANLIB) $(LIBSEC)
  384. + save:
  385. +     [ ! -d save ] && mkdir save
  386. +     -cp $(LOGINDIR)/login save
  387. +     -cp $(SBIN)/mkpasswd $(SBIN)/pwconv $(SBIN)/pwunconv $(SBIN)/sulogin \
  388. +         $(SBIN)/chpasswd $(SBIN)/newusers $(SBIN)/useradd \
  389. +         $(SBIN)/userdel $(SBIN)/usermod $(SBIN)/groupadd \
  390. +         $(SBIN)/groupdel $(SBIN)/groupmod $(SBIN)/logoutd \
  391. +         $(SBIN)/login.defs save
  392. +     -cp $(UBIN)/su $(UBIN)/passwd $(UBIN)/gpasswd $(UBIN)/dpasswd \
  393. +         $(UBIN)/faillog $(UBIN)/newgrp $(UBIN)/chfn $(UBIN)/chsh \
  394. +         $(UBIN)/chage $(UBIN)/id $(UBIN)/scologin save
  395. +     -cp $(DEST_INCLUDE_DIR)/dialup.h $(DEST_INCLUDE_DIR)/shadow.h \
  396. +         $(DEST_INCLUDE_DIR)/pwd.h save
  397. + restore:
  398. +     [ -d save ]
  399. +     -(cd save ; cp login $(LOGINDIR) )
  400. +     -(cd save ; -cp mkpasswd pwconv pwunconv sulogin chpasswd \
  401. +         newusers useradd userdel usermod groupadd groupdel groupmod \
  402. +         logoutd login.defs $(SBIN) )
  403. +     -(cd save ; cp su passwd gpasswd dpasswd faillog newgrp chfn chsh \
  404. +         chage id scologin $(UBIN) )
  405. +     -(cd save ; cp dialup.h shadow.h pwd.h $(DEST_INCLUDE_DIR) )
  406.   
  407.   install: all
  408.       strip $(BINS)
  409. Index: Makefile.sun4
  410. *** Makefile.sun4.old    Sat Oct 10 11:13:04 1992
  411. --- Makefile.sun4    Sat Oct 10 11:13:04 1992
  412. ***************
  413. *** 8,17 ****
  414.   # and conspicuously displayed on all copies of object code or
  415.   # distribution media.
  416.   #
  417. ! #    @(#)Makefile.sun4    3.5    11:27:30  - Shadow password system (SunOS 4.1.1 version)
  418.   #
  419. ! #    @(#)Makefile.sun4    3.5    11:27:30    3/19/92
  420.   #
  421.   SHELL = /bin/sh
  422.   
  423.   #
  424. --- 8,20 ----
  425.   # and conspicuously displayed on all copies of object code or
  426.   # distribution media.
  427.   #
  428. ! # This software is provided on an AS-IS basis and the author makes
  429. ! # no warrantee of any kind.
  430.   #
  431. ! #    @(#)Makefile.sun4    3.7    08:24:54  - Shadow password system (SunOS 4.1.1 version)
  432.   #
  433. + #    @(#)Makefile.sun4    3.7    08:24:54    10/1/92
  434. + #
  435.   SHELL = /bin/sh
  436.   
  437.   #
  438. ***************
  439. *** 140,146 ****
  440.       spdbm.c dpmain.c gshadow.c gsdbm.c gspack.c sgroupio.c useradd.c \
  441.       userdel.c patchlevel.h usermod.c copydir.c mkrmdir.c groupadd.c \
  442.       groupdel.c groupmod.c tz.c console.c hushed.c getdef.c scologin.c \
  443. !     logoutd.c groups.c
  444.   
  445.   FILES1 = README patchlevel.h newgrp.c Makefile config.h pwunconv.c obscure.c \
  446.       age.c id.c
  447. --- 143,149 ----
  448.       spdbm.c dpmain.c gshadow.c gsdbm.c gspack.c sgroupio.c useradd.c \
  449.       userdel.c patchlevel.h usermod.c copydir.c mkrmdir.c groupadd.c \
  450.       groupdel.c groupmod.c tz.c console.c hushed.c getdef.c scologin.c \
  451. !     logoutd.c groups.c pwauth.c
  452.   
  453.   FILES1 = README patchlevel.h newgrp.c Makefile config.h pwunconv.c obscure.c \
  454.       age.c id.c
  455. ***************
  456. *** 159,165 ****
  457.       fields.c gsdbm.c utmp.c failure.c
  458.   
  459.   FILES7 = groupio.c shadowio.c sgroupio.c groups.c copydir.c mkrmdir.c \
  460. !     mkpasswd.c
  461.   
  462.   FILES8 = useradd.c usermod.c login.defs
  463.   
  464. --- 162,168 ----
  465.       fields.c gsdbm.c utmp.c failure.c
  466.   
  467.   FILES7 = groupio.c shadowio.c sgroupio.c groups.c copydir.c mkrmdir.c \
  468. !     mkpasswd.c pwauth.c pwauth.h
  469.   
  470.   FILES8 = useradd.c usermod.c login.defs
  471.   
  472. ***************
  473. *** 172,182 ****
  474.   MAN_1 = chage.1 chfn.1 chsh.1 id.1 login.1 newgrp.1 passwd.1 su.1 \
  475.       useradd.1 userdel.1 usermod.1 groupadd.1 groupdel.1 groupmod.1 \
  476.       groups.1
  477. ! MAN_3 = shadow.3
  478.   MAN_4 = faillog.4 passwd.4 porttime.4 shadow.4
  479.   MAN_5 = login.5
  480.   MAN_8 = chpasswd.8 dpasswd.8 faillog.8 newusers.8 pwconv.8 pwunconv.8 \
  481. !     sulogin.8 mkpasswd.8 logoutd.8
  482.   
  483.   DOCS1 = $(MAN_1) $(MAN_3) $(MAN_4)
  484.   DOCS2 = $(MAN_5) $(MAN_8)
  485. --- 175,185 ----
  486.   MAN_1 = chage.1 chfn.1 chsh.1 id.1 login.1 newgrp.1 passwd.1 su.1 \
  487.       useradd.1 userdel.1 usermod.1 groupadd.1 groupdel.1 groupmod.1 \
  488.       groups.1
  489. ! MAN_3 = shadow.3 pwauth.3
  490.   MAN_4 = faillog.4 passwd.4 porttime.4 shadow.4
  491.   MAN_5 = login.5
  492.   MAN_8 = chpasswd.8 dpasswd.8 faillog.8 newusers.8 pwconv.8 pwunconv.8 \
  493. !     sulogin.8 mkpasswd.8 logoutd.8 pwauth.8
  494.   
  495.   DOCS1 = $(MAN_1) $(MAN_3) $(MAN_4)
  496.   DOCS2 = $(MAN_5) $(MAN_8)
  497. ***************
  498. *** 209,214 ****
  499. --- 212,218 ----
  500.       libshadow.a(pwent.o) \
  501.       libshadow.a(pwio.o) \
  502.       libshadow.a(pwpack.o) \
  503. +     libshadow.a(pwauth.o) \
  504.       libshadow.a(rad64.o) \
  505.       libshadow.a(spdbm.o) \
  506.       libshadow.a(shadow.o) \
  507. ***************
  508. *** 219,224 ****
  509. --- 223,251 ----
  510.   libsec: $(LIBSEC)(shadow.o)
  511.       $(RANLIB) $(LIBSEC)
  512.   
  513. + save:
  514. +     [ ! -d save ] && mkdir save
  515. +     -cp $(LOGINDIR)/login save
  516. +     -cp /etc/mkpasswd /etc/pwconv /etc/pwunconv /etc/sulogin /etc/chpasswd \
  517. +         /etc/newusers /etc/useradd /etc/userdel /etc/usermod \
  518. +         /etc/groupadd /etc/groupdel /etc/groupmod /etc/logoutd \
  519. +         /etc/login.defs save
  520. +     -cp /bin/su /bin/passwd /bin/gpasswd /bin/dpasswd /bin/faillog \
  521. +         /bin/newgrp /bin/chfn /bin/chsh /bin/chage /bin/id \
  522. +         /bin/scologin save
  523. +     -cp $(DEST_INCLUDE_DIR)/dialup.h $(DEST_INCLUDE_DIR)/shadow.h \
  524. +         $(DEST_INCLUDE_DIR)/pwd.h save
  525. + restore:
  526. +     [ -d save ]
  527. +     -(cd save ; cp login $(LOGINDIR) )
  528. +     -(cd save ; -cp mkpasswd pwconv pwunconv sulogin chpasswd \
  529. +         newusers useradd userdel usermod groupadd groupdel groupmod \
  530. +         logoutd login.defs /etc)
  531. +     -(cd save ; cp su passwd gpasswd dpasswd faillog newgrp chfn chsh \
  532. +         chage id scologin /bin)
  533. +     -(cd save ; cp dialup.h shadow.h pwd.h $(DEST_INCLUDE_DIR) )
  534.   install: all
  535.       strip $(BINS)
  536.       cp login $(LOGINDIR)/login
  537. ***************
  538. *** 471,479 ****
  539.   scologin: scologin.o
  540.       $(CC) -o scologin $(LDFLAGS) scologin.o -lsocket
  541.   
  542. ! passwd.o: config.h shadow.h pwd.h
  543. ! lmain.o: config.h lastlog.h faillog.h pwd.h
  544. ! smain.o: config.h lastlog.h pwd.h shadow.h
  545.   sub.o: pwd.h
  546.   setup.o: config.h pwd.h
  547.   mkrmdir.o: config.h
  548. --- 498,506 ----
  549.   scologin: scologin.o
  550.       $(CC) -o scologin $(LDFLAGS) scologin.o -lsocket
  551.   
  552. ! passwd.o: config.h shadow.h pwd.h pwauth.h
  553. ! lmain.o: config.h lastlog.h faillog.h pwd.h pwauth.h
  554. ! smain.o: config.h lastlog.h pwd.h shadow.h pwauth.h
  555.   sub.o: pwd.h
  556.   setup.o: config.h pwd.h
  557.   mkrmdir.o: config.h
  558. ***************
  559. *** 500,513 ****
  560.   id.o: pwd.h
  561.   newusers.o: config.h shadow.h pwd.h
  562.   dpmain.o: dialup.h
  563. ! useradd.o: config.h shadow.h pwd.h
  564. ! userdel.o: config.h shadow.h pwd.h
  565. ! usermod.o: config.h shadow.h pwd.h
  566.   groupadd.o: config.h shadow.h
  567.   groupdel.o: config.h shadow.h
  568.   groupmod.o: config.h shadow.h
  569.   logoutd.o: config.h
  570. ! sulogin.o: config.h
  571.   
  572.   libshadow.a(shadow.o): shadow.h config.h
  573.   libshadow.a(shadowio.o): shadow.h
  574. --- 527,540 ----
  575.   id.o: pwd.h
  576.   newusers.o: config.h shadow.h pwd.h
  577.   dpmain.o: dialup.h
  578. ! useradd.o: config.h shadow.h pwd.h pwauth.h
  579. ! userdel.o: config.h shadow.h pwd.h pwauth.h
  580. ! usermod.o: config.h shadow.h pwd.h pwauth.h
  581.   groupadd.o: config.h shadow.h
  582.   groupdel.o: config.h shadow.h
  583.   groupmod.o: config.h shadow.h
  584.   logoutd.o: config.h
  585. ! sulogin.o: config.h pwauth.h
  586.   
  587.   libshadow.a(shadow.o): shadow.h config.h
  588.   libshadow.a(shadowio.o): shadow.h
  589. ***************
  590. *** 519,525 ****
  591. --- 546,554 ----
  592.   libshadow.a(pwdbm.o): config.h pwd.h
  593.   libshadow.a(spdbm.o): config.h shadow.h
  594.   libshadow.a(grdbm.o): config.h
  595. + libshadow.a(gshadow.o): config.h
  596.   libshadow.a(gsdbm.o): config.h shadow.h
  597. + libshadow.a(pwauth.o): config.h pwauth.h
  598.   libshadow.a(pwpack.o): config.h pwd.h
  599.   libshadow.a(pwent.o): config.h pwd.h
  600.   libshadow.a(pwio.o): pwd.h
  601. Index: README
  602. *** README.old    Sat Oct 10 11:13:22 1992
  603. --- README    Sat Oct 10 11:13:21 1992
  604. ***************
  605. *** 1,7 ****
  606. ! [    @(#)README    3.8.1.2    14:48:13    4/28/92    ]
  607.   
  608.   This is the explanatory document for John F. Haugh II's login replacement,
  609. ! release 3.  This document was last updated 4/28/92.
  610.   
  611.   This software is copyright 1988, 1989, 1990, 1991, 1992, John F. Haugh II.
  612.   All rights reserved.  Use, duplication and disclosure is permitted according
  613. --- 1,7 ----
  614. ! [    @(#)README    3.8.1.4    11:05:55    10/10/92    ]
  615.   
  616.   This is the explanatory document for John F. Haugh II's login replacement,
  617. ! release 3.  This document was last updated 10/10/92.
  618.   
  619.   This software is copyright 1988, 1989, 1990, 1991, 1992, John F. Haugh II.
  620.   All rights reserved.  Use, duplication and disclosure is permitted according
  621. ***************
  622. *** 14,26 ****
  623.   
  624.   This source code is currently archived on ftp.cs.widener.edu in the
  625.   directory pub/src/adm.  The file name is "shadow" followed by the
  626. ! version number.
  627.   
  628.   THIS SOFTWARE IS BEING DISTRIBUTED AS-IS.  THE AUTHORS DISCLAIM ALL
  629.   LIABILITY FOR ANY CONSEQUENCES OF USE.  THE USER IS SOLELY RESPONSIBLE
  630.   FOR THE MAINTENANCE OF THIS SOFTWARE PACKAGE.  THE AUTHORS ARE UNDER NO
  631.   OBLIGATION TO PROVIDE MODIFICATIONS OR IMPROVEMENTS.  THE USER IS
  632. ! ENCOURAGE TO TAKE ANY AND ALL STEPS NEEDED TO PROTECT AGAINST ACCIDENTAL
  633.   LOSS OF INFORMATION OR MACHINE RESOURCES.
  634.   
  635.   Special thanks are due to Chip Rosenthal for his fine testing efforts;
  636. --- 14,27 ----
  637.   
  638.   This source code is currently archived on ftp.cs.widener.edu in the
  639.   directory pub/src/adm.  The file name is "shadow" followed by the
  640. ! version number.  You may contact the author, John F. Haugh, II, at
  641. ! jfh@rpp386.cactus.org if you have any questions regarding this package.
  642.   
  643.   THIS SOFTWARE IS BEING DISTRIBUTED AS-IS.  THE AUTHORS DISCLAIM ALL
  644.   LIABILITY FOR ANY CONSEQUENCES OF USE.  THE USER IS SOLELY RESPONSIBLE
  645.   FOR THE MAINTENANCE OF THIS SOFTWARE PACKAGE.  THE AUTHORS ARE UNDER NO
  646.   OBLIGATION TO PROVIDE MODIFICATIONS OR IMPROVEMENTS.  THE USER IS
  647. ! ENCOURAGED TO TAKE ANY AND ALL STEPS NEEDED TO PROTECT AGAINST ACCIDENTAL
  648.   LOSS OF INFORMATION OR MACHINE RESOURCES.
  649.   
  650.   Special thanks are due to Chip Rosenthal for his fine testing efforts;
  651. ***************
  652. *** 52,61 ****
  653. --- 53,75 ----
  654.       been added.  The man pages for these commands have been written
  655.       as well.
  656.   
  657. +     User-defined authentication has been added.  This allows you to
  658. +     write programs to replace the password authentication method
  659. +     which uses the crypt() function.
  660.   Warning:
  661.       The newuser command will be removed in a later release.
  662.       The libsec.a library will be removed in a later release.
  663.   
  664. + This software is described in the 3rd USENIX Security Symposium
  665. + proceedings.  These proceedings are available from
  666. +     USENIX Association
  667. +     2560 Ninth Street, Suite 215
  668. +     Berkeley, CA 94710
  669. + The current price is $30 for USENIX members and $39 for non-members.
  670.   Begin by reading and editing the config.h file.  All options are selected
  671.   by using #define's.  A brief description for each available option appears
  672.   below.  You may want to print this file out as it is LONG and you will
  673. ***************
  674. *** 62,68 ****
  675.   need to refer to it while editting config.h.  You will also have to edit
  676.   the Makefile.  The possible differences are documented there.  Pay close
  677.   attention to the install: rule.  Login now runs on about 30 different
  678. ! varieties of UNIX that I have been made aware of.
  679.   
  680.   Note that there are MANY options.  As distributed most options are turned
  681.   on, which produces a really nice package.  This is the system as used on
  682. --- 76,86 ----
  683.   need to refer to it while editting config.h.  You will also have to edit
  684.   the Makefile.  The possible differences are documented there.  Pay close
  685.   attention to the install: rule.  Login now runs on about 30 different
  686. ! varieties of UNIX that I have been made aware of.  If you have any qualms,
  687. ! you should run "make save" before running "make install".  If something
  688. ! breaks you can use "make restore" to put things back.  In any case, you
  689. ! should have a recent system backup as the potential for serious damage
  690. ! exists.
  691.   
  692.   Note that there are MANY options.  As distributed most options are turned
  693.   on, which produces a really nice package.  This is the system as used on
  694. ***************
  695. *** 70,76 ****
  696.   selected at run time.  You should refer to the login.5 manual page for
  697.   more information regarding these options.
  698.   
  699. ! There are several files which you may have to replace.  If you system has
  700.   a lastlog.h file, you should replace the one which I provide with your
  701.   system version.  The pwd.h file that is produced by "make" must agree
  702.   exactly with the system supplied version.  You should re-arrange the
  703. --- 88,94 ----
  704.   selected at run time.  You should refer to the login.5 manual page for
  705.   more information regarding these options.
  706.   
  707. ! There are several files which you may have to replace.  If your system has
  708.   a lastlog.h file, you should replace the one which I provide with your
  709.   system version.  The pwd.h file that is produced by "make" must agree
  710.   exactly with the system supplied version.  You should re-arrange the
  711. ***************
  712. *** 96,101 ****
  713. --- 114,122 ----
  714.   
  715.       Select this option by defining the SHADOWPWD macro.
  716.   
  717. +     This feature is optional, but only certain commands may
  718. +     be compiled with this option disabled.
  719.   Shadow Group Files -
  720.       This option utilizes an alternate, non-readable file to
  721.       contain encrypted group passwords and group administrator
  722. ***************
  723. *** 106,112 ****
  724.       or deleting members and changing the group password.
  725.   
  726.       Select this option by defining the SHADOWGRP macro.  You
  727. !     must also create an emptry /etc/gshadow file.
  728.   
  729.   DBM Password Files -
  730.       This option utilizes the DBM database access routines to
  731. --- 127,134 ----
  732.       or deleting members and changing the group password.
  733.   
  734.       Select this option by defining the SHADOWGRP macro.  You
  735. !     must also create an emptry /etc/gshadow file.  You must
  736. !     select the SHADOWPWD option if you select SHADOWGRP.
  737.   
  738.   DBM Password Files -
  739.       This option utilizes the DBM database access routines to
  740. Index: chfn.c
  741. *** chfn.c.old    Sat Oct 10 11:13:38 1992
  742. --- chfn.c    Sat Oct 10 11:13:37 1992
  743. ***************
  744. *** 1,5 ****
  745.   /*
  746. !  * Copyright 1989, 1990, 1991, John F. Haugh II
  747.    * All rights reserved.
  748.    *
  749.    * Permission is granted to copy and create derivative works for any
  750. --- 1,5 ----
  751.   /*
  752. !  * Copyright 1989, 1990, 1991, 1992, John F. Haugh II
  753.    * All rights reserved.
  754.    *
  755.    * Permission is granted to copy and create derivative works for any
  756. ***************
  757. *** 7,12 ****
  758. --- 7,15 ----
  759.    * in all copies of source code, or included in human readable form
  760.    * and conspicuously displayed on all copies of object code or
  761.    * distribution media.
  762. +  *
  763. +  * This software is provided on an AS-IS basis and the author makes
  764. +  * no warrantee of any kind.
  765.    */
  766.   
  767.   #include <sys/types.h>
  768. ***************
  769. *** 15,21 ****
  770.   #include <signal.h>
  771.   
  772.   #ifndef    lint
  773. ! static    char    sccsid[] = "@(#)chfn.c    3.8    11:59:27    12/28/91";
  774.   #endif
  775.   
  776.   /*
  777. --- 18,24 ----
  778.   #include <signal.h>
  779.   
  780.   #ifndef    lint
  781. ! static    char    sccsid[] = "@(#)chfn.c    3.9    13:02:17    7/27/92";
  782.   #endif
  783.   
  784.   /*
  785. ***************
  786. *** 42,51 ****
  787.   #define    LOG_WARN LOG_WARNING
  788.   #endif
  789.   #endif
  790. ! #ifdef    USE_RLIMIT
  791.   #include <sys/resource.h>
  792.   
  793. ! struct    rlimit    rlimit_fsize = { RLIM_INFINITY, RLIM_INFINIT };
  794.   #endif
  795.   
  796.   /*
  797. --- 45,54 ----
  798.   #define    LOG_WARN LOG_WARNING
  799.   #endif
  800.   #endif
  801. ! #ifdef    HAVE_RLIMIT
  802.   #include <sys/resource.h>
  803.   
  804. ! struct    rlimit    rlimit_fsize = { RLIM_INFINITY, RLIM_INFINITY };
  805.   #endif
  806.   
  807.   /*
  808. Index: chsh.c
  809. *** chsh.c.old    Sat Oct 10 11:13:54 1992
  810. --- chsh.c    Sat Oct 10 11:13:53 1992
  811. ***************
  812. *** 1,5 ****
  813.   /*
  814. !  * Copyright 1989, 1990, 1991, John F. Haugh II
  815.    * All rights reserved.
  816.    *
  817.    * Permission is granted to copy and create derivative works for any
  818. --- 1,5 ----
  819.   /*
  820. !  * Copyright 1989, 1990, 1991, 1992, John F. Haugh II
  821.    * All rights reserved.
  822.    *
  823.    * Permission is granted to copy and create derivative works for any
  824. ***************
  825. *** 7,12 ****
  826. --- 7,15 ----
  827.    * in all copies of source code, or included in human readable form
  828.    * and conspicuously displayed on all copies of object code or
  829.    * distribution media.
  830. +  *
  831. +  * This software is provided on an AS-IS basis and the author makes
  832. +  * no warrantee of any kind.
  833.    */
  834.   
  835.   #include <sys/types.h>
  836. ***************
  837. *** 15,21 ****
  838.   #include <signal.h>
  839.   
  840.   #ifndef    lint
  841. ! static    char    sccsid[] = "@(#)chsh.c    3.7    11:58:57    12/28/91";
  842.   #endif
  843.   
  844.   /*
  845. --- 18,24 ----
  846.   #include <signal.h>
  847.   
  848.   #ifndef    lint
  849. ! static    char    sccsid[] = "@(#)chsh.c    3.8    13:02:23    7/27/92";
  850.   #endif
  851.   
  852.   /*
  853. ***************
  854. *** 42,51 ****
  855.   #define    LOG_WARN LOG_WARNING
  856.   #endif
  857.   #endif
  858. ! #ifdef    USE_RLIMIT
  859.   #include <sys/resource.h>
  860.   
  861. ! struct    rlimit    rlimit_fsize = { RLIM_INFINITY, RLIM_INFINIT };
  862.   #endif
  863.   
  864.   /*
  865. --- 45,54 ----
  866.   #define    LOG_WARN LOG_WARNING
  867.   #endif
  868.   #endif
  869. ! #ifdef    HAVE_RLIMIT
  870.   #include <sys/resource.h>
  871.   
  872. ! struct    rlimit    rlimit_fsize = { RLIM_INFINITY, RLIM_INFINITY };
  873.   #endif
  874.   
  875.   /*
  876. ***************
  877. *** 71,82 ****
  878.   #endif
  879.   
  880.   /*
  881. !  * #defines for messages.  This facilities foreign language conversion
  882.    * since all messages are defined right here.
  883.    */
  884.   
  885.   #define    USAGE        "Usage: %s [ -s shell ] [ name ]\n"
  886. ! #define    WHOAREYOU    "%s: Cannot determine you user name.\n"
  887.   #define    UNKUSER        "%s: Unknown user %s\n"
  888.   #define    NOPERM        "You may not change the shell for %s.\n"
  889.   #define    NOPERM2        "can't change shell for `%s'\n"
  890. --- 74,85 ----
  891.   #endif
  892.   
  893.   /*
  894. !  * #defines for messages.  This facilitates foreign language conversion
  895.    * since all messages are defined right here.
  896.    */
  897.   
  898.   #define    USAGE        "Usage: %s [ -s shell ] [ name ]\n"
  899. ! #define    WHOAREYOU    "%s: Cannot determine your user name.\n"
  900.   #define    UNKUSER        "%s: Unknown user %s\n"
  901.   #define    NOPERM        "You may not change the shell for %s.\n"
  902.   #define    NOPERM2        "can't change shell for `%s'\n"
  903. ***************
  904. *** 184,190 ****
  905.   /*
  906.    * chsh - this command controls changes to the user's shell
  907.    *
  908. !  *    The only suppoerted option is -s which permits the
  909.    *    the login shell to be set from the command line.
  910.    */
  911.   
  912. --- 187,193 ----
  913.   /*
  914.    * chsh - this command controls changes to the user's shell
  915.    *
  916. !  *    The only supported option is -s which permits the
  917.    *    the login shell to be set from the command line.
  918.    */
  919.   
  920. Index: config.h.svr4
  921. *** config.h.svr4.old    Sat Oct 10 11:14:10 1992
  922. --- config.h.svr4    Sat Oct 10 11:14:10 1992
  923. ***************
  924. *** 0 ****
  925. --- 1,129 ----
  926. + /*
  927. +  * Copyright 1989, 1990, 1991, 1992, John F. Haugh II
  928. +  * All rights reserved.
  929. +  *
  930. +  * Permission is granted to copy and create derivative works for any
  931. +  * non-commercial purpose, provided this copyright notice is preserved
  932. +  * in all copies of source code, or included in human readable form
  933. +  * and conspicuously displayed on all copies of object code or
  934. +  * distribution media.
  935. +  *
  936. +  * This software is provided on an AS-IS basis and the author makes
  937. +  * no warrantee of any kind.
  938. +  */
  939. + /*
  940. +  * Configuration file for login.
  941. +  *
  942. +  *    @(#)config.h.svr4    3.2    13:02:27    7/27/92    (SVR4)
  943. +  */
  944. + /*
  945. +  * Pathname to the run-time configuration definitions file.
  946. +  */
  947. + #define LOGINDEFS "/etc/login.defs"
  948. + /*
  949. +  * Define SHADOWPWD to use shadow [ unreadable ] password file.
  950. +  * Release 3 has a requirement that SHADOWPWD always be defined.
  951. +  */
  952. + #define    SHADOWPWD
  953. + /*
  954. +  * Define AUTOSHADOW to have root always copy sp_pwdp to pw_passwd
  955. +  * for getpwuid() and getpwnam().  This provides compatibility for
  956. +  * privileged applications which are shadow-ignorant.  YOU ARE
  957. +  * ENCOURAGED TO NOT USE THIS OPTION UNLESS ABSOLUTELY NECESSARY.
  958. +  */
  959. + #define    AUTOSHADOW
  960. + /*
  961. +  * Define SHADOWGRP to user shadowed group files.  This feature adds
  962. +  * the concept of a group administrator.
  963. +  */
  964. + /* #define    SHADOWGRP    /**/
  965. + /*
  966. +  * Define DOUBLESIZE to use 16 character passwords
  967. +  */
  968. + #define DOUBLESIZE
  969. + /*
  970. +  * Define AGING if you want the password aging checks made.
  971. +  * Release 3 has a requirement that AGING always be defined.
  972. +  */
  973. + #define    AGING
  974. + /*
  975. +  * Pick your version of DBM.  If you define either DBM or NDBM, you must
  976. +  * define GETPWENT.  If you define NDBM you must define GETGRENT as well.
  977. +  */
  978. + /* #define    DBM    /**/
  979. + /* #define    NDBM    /**/
  980. + /*
  981. +  * Define USE_SYSLOG if you want to have SYSLOG functions included in your code.
  982. +  */
  983. + #undef    USE_SYSLOG
  984. + /*
  985. +  * Enable RLOGIN to support the "-r" and "-h" options.
  986. +  * Also enable UT_HOST if your /etc/utmp provides for a host name.
  987. +  */
  988. + #define RLOGIN
  989. + #define UT_HOST
  990. + /*
  991. +  * Select one of the following
  992. +  */
  993. + /* #define DIR_XENIX    /* include <sys/ndir.h>, use (struct direct)    */
  994. + /* #define DIR_BSD    /* include <ndir.h>, use (struct direct)    */
  995. + #define DIR_SYSV    /* include <dirent.h>, use (struct dirent)    */
  996. + /*
  997. +  * Various system environment definitions.
  998. +  */
  999. + #undef    HAVE_ULIMIT    /* Define if your UNIX supports ulimit()    */
  1000. + #define    HAVE_RLIMIT    /* Define if your UNIX supports setrlimit()    */
  1001. + #define    GETPWENT    /* Define if you want my GETPWENT(3) routines    */
  1002. + #undef    GETGRENT    /* Define if you want my GETGRENT(3) routines    */
  1003. + #undef    NEED_AL64    /* Define if library does not include a64l()    */
  1004. + #undef    NEED_MKDIR    /* Define if system does not have mkdir()    */
  1005. + #undef    NEED_RMDIR    /* Define if system does not have rmdir()    */
  1006. + #undef    NEED_RENAME    /* Define if system does not have rename()    */
  1007. + #undef    NEED_STRSTR    /* Define if library does not include strstr()    */
  1008. + #define    SIGTYPE    void    /* Type returned by signal()                    */
  1009. + /*
  1010. +  * These definitions MUST agree with the values defined in <pwd.h>.
  1011. +  */
  1012. + #undef    BSD_QUOTA    /* the pw_quota field exists */
  1013. + #define    ATT_AGE        /* the pw_age field exists */
  1014. + #define    ATT_COMMENT    /* the pw_comment field exists */
  1015. + /*
  1016. +  * Define NDEBUG for production versions
  1017. +  */
  1018. + #define    NDEBUG
  1019. + /*
  1020. +  * Define PWDFILE and GRPFILE to the names of the password and
  1021. +  * group files.
  1022. +  */
  1023. + #define    PWDFILE    "/etc/passwd"
  1024. + #define    GRPFILE    "/etc/group"
  1025. Index: config.h
  1026. *** config.h.old    Sat Oct 10 11:14:29 1992
  1027. --- config.h    Sat Oct 10 11:14:28 1992
  1028. ***************
  1029. *** 12,18 ****
  1030.   /*
  1031.    * Configuration file for login.
  1032.    *
  1033. !  *    @(#)config.h    3.16    09:42:44    1/20/92
  1034.    */
  1035.   
  1036.   
  1037. --- 12,18 ----
  1038.   /*
  1039.    * Configuration file for login.
  1040.    *
  1041. !  *    @(#)config.h    3.16.1.1    10:52:06    10/10/92
  1042.    */
  1043.   
  1044.   
  1045. ***************
  1046. *** 40,46 ****
  1047.   
  1048.   /*
  1049.    * Define SHADOWGRP to user shadowed group files.  This feature adds
  1050. !  * the concept of a group administrator.
  1051.    */
  1052.   
  1053.   /* #define    SHADOWGRP /**/
  1054. --- 40,47 ----
  1055.   
  1056.   /*
  1057.    * Define SHADOWGRP to user shadowed group files.  This feature adds
  1058. !  * the concept of a group administrator.  You MUST NOT define this
  1059. !  * if you disable SHADOWPWD.
  1060.    */
  1061.   
  1062.   /* #define    SHADOWGRP /**/
  1063. Index: copydir.c
  1064. *** copydir.c.old    Sat Oct 10 11:14:47 1992
  1065. --- copydir.c    Sat Oct 10 11:14:46 1992
  1066. ***************
  1067. *** 1,6 ****
  1068.   /*
  1069. !  * Copyright 1991, John F. Haugh II
  1070. !  * An unpublished work.
  1071.    * All rights reserved.
  1072.    *
  1073.    * Permission is granted to copy and create derivative works for any
  1074. --- 1,5 ----
  1075.   /*
  1076. !  * Copyright 1991, 1992, John F. Haugh II
  1077.    * All rights reserved.
  1078.    *
  1079.    * Permission is granted to copy and create derivative works for any
  1080. ***************
  1081. *** 8,18 ****
  1082. --- 7,23 ----
  1083.    * in all copies of source code, or included in human readable form
  1084.    * and conspicuously displayed on all copies of object code or
  1085.    * distribution media.
  1086. +  *
  1087. +  * This software is provided on an AS-IS basis and the author makes
  1088. +  * no warrantee of any kind.
  1089.    */
  1090.   
  1091.   #include <sys/types.h>
  1092.   #include <sys/stat.h>
  1093.   #include "config.h"
  1094. + #if defined(DIR_XENIX) || defined(DIR_BSD) || defined(DIR_SYSV)
  1095.   #ifdef DIR_XENIX
  1096.   #include <sys/ndir.h>
  1097.   #define DIRECT direct
  1098. ***************
  1099. *** 29,35 ****
  1100.   #include <stdio.h>
  1101.   
  1102.   #ifndef lint
  1103. ! static    char    sccsid[] = "@(#)copydir.c    3.1    10:09:26    6/13/91";
  1104.   #endif
  1105.   
  1106.   #ifndef    S_ISDIR
  1107. --- 34,40 ----
  1108.   #include <stdio.h>
  1109.   
  1110.   #ifndef lint
  1111. ! static    char    sccsid[] = "@(#)copydir.c    3.2    10:52:09    10/10/92";
  1112.   #endif
  1113.   
  1114.   #ifndef    S_ISDIR
  1115. ***************
  1116. *** 124,134 ****
  1117.    */
  1118.   
  1119.   int
  1120. ! copy_tree (src_root, dst_root, uid, gid)
  1121.   char    *src_root;
  1122.   char    *dst_root;
  1123.   int    uid;
  1124.   int    gid;
  1125.   {
  1126.       char    src_name[BUFSIZ];
  1127.       char    dst_name[BUFSIZ];
  1128. --- 129,141 ----
  1129.    */
  1130.   
  1131.   int
  1132. ! copy_tree (src_root, dst_root, uid, gid, ouid, ogid)
  1133.   char    *src_root;
  1134.   char    *dst_root;
  1135.   int    uid;
  1136.   int    gid;
  1137. + int    ouid;
  1138. + int    ogid;
  1139.   {
  1140.       char    src_name[BUFSIZ];
  1141.       char    dst_name[BUFSIZ];
  1142. ***************
  1143. *** 370,372 ****
  1144. --- 377,381 ----
  1145.   
  1146.       return err ? -1:0;
  1147.   }
  1148. + #endif    /* defined(DIR_XXX) */
  1149. Index: env.c
  1150. *** env.c.old    Sat Oct 10 11:15:02 1992
  1151. --- env.c    Sat Oct 10 11:15:02 1992
  1152. ***************
  1153. *** 1,9 ****
  1154.   /*
  1155. !  * Copyright 1989, 1990, John F. Haugh II
  1156.    * All rights reserved.
  1157.    *
  1158. !  * Use, duplication, and disclosure prohibited without
  1159. !  * the express written permission of the author.
  1160.    */
  1161.   
  1162.   #include <stdio.h>
  1163. --- 1,15 ----
  1164.   /*
  1165. !  * Copyright 1989, 1990, 1992, John F. Haugh II
  1166.    * All rights reserved.
  1167.    *
  1168. !  * Permission is granted to copy and create derivative works for any
  1169. !  * non-commercial purpose, provided this copyright notice is preserved
  1170. !  * in all copies of source code, or included in human readable form
  1171. !  * and conspicuously displayed on all copies of object code or
  1172. !  * distribution media.
  1173. !  *
  1174. !  * This software is provided on an AS-IS basis and the author makes
  1175. !  * no warrantee of any kind.
  1176.    */
  1177.   
  1178.   #include <stdio.h>
  1179. ***************
  1180. *** 16,22 ****
  1181.   #endif
  1182.   
  1183.   #ifndef    lint
  1184. ! static    char    _sccsid[] = "@(#)env.c    2.2    19:23:43    7/29/90";
  1185.   #endif
  1186.   
  1187.   extern    char    **environ;
  1188. --- 22,28 ----
  1189.   #endif
  1190.   
  1191.   #ifndef    lint
  1192. ! static    char    _sccsid[] = "@(#)env.c    3.1    13:00:03    7/27/92";
  1193.   #endif
  1194.   
  1195.   extern    char    **environ;
  1196. ***************
  1197. *** 35,41 ****
  1198.       (char *) 0
  1199.   };
  1200.   
  1201. ! void    addenv (entry)
  1202.   char    *entry;
  1203.   {
  1204.       char    *cp;
  1205. --- 41,52 ----
  1206.       (char *) 0
  1207.   };
  1208.   
  1209. ! /*
  1210. !  * addenv - add a new environmental entry
  1211. !  */
  1212. ! void
  1213. ! addenv (entry)
  1214.   char    *entry;
  1215.   {
  1216.       char    *cp;
  1217. ***************
  1218. *** 64,70 ****
  1219.       }
  1220.   }
  1221.   
  1222. ! void    setenv (argc, argv)
  1223.   int    argc;
  1224.   char    **argv;
  1225.   {
  1226. --- 75,86 ----
  1227.       }
  1228.   }
  1229.   
  1230. ! /*
  1231. !  * setenv - copy command line arguments into the environment
  1232. !  */
  1233. ! void
  1234. ! setenv (argc, argv)
  1235.   int    argc;
  1236.   char    **argv;
  1237.   {
  1238. Index: getdef.c
  1239. *** getdef.c.old    Sat Oct 10 11:15:17 1992
  1240. --- getdef.c    Sat Oct 10 11:15:17 1992
  1241. ***************
  1242. *** 7,16 ****
  1243.    * in all copies of source code, or included in human readable form
  1244.    * and conspicuously displayed on all copies of object code or
  1245.    * distribution media.
  1246.    */
  1247.   
  1248.   #ifndef lint
  1249. ! static    char    sccsid[] = "@(#)getdef.c    3.6    14:49:39    4/28/92";
  1250.   #endif
  1251.   
  1252.   #include <stdio.h>
  1253. --- 7,19 ----
  1254.    * in all copies of source code, or included in human readable form
  1255.    * and conspicuously displayed on all copies of object code or
  1256.    * distribution media.
  1257. +  *
  1258. +  * This software is provided on an AS-IS basis and the author makes
  1259. +  * no warrantee of any kind.
  1260.    */
  1261.   
  1262.   #ifndef lint
  1263. ! static    char    sccsid[] = "@(#)getdef.c    3.7    13:02:29    7/27/92";
  1264.   #endif
  1265.   
  1266.   #include <stdio.h>
  1267. ***************
  1268. *** 53,58 ****
  1269. --- 56,62 ----
  1270.       { "ENV_TZ",            NULL },
  1271.       { "ERASECHAR",            NULL },
  1272.       { "FAILLOG_ENAB",        NULL },
  1273. +     { "FAIL_DELAY",            NULL },
  1274.       { "FTMP_FILE",            NULL },
  1275.       { "HUSHLOGIN_FILE",        NULL },
  1276.       { "ISSUE_FILE_ENAB",        NULL },
  1277. Index: lastlog.h
  1278. *** lastlog.h.old    Sat Oct 10 11:15:32 1992
  1279. --- lastlog.h    Sat Oct 10 11:15:32 1992
  1280. ***************
  1281. *** 1,15 ****
  1282.   /*
  1283. !  * Copyright 1989, 1990, John F. Haugh II
  1284.    * All rights reserved.
  1285.    *
  1286. !  * Use, duplication, and disclosure prohibited without
  1287. !  * the express written permission of the author.
  1288.    */
  1289.   
  1290.   /*
  1291.    * lastlog.h - structure of lastlog file
  1292.    *
  1293. !  *    @(#)lastlog.h    3.1    11:30:22    12/3/91
  1294.    *
  1295.    *    This file defines a lastlog file structure which should be sufficient
  1296.    *    to hold the information required by login.  It should only be used if
  1297. --- 1,21 ----
  1298.   /*
  1299. !  * Copyright 1989, 1990, 1992, John F. Haugh II
  1300.    * All rights reserved.
  1301.    *
  1302. !  * Permission is granted to copy and create derivative works for any
  1303. !  * non-commercial purpose, provided this copyright notice is preserved
  1304. !  * in all copies of source code, or included in human readable form
  1305. !  * and conspicuously displayed on all copies of object code or
  1306. !  * distribution media.
  1307. !  *
  1308. !  * This software is provided on an AS-IS basis and the author makes
  1309. !  * not warrantee of any kind.
  1310.    */
  1311.   
  1312.   /*
  1313.    * lastlog.h - structure of lastlog file
  1314.    *
  1315. !  *    @(#)lastlog.h    3.1.1.1    13:02:32    7/27/92
  1316.    *
  1317.    *    This file defines a lastlog file structure which should be sufficient
  1318.    *    to hold the information required by login.  It should only be used if
  1319. ***************
  1320. *** 18,22 ****
  1321. --- 24,32 ----
  1322.   
  1323.   struct    lastlog    {
  1324.       time_t    ll_time;
  1325. + #ifdef SVR4
  1326. +     char    ll_line[24];
  1327. + #else
  1328.       char    ll_line[8];
  1329. + #endif
  1330.   };
  1331. Index: lmain.c
  1332. *** lmain.c.old    Sat Oct 10 11:15:50 1992
  1333. --- lmain.c    Sat Oct 10 11:15:48 1992
  1334. ***************
  1335. *** 7,12 ****
  1336. --- 7,15 ----
  1337.    * in all copies of source code, or included in human readable form
  1338.    * and conspicuously displayed on all copies of object code or
  1339.    * distribution media.
  1340. +  *
  1341. +  * This software is provided on an AS-IS basis and the author makes
  1342. +  * no warrantee of any kind.
  1343.    */
  1344.   
  1345.   #include "config.h"
  1346. ***************
  1347. *** 14,20 ****
  1348. --- 17,27 ----
  1349.   #include <sys/stat.h>
  1350.   #include <stdio.h>
  1351.   #include "pwd.h"
  1352. + #ifdef SVR4
  1353. + #include <utmpx.h>
  1354. + #else
  1355.   #include <utmp.h>
  1356. + #endif
  1357.   #include <time.h>
  1358.   #include <signal.h>
  1359.   #ifndef    BSD
  1360. ***************
  1361. *** 39,45 ****
  1362. --- 46,55 ----
  1363.   
  1364.   #include "lastlog.h"
  1365.   #include "faillog.h"
  1366. + #ifdef    SHADOWPWD
  1367.   #include "shadow.h"
  1368. + #endif
  1369. + #include "pwauth.h"
  1370.   
  1371.   #if !defined(BSD) && !defined(SUN)
  1372.   #define    bzero(a,n)    memset(a, 0, n);
  1373. ***************
  1374. *** 54,60 ****
  1375.   #endif
  1376.   
  1377.   #ifndef    lint
  1378. ! static    char    sccsid[] = "@(#)lmain.c    3.19    20:36:55    3/7/92";
  1379.   #endif
  1380.   
  1381.                       /* danger - side effects */
  1382. --- 64,70 ----
  1383.   #endif
  1384.   
  1385.   #ifndef    lint
  1386. ! static    char    sccsid[] = "@(#)lmain.c    3.21    13:40:20    7/31/92";
  1387.   #endif
  1388.   
  1389.                       /* danger - side effects */
  1390. ***************
  1391. *** 66,72 ****
  1392.   #endif
  1393.   
  1394.   struct    passwd    pwent;
  1395. ! struct    utmp    utent;
  1396.   struct    lastlog    lastlog;
  1397.   int    pflg;
  1398.   int    rflg;
  1399. --- 76,86 ----
  1400.   #endif
  1401.   
  1402.   struct    passwd    pwent;
  1403. ! #ifdef SVR4
  1404. ! struct    utmpx    utent, failent;
  1405. ! #else
  1406. ! struct    utmp    utent, failent;
  1407. ! #endif
  1408.   struct    lastlog    lastlog;
  1409.   int    pflg;
  1410.   int    rflg;
  1411. ***************
  1412. *** 121,126 ****
  1413. --- 135,141 ----
  1414.   extern    int    optind;
  1415.   extern    char    *optarg;
  1416.   extern    char    **environ;
  1417. + extern    int    pw_auth();
  1418.   
  1419.   #ifdef HAVE_ULIMIT
  1420.   extern    long    ulimit();
  1421. ***************
  1422. *** 136,146 ****
  1423.   
  1424.   struct    faillog    faillog;
  1425.   
  1426. - struct    utmp    failent;
  1427.   #define    NO_SHADOW    "no shadow password for `%s' on `%s'\n"
  1428.   #define    BAD_PASSWD    "invalid password for `%s' on `%s'\n"
  1429.   #define    BAD_DIALUP    "invalid dialup password for `%s' on `%s'\n"
  1430.   #define    BAD_TIME    "invalid login time for `%s' on `%s'\n"
  1431.   #define    BAD_ROOT_LOGIN    "ILLEGAL ROOT LOGIN ON TTY `%s'\n"
  1432.   #define    ROOT_LOGIN    "ROOT LOGIN ON TTY `%s'\n"
  1433. --- 151,161 ----
  1434.   
  1435.   struct    faillog    faillog;
  1436.   
  1437.   #define    NO_SHADOW    "no shadow password for `%s' on `%s'\n"
  1438. + #define    BAD_PASSWD_HOST    "invalid password for `%s' on `%s' from `%s'\n"
  1439.   #define    BAD_PASSWD    "invalid password for `%s' on `%s'\n"
  1440.   #define    BAD_DIALUP    "invalid dialup password for `%s' on `%s'\n"
  1441. + #define    BAD_TIME_HOST    "invalid login time for `%s' on `%s' from `%s'\n"
  1442.   #define    BAD_TIME    "invalid login time for `%s' on `%s'\n"
  1443.   #define    BAD_ROOT_LOGIN    "ILLEGAL ROOT LOGIN ON TTY `%s'\n"
  1444.   #define    ROOT_LOGIN    "ROOT LOGIN ON TTY `%s'\n"
  1445. ***************
  1446. *** 147,152 ****
  1447. --- 162,168 ----
  1448.   #define    FAILURE_CNT    "exceeded failure limit for `%s' on `%s'\n"
  1449.   #define    NOT_A_TTY    "not a tty\n"
  1450.   #define    NOT_ROOT    "-r or -f flag and not ROOT on `%s'\n"
  1451. + #define AUTHFAIL    "authentication failed for user `%s'\n"
  1452.   
  1453.   /*
  1454.    * usage - print login command usage and exit
  1455. ***************
  1456. *** 260,267 ****
  1457. --- 276,285 ----
  1458.       char    *tmp;
  1459.       char    buff[128];
  1460.       struct    passwd    *pwd;
  1461. + #ifdef    SHADOWPWD
  1462.       struct    spwd    *spwd;
  1463.       struct    spwd    *getspnam();
  1464. + #endif
  1465.   
  1466.       /*
  1467.        * Some quick initialization.
  1468. ***************
  1469. *** 339,354 ****
  1470.           exit (1);
  1471.       }
  1472.   
  1473.   #ifdef    USE_SYSLOG
  1474.       openlog (Prog, LOG_PID|LOG_CONS|LOG_NOWAIT, LOG_AUTH);
  1475.   #endif
  1476.   
  1477. -     if (! isatty (0) || ! isatty (1) || ! isatty (2)) {
  1478. - #ifdef    USE_SYSLOG
  1479. -         closelog ();
  1480. - #endif
  1481. -         exit (1);        /* must be a terminal */
  1482. -     }
  1483.   #ifndef    BSD
  1484.       (void) ioctl (0, TCGETA, &termio); /* get terminal characteristics */
  1485.   
  1486. --- 357,369 ----
  1487.           exit (1);
  1488.       }
  1489.   
  1490. +     if (! isatty (0) || ! isatty (1) || ! isatty (2))
  1491. +         exit (1);        /* must be a terminal */
  1492.   #ifdef    USE_SYSLOG
  1493.       openlog (Prog, LOG_PID|LOG_CONS|LOG_NOWAIT, LOG_AUTH);
  1494.   #endif
  1495.   
  1496.   #ifndef    BSD
  1497.       (void) ioctl (0, TCGETA, &termio); /* get terminal characteristics */
  1498.   
  1499. ***************
  1500. *** 427,434 ****
  1501. --- 442,461 ----
  1502.           if (rflg || fflg)
  1503.               usage ();
  1504.   
  1505. + #ifdef SVR4
  1506. +         /*
  1507. +          * The "-h" option can't be used with a command-line username,
  1508. +          * because telnetd invokes us as: login -h host TERM=...
  1509. +          */
  1510. +         if (! hflg) {
  1511. +             STRFCPY (name, argv[optind]);
  1512. +             ++optind;
  1513. +         }
  1514. + #else
  1515.           STRFCPY (name, argv[optind]);
  1516.           ++optind;
  1517. + #endif
  1518.       }
  1519.   #ifdef SVR4
  1520.       /*
  1521. ***************
  1522. *** 474,479 ****
  1523. --- 501,507 ----
  1524.               pwent = *pwd;
  1525.   
  1526.           if (pwent.pw_name) {
  1527. + #ifdef    SHADOWPWD
  1528.               if (! (spwd = getspnam (name)))
  1529.   #ifdef    USE_SYSLOG
  1530.                   syslog (LOG_WARN, NO_SHADOW, name, tty);
  1531. ***************
  1532. *** 482,487 ****
  1533. --- 510,516 ----
  1534.   #endif
  1535.               else
  1536.                   pwent.pw_passwd = spwd->sp_pwdp;
  1537. + #endif    /* SHADOWPWD */
  1538.               failed = 0;    /* hasn't failed validation yet */
  1539.           } else
  1540.               failed = 1;    /* will never pass validation */
  1541. ***************
  1542. *** 496,504 ****
  1543.               goto have_name;
  1544.   #endif    /*RLOGIN*/
  1545.   
  1546.       /*
  1547.        * Get the user's password.  One will only be prompted for
  1548. !      * if the pw_passwd (or sp_passwd) field is non-blank.  It
  1549.        * will then be checked against the password entry, along
  1550.        * with other options which prevent logins.
  1551.        */
  1552. --- 525,543 ----
  1553.               goto have_name;
  1554.   #endif    /*RLOGIN*/
  1555.   
  1556. +         if (pwent.pw_name && pwent.pw_passwd[0] == '@') {
  1557. +             if (pw_auth (pwent.pw_passwd + 1, name, PW_LOGIN)) {
  1558. +                 failed = 1;
  1559. + #ifdef    USE_SYSLOG
  1560. +                 syslog (LOG_WARN, AUTHFAIL, name);
  1561. + #endif
  1562. +             }
  1563. +             goto auth_done;
  1564. +         }
  1565.       /*
  1566.        * Get the user's password.  One will only be prompted for
  1567. !      * if the pw_passwd (or sp_pwdp) field is non-blank.  It
  1568.        * will then be checked against the password entry, along
  1569.        * with other options which prevent logins.
  1570.        */
  1571. ***************
  1572. *** 505,511 ****
  1573.           cp = 0;
  1574.           if ((! pwent.pw_name || (strlen (pwent.pw_passwd) > 0))
  1575.                   && ! (cp = getpass ("Password:")))
  1576. !             continue;
  1577.   
  1578.           if (cp) {
  1579.               STRFCPY (pass, cp);
  1580. --- 544,550 ----
  1581.           cp = 0;
  1582.           if ((! pwent.pw_name || (strlen (pwent.pw_passwd) > 0))
  1583.                   && ! (cp = getpass ("Password:")))
  1584. !             goto again;
  1585.   
  1586.           if (cp) {
  1587.               STRFCPY (pass, cp);
  1588. ***************
  1589. *** 513,520 ****
  1590.           }
  1591.           if (! valid (pass, &pwent)) { /* check encrypted passwords */
  1592.   #ifdef    USE_SYSLOG
  1593. !             syslog (LOG_WARN, BAD_PASSWD, name, tty);
  1594. ! #endif
  1595.               failed = 1;
  1596.           }
  1597.           bzero (pass, sizeof pass);
  1598. --- 552,565 ----
  1599.           }
  1600.           if (! valid (pass, &pwent)) { /* check encrypted passwords */
  1601.   #ifdef    USE_SYSLOG
  1602. ! #ifdef UT_HOST
  1603. !             if (*(utent.ut_host))
  1604. !                 syslog (LOG_WARN, BAD_PASSWD_HOST, name, tty,
  1605. !                     utent.ut_host);
  1606. !             else
  1607. ! #endif /* UT_HOST */
  1608. !                 syslog (LOG_WARN, BAD_PASSWD, name, tty);
  1609. ! #endif /* USE_SYSLOG */
  1610.               failed = 1;
  1611.           }
  1612.           bzero (pass, sizeof pass);
  1613. ***************
  1614. *** 525,530 ****
  1615. --- 570,576 ----
  1616.            * been authenticated and so on.
  1617.            */
  1618.   
  1619. + auth_done:
  1620.   #ifdef    RLOGIN
  1621.   have_name:
  1622.   #endif
  1623. ***************
  1624. *** 544,551 ****
  1625.               ! isttytime (pwent.pw_name, tty, time ((time_t *) 0))
  1626.           ) {
  1627.   #ifdef    USE_SYSLOG
  1628.                   syslog (LOG_WARN, BAD_TIME, name, tty);
  1629. ! #endif
  1630.                   failed = 1;
  1631.           }
  1632.           if (! failed && pwent.pw_name && pwent.pw_uid == 0 &&
  1633. --- 590,603 ----
  1634.               ! isttytime (pwent.pw_name, tty, time ((time_t *) 0))
  1635.           ) {
  1636.   #ifdef    USE_SYSLOG
  1637. + #ifdef UT_HOST
  1638. +             if (*(utent.ut_host))
  1639. +                 syslog (LOG_WARN, BAD_TIME_HOST, name, tty,
  1640. +                     utent.ut_host);
  1641. +             else
  1642. + #endif    /* UT_HOST */
  1643.                   syslog (LOG_WARN, BAD_TIME, name, tty);
  1644. ! #endif    /* USE_SYSLOG */
  1645.                   failed = 1;
  1646.           }
  1647.           if (! failed && pwent.pw_name && pwent.pw_uid == 0 &&
  1648. ***************
  1649. *** 588,594 ****
  1650. --- 640,650 ----
  1651.                       STRFCPY (failent.ut_name, name);
  1652.                   else
  1653.                       STRFCPY (failent.ut_name, "UNKNOWN");
  1654. + #ifdef SVR4
  1655. +             gettimeofday (&(failent.ut_tv));
  1656. + #else
  1657.               time (&failent.ut_time);
  1658. + #endif
  1659.   #ifdef    USG_UTMP
  1660.               failent.ut_type = USER_PROCESS;
  1661.   #endif
  1662. ***************
  1663. *** 601,608 ****
  1664. --- 657,674 ----
  1665.   #endif
  1666.               exit (1);
  1667.           }
  1668. + again:
  1669.           bzero (name, sizeof name);
  1670.           bzero (pass, sizeof pass);
  1671. +         /*
  1672. +          * Wait a while (a la SVR4 /usr/bin/login) before attempting
  1673. +          * to login the user again.  If the earlier alarm occurs
  1674. +          * before the sleep() below completes, login will exit.
  1675. +          */
  1676. +         if (getdef_num ("FAIL_DELAY", 0))
  1677. +             sleep (getdef_num ("FAIL_DELAY", 0));
  1678.       }
  1679.       (void) alarm (0);        /* turn off alarm clock */
  1680.   
  1681. ***************
  1682. *** 643,650 ****
  1683. --- 709,720 ----
  1684.           subroot++;        /* say i was here again */
  1685.           endpwent ();        /* close all of the file which were */
  1686.           endgrent ();        /* open in the original rooted file */
  1687. + #ifdef    SHADOWPWD
  1688.           endspent ();        /* system.  they will be re-opened */
  1689. + #endif
  1690. + #ifdef    SHADOWGRP
  1691.           endsgent ();        /* in the new rooted file system */
  1692. + #endif
  1693.           goto top;        /* go do all this all over again */
  1694.       }
  1695.   
  1696. ***************
  1697. *** 652,657 ****
  1698. --- 722,728 ----
  1699.           log ();            /* give last login and log this one */
  1700.       setup (&pwent);            /* set UID, GID, HOME, etc ... */
  1701.   #ifdef    AGING
  1702. + #ifdef    SHADOWPWD
  1703.       if (spwd) {            /* check for age of password */
  1704.           if (expire (&pwent, spwd)) {
  1705.               spwd = getspnam (name);
  1706. ***************
  1707. *** 659,666 ****
  1708.               pwent = *pwd;
  1709.           }
  1710.       }
  1711.   #ifdef    ATT_AGE
  1712. !     else if (pwent.pw_age && pwent.pw_age[0]) {
  1713.           if (expire (&pwent, (void *) 0)) {
  1714.               pwd = getpwnam (name);
  1715.               pwent = *pwd;
  1716. --- 730,741 ----
  1717.               pwent = *pwd;
  1718.           }
  1719.       }
  1720. + #endif
  1721.   #ifdef    ATT_AGE
  1722. ! #ifdef    SHADOWPWD
  1723. !     else
  1724. ! #endif
  1725. !     if (pwent.pw_age && pwent.pw_age[0]) {
  1726.           if (expire (&pwent, (void *) 0)) {
  1727.               pwd = getpwnam (name);
  1728.               pwent = *pwd;
  1729. ***************
  1730. *** 676,682 ****
  1731. --- 751,761 ----
  1732.               printf ("Last login: %.19s on %s\n",
  1733.                   ctime (&lastlog.ll_time), lastlog.ll_line);
  1734.   #ifdef    AGING
  1735. + #ifdef    SHADOWPWD
  1736.           agecheck (&pwent, spwd);
  1737. + #else
  1738. +         agecheck (&pwent, (void *) 0);
  1739. + #endif
  1740.   #endif    /* AGING */
  1741.           mailcheck ();    /* report on the status of mail */
  1742.       }
  1743. ***************
  1744. *** 690,696 ****
  1745. --- 769,777 ----
  1746.   
  1747.       endpwent ();            /* stop access to password file */
  1748.       endgrent ();            /* stop access to group file */
  1749. + #ifdef    SHADOWPWD
  1750.       endspent ();            /* stop access to shadow passwd file */
  1751. + #endif
  1752.   #ifdef    SHADOWGRP
  1753.       endsgent ();            /* stop access to shadow group file */
  1754.   #endif
  1755. Index: log.c
  1756. *** log.c.old    Sat Oct 10 11:16:09 1992
  1757. --- log.c    Sat Oct 10 11:16:09 1992
  1758. ***************
  1759. *** 7,16 ****
  1760. --- 7,23 ----
  1761.    * in all copies of source code, or included in human readable form
  1762.    * and conspicuously displayed on all copies of object code or
  1763.    * distribution media.
  1764. +  *
  1765. +  * This software is provided on an AS-IS basis and the author makes
  1766. +  * no warrantee of any kind.
  1767.    */
  1768.   
  1769. + #ifdef SVR4
  1770. + #include <utmpx.h>
  1771. + #else
  1772.   #include <sys/types.h>
  1773.   #include <utmp.h>
  1774. + #endif
  1775.   #include "pwd.h"
  1776.   #include <fcntl.h>
  1777.   #include <time.h>
  1778. ***************
  1779. *** 25,31 ****
  1780.   #include "config.h"
  1781.   
  1782.   #ifndef    lint
  1783. ! static    char    sccsid[] = "@(#)log.c    3.3    20:37:03    3/7/92";
  1784.   #endif
  1785.   
  1786.   #include "lastlog.h"
  1787. --- 32,38 ----
  1788.   #include "config.h"
  1789.   
  1790.   #ifndef    lint
  1791. ! static    char    sccsid[] = "@(#)log.c    3.4    13:02:34    7/27/92";
  1792.   #endif
  1793.   
  1794.   #include "lastlog.h"
  1795. ***************
  1796. *** 38,44 ****
  1797. --- 45,55 ----
  1798.   #endif    /* SVR4 */
  1799.   #endif    /* LASTLOG_FILE */
  1800.   
  1801. + #ifdef SVR4
  1802. + extern    struct    utmpx    utent;
  1803. + #else
  1804.   extern    struct    utmp    utent;
  1805. + #endif
  1806.   extern    struct    passwd    pwent;
  1807.   extern    struct    lastlog    lastlog;
  1808.   extern    char    **environ;
  1809. Index: login.defs
  1810. *** login.defs.old    Sat Oct 10 11:16:28 1992
  1811. --- login.defs    Sat Oct 10 11:16:27 1992
  1812. ***************
  1813. *** 1,7 ****
  1814.   #
  1815.   # /etc/login.defs - Configuration control definitions for the login package.
  1816.   #
  1817. ! #    @(#)login.defs    3.5    14:51:26    4/28/92
  1818.   #
  1819.   # Three items must be defined:  MAIL_DIR, ENV_SUPATH, and ENV_PATH.
  1820.   # If unspecified, some arbitrary (and possibly incorrect) value will
  1821. --- 1,7 ----
  1822.   #
  1823.   # /etc/login.defs - Configuration control definitions for the login package.
  1824.   #
  1825. ! #    @(#)login.defs    3.6    13:02:35    7/27/92
  1826.   #
  1827.   # Three items must be defined:  MAIL_DIR, ENV_SUPATH, and ENV_PATH.
  1828.   # If unspecified, some arbitrary (and possibly incorrect) value will
  1829. ***************
  1830. *** 10,15 ****
  1831. --- 10,20 ----
  1832.   #
  1833.   # Comment lines (lines beginning with "#") and blank lines are ignored.
  1834.   #
  1835. + #
  1836. + # Delay in seconds before being allowed another attempt after a login failure
  1837. + #
  1838. + FAIL_DELAY        5
  1839.   
  1840.   #
  1841.   # Enable additional passwords upon dialup lines specified in /etc/dialups.
  1842. Index: logoutd.c
  1843. *** logoutd.c.old    Sat Oct 10 11:16:45 1992
  1844. --- logoutd.c    Sat Oct 10 11:16:44 1992
  1845. ***************
  1846. *** 1,5 ****
  1847.   /*
  1848. !  * Copyright 1991, John F. Haugh II
  1849.    * All rights reserved.
  1850.    *
  1851.    * Permission is granted to copy and create derivative works for any
  1852. --- 1,5 ----
  1853.   /*
  1854. !  * Copyright 1991, 1992, John F. Haugh II
  1855.    * All rights reserved.
  1856.    *
  1857.    * Permission is granted to copy and create derivative works for any
  1858. ***************
  1859. *** 7,34 ****
  1860.    * in all copies of source code, or included in human readable form
  1861.    * and conspicuously displayed on all copies of object code or
  1862.    * distribution media.
  1863.    */
  1864.   
  1865.   #ifndef lint
  1866. ! static    char    sccsid[] = "@(#)logoutd.c    3.3    13:22:33    3/9/92";
  1867.   #endif
  1868.   
  1869.   #include <sys/types.h>
  1870.   #include <stdio.h>
  1871.   #include <signal.h>
  1872.   #include <utmp.h>
  1873.   #include "config.h"
  1874.   
  1875. ! #ifdef SUN4
  1876. ! #include <fcntl.h>
  1877.   #endif
  1878.   
  1879. ! main ()
  1880.   {
  1881.       int    i;
  1882.       struct    utmp    utmp;
  1883.       int    fd;
  1884. ! #if defined(BSD) || defined(SUN) || defined(SUN4)
  1885.       char    tty_name[BUFSIZ];
  1886.       int    tty_fd;
  1887.   #endif
  1888. --- 7,112 ----
  1889.    * in all copies of source code, or included in human readable form
  1890.    * and conspicuously displayed on all copies of object code or
  1891.    * distribution media.
  1892. +  *
  1893. +  * This software is provided on an AS-IS basis and the author makes
  1894. +  * no warrantee of any kind.
  1895.    */
  1896.   
  1897.   #ifndef lint
  1898. ! static    char    sccsid[] = "@(#)logoutd.c    3.4    13:02:38    7/27/92";
  1899.   #endif
  1900.   
  1901.   #include <sys/types.h>
  1902. + #include <sys/stat.h>
  1903.   #include <stdio.h>
  1904.   #include <signal.h>
  1905.   #include <utmp.h>
  1906. + #include <fcntl.h>
  1907.   #include "config.h"
  1908.   
  1909. ! #define    HUP_MESG_FILE    "/etc/logoutd.mesg"
  1910. ! #ifndef    UTMP_FILE
  1911. ! #define    UTMP_FILE    "/etc/utmp"
  1912.   #endif
  1913.   
  1914. ! #ifdef    SVR4
  1915. ! #include <libgen.h>
  1916. ! #include <unistd.h>
  1917. ! #else
  1918. ! #define    basename(s) (strrchr(s, '/') ? strrchr (s, '/') + 1 : s)
  1919. ! #define    SEEK_SET    0
  1920. ! #endif
  1921. ! #ifdef    USE_SYSLOG
  1922. ! #include <syslog.h>
  1923. ! #ifndef    LOG_WARN
  1924. ! #define    LOG_WARN    LOG_WARNING
  1925. ! #endif
  1926. ! #endif
  1927. ! #ifdef    SVR4
  1928. ! #define    signal    sigset
  1929. ! #endif
  1930. ! #ifdef    HUP_MESG_FILE
  1931. ! int    mesg_len;
  1932. ! int    mesg_size;
  1933. ! char    *mesg_buf;
  1934. ! /*
  1935. !  * reload_mesg - reload the message that is output when killing a process
  1936. !  */
  1937. ! void
  1938. ! reload_mesg (sig)
  1939. ! int    sig;
  1940. ! {
  1941. !     int    fd;
  1942. !     struct    stat    sb;
  1943. !     signal (SIGHUP, reload_mesg);
  1944. !     if (stat (HUP_MESG_FILE, &sb))
  1945. !         return;
  1946. !     if ((sb.st_mode & S_IFMT) != S_IFREG)
  1947. !         return;
  1948. !     if ((fd = open (HUP_MESG_FILE, O_RDONLY)) != -1) {
  1949. !         if (sb.st_size + 1 > mesg_size) {
  1950. !             if (mesg_buf)
  1951. !                 free (mesg_buf);
  1952. !             mesg_len = sb.st_size;
  1953. !             mesg_size = mesg_len + 1;
  1954. !             if (! (mesg_buf = malloc (mesg_len + 1)))
  1955. !                 goto end;
  1956. !         } else
  1957. !             mesg_len = sb.st_size;
  1958. !         if (read (fd, mesg_buf, mesg_len) != mesg_len) {
  1959. !             mesg_len = 0;
  1960. !             goto end;
  1961. !         }
  1962. !     } else
  1963. !         return;
  1964. ! end:
  1965. !     close (fd);
  1966. ! }
  1967. ! #endif
  1968. ! void
  1969. ! main (argc, argv)
  1970. ! int    argc;
  1971. ! char    **argv;
  1972.   {
  1973.       int    i;
  1974.       struct    utmp    utmp;
  1975.       int    fd;
  1976. ! #if defined(BSD) || defined(SUN) || defined(SUN4) || defined(HUP_MESG_FILE)
  1977.       char    tty_name[BUFSIZ];
  1978.       int    tty_fd;
  1979.   #endif
  1980. ***************
  1981. *** 39,64 ****
  1982.   #ifdef    NDEBUG
  1983.   #ifdef    USG
  1984.       setpgrp ();
  1985. ! #endif
  1986.   #if defined(BSD) || defined(SUN) || defined(SUN4)
  1987.       setpgid (getpid ());
  1988. ! #endif
  1989.       signal (SIGHUP, SIG_IGN);
  1990.   
  1991. !     if (fork () > 0)
  1992. !         exit (0);
  1993. ! #endif
  1994.       while (1) {
  1995.   #ifdef    NDEBUG
  1996.           sleep (60);
  1997.   #endif
  1998. !         if ((fd = open ("/etc/utmp", 0)) == -1)
  1999. !             continue;
  2000.   
  2001.           while (read (fd, &utmp, sizeof utmp) == sizeof utmp) {
  2002.   #ifdef    USG_UTMP
  2003.               if (utmp.ut_type != USER_PROCESS)
  2004.                   continue;
  2005.               if (isttytime (utmp.ut_user, utmp.ut_line, time (0)))
  2006.                   continue;
  2007.   #endif
  2008. --- 117,183 ----
  2009.   #ifdef    NDEBUG
  2010.   #ifdef    USG
  2011.       setpgrp ();
  2012. ! #endif    /* USG */
  2013.   #if defined(BSD) || defined(SUN) || defined(SUN4)
  2014.       setpgid (getpid ());
  2015. ! #endif /* BSD || SUN || SUN4 */
  2016. ! #ifdef    HUP_MESG_FILE
  2017. !     signal (SIGHUP, reload_mesg);
  2018. ! #else
  2019.       signal (SIGHUP, SIG_IGN);
  2020. + #endif    /* HUP_MESG_FILE */
  2021.   
  2022. !     /*
  2023. !      * Put this process in the background.
  2024. !      */
  2025. !     if (i = fork ())
  2026. !         exit (i < 0 ? 1:0);
  2027. ! #endif    /* NDEBUG */
  2028. ! #ifdef    USE_SYSLOG
  2029. !     /*
  2030. !      * Start syslogging everything
  2031. !      */
  2032. !     openlog (basename (argv[0]), LOG_PID|LOG_CONS|LOG_NOWAIT, LOG_AUTH);
  2033. ! #endif
  2034. !     /*
  2035. !      * Scan the UTMP file once per minute looking for users that
  2036. !      * are not supposed to still be logged in.
  2037. !      */
  2038.       while (1) {
  2039.   #ifdef    NDEBUG
  2040.           sleep (60);
  2041.   #endif
  2042. !         /* 
  2043. !          * Attempt to re-open the utmp file.  The file is only
  2044. !          * open while it is being used.
  2045. !          */
  2046. !         if ((fd = open (UTMP_FILE, 0)) == -1) {
  2047. ! #ifdef    USE_SYSLOG
  2048. !             syslog (LOG_ERR, "cannot open %s - aborting\n",
  2049. !                 UTMP_FILE);
  2050. !             closelog ();
  2051. ! #endif
  2052. !             exit (1);
  2053. !         }
  2054. !         /*
  2055. !          * Read all of the entries in the utmp file.  The entries
  2056. !          * for login sessions will be checked to see if the user
  2057. !          * is permitted to be signed on at this time.
  2058. !          */
  2059.   
  2060.           while (read (fd, &utmp, sizeof utmp) == sizeof utmp) {
  2061.   #ifdef    USG_UTMP
  2062.               if (utmp.ut_type != USER_PROCESS)
  2063.                   continue;
  2064.               if (isttytime (utmp.ut_user, utmp.ut_line, time (0)))
  2065.                   continue;
  2066.   #endif
  2067. ***************
  2068. *** 68,78 ****
  2069.               if (isttytime (utmp.ut_name, utmp.ut_line, time (0)))
  2070.                   continue;
  2071.   #endif
  2072.   #ifdef    USG_UTMP
  2073.               kill (- utmp.ut_pid, SIGHUP);
  2074.               sleep (10);
  2075.               kill (- utmp.ut_pid, SIGKILL);
  2076. ! #endif
  2077.   #if defined(BSD) || defined(SUN) || defined(SUN4)
  2078.   
  2079.               /*
  2080. --- 187,205 ----
  2081.               if (isttytime (utmp.ut_name, utmp.ut_line, time (0)))
  2082.                   continue;
  2083.   #endif
  2084. + #ifdef    HUP_MESG_FILE
  2085. +             strcat (strcpy (tty_name, "/dev/"), utmp.ut_line);
  2086. +             if ((tty_fd = open (tty_name,
  2087. +                     O_WRONLY|O_NDELAY)) != -1) {
  2088. +                 write (tty_fd, mesg_buf, mesg_len);
  2089. +                 close (tty_fd);
  2090. +             }
  2091. + #endif    /* HUP_MESG_FILE */
  2092.   #ifdef    USG_UTMP
  2093.               kill (- utmp.ut_pid, SIGHUP);
  2094.               sleep (10);
  2095.               kill (- utmp.ut_pid, SIGKILL);
  2096. ! #endif    /* USG_UTMP */
  2097.   #if defined(BSD) || defined(SUN) || defined(SUN4)
  2098.   
  2099.               /*
  2100. ***************
  2101. *** 88,93 ****
  2102. --- 215,226 ----
  2103.               close (tty_fd);
  2104.   #endif
  2105.           }
  2106. + #ifdef    USE_SYSLOG
  2107. +         syslog (LOG_NOTICE,
  2108. +             "logged off user `%.*s' on `%.*s'\n",
  2109. +             sizeof utmp.ut_name, utmp.ut_name,
  2110. +             sizeof utmp.ut_line, utmp.ut_line);
  2111. + #endif    /* USE_SYSLOG */
  2112.           close (fd);
  2113.       }
  2114.   }
  2115. -- 
  2116. John F. Haugh II                  [  TSAKC  ] !'s: ...!cs.utexas.edu!rpp386!jfh
  2117. Ma Bell: (512) 251-2151           [ DoF #17 ]        @'s: jfh@rpp386.cactus.org
  2118.  
  2119. exit 0 # Just in case...
  2120.