home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume38 / shadow / part14 < prev    next >
Encoding:
Text File  |  1993-08-14  |  29.6 KB  |  1,126 lines

  1. Newsgroups: comp.sources.misc
  2. From: jfh@rpp386.cactus.org (John F. Haugh II)
  3. Subject: v38i133:  shadow - Shadow Password Suite, v3.3, Part14/14
  4. Message-ID: <1993Aug14.192711.10054@sparky.sterling.com>
  5. X-Md4-Signature: 8a8f59a70a424c257f89084a02f63a17
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Sat, 14 Aug 1993 19:27:11 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: jfh@rpp386.cactus.org (John F. Haugh II)
  12. Posting-number: Volume 38, Issue 133
  13. Archive-name: shadow/part14
  14. Environment: UNIX
  15. Supersedes: shadow: Volume 26, Issue 54-64
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  chpasswd.8 dpasswd.8 faillog.4 faillog.h fields.c
  22. #   groupadd.1 groupdel.1 groups.1 id.1 lastlog.h lockpw.c logoutd.8
  23. #   mkrmdir.c motd.c patchlevel.h pwauth.h pwunconv.8 spdbm.c tz.c
  24. # Wrapped by kent@sparky on Sat Aug 14 14:11:42 1993
  25. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  26. echo If this archive is complete, you will see the following message:
  27. echo '          "shar: End of archive 14 (of 14)."'
  28. if test -f 'chpasswd.8' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'chpasswd.8'\"
  30. else
  31.   echo shar: Extracting \"'chpasswd.8'\" \(1273 characters\)
  32.   sed "s/^X//" >'chpasswd.8' <<'END_OF_FILE'
  33. X.\" Copyright 1991, John F. Haugh II
  34. X.\" All rights reserved.
  35. X.\"
  36. X.\" Permission is granted to copy and create derivative works for any
  37. X.\" non-commercial purpose, provided this copyright notice is preserved
  38. X.\" in all copies of source code, or included in human readable form
  39. X.\" and conspicuously displayed on all copies of object code or
  40. X.\" distribution media.
  41. X.\"
  42. X.\"    @(#)chpasswd.8    3.1    16:50:16    04 Aug 1991
  43. X.\"
  44. X.TH CHPASSWD 8
  45. X.SH NAME
  46. X\fBchpasswd\fR - update password file in batch
  47. X.SH SYNOPSIS
  48. X\fBchpasswd\fR
  49. X.SH DESCRIPTION
  50. X\fBchpasswd\fR reads a file of user name and cleartext password pairs
  51. Xfrom standard input and uses this information
  52. Xto update a group of existing users.
  53. XEach line is of the format
  54. X.DS
  55. X      \fIuser_name\fR:\fIpassword\fR
  56. X.DE
  57. XThe named user must exist.
  58. XThe supplied password will be encrypted and the password age updated,
  59. Xif present.
  60. X.PP
  61. XThis command is intended to be used in a large system environment where
  62. Xmany accounts are created at a single time.
  63. X.SH CAVEATS
  64. XThe \fImkpasswd\fR command must be executed afterwards to update the
  65. XDBM password files.
  66. XThe input file must be protected since it contains unencrypted passwords.
  67. XThis command may be discarded in favor of the newusers(8) command.
  68. X.SH SEE ALSO
  69. Xmkpasswd(8), passwd(1), useradd(1)
  70. END_OF_FILE
  71.   if test 1273 -ne `wc -c <'chpasswd.8'`; then
  72.     echo shar: \"'chpasswd.8'\" unpacked with wrong size!
  73.   fi
  74.   # end of 'chpasswd.8'
  75. fi
  76. if test -f 'dpasswd.8' -a "${1}" != "-c" ; then 
  77.   echo shar: Will not clobber existing file \"'dpasswd.8'\"
  78. else
  79.   echo shar: Extracting \"'dpasswd.8'\" \(1002 characters\)
  80.   sed "s/^X//" >'dpasswd.8' <<'END_OF_FILE'
  81. X.\" Copyright 1991, John F. Haugh II
  82. X.\" All rights reserved.
  83. X.\"
  84. X.\" Permission is granted to copy and create derivative works for any
  85. X.\" non-commercial purpose, provided this copyright notice is preserved
  86. X.\" in all copies of source code, or included in human readable form
  87. X.\" and conspicuously displayed on all copies of object code or
  88. X.\" distribution media.
  89. X.\"
  90. X.\"    @(#)dpasswd.8    3.1    17:36:06    04 Aug 1991
  91. X.\"
  92. X.TH DPASSWD 8
  93. X.SH NAME
  94. X\fBdpasswd\fR - change dialup password
  95. X.SH SYNOPSIS
  96. X\fBdpasswd\fR
  97. X[ \fI-(a|d)\fR ] \fIshell\fR
  98. X.SH DESCRIPTION
  99. X\fBdpasswd\fR adds, deletes, and updates dialup passwords for user
  100. Xlogin shells.
  101. XThe dialup password is prompted for after a user's password has been
  102. Xauthenticated whenever the user logs in over a dialup line.
  103. X\fBdpasswd\fR will prompt for the new password twice to insure it
  104. Xhas been entered correctly.
  105. X.PP
  106. XThe \fIshell\fR argument must be the complete pathname of the login
  107. Xprogram.
  108. X.SH FILES
  109. X.br
  110. X/etc/d_passwd
  111. X.br
  112. X/etc/dialups
  113. X.SH SEE ALSO
  114. Xlogin(1)
  115. END_OF_FILE
  116.   if test 1002 -ne `wc -c <'dpasswd.8'`; then
  117.     echo shar: \"'dpasswd.8'\" unpacked with wrong size!
  118.   fi
  119.   # end of 'dpasswd.8'
  120. fi
  121. if test -f 'faillog.4' -a "${1}" != "-c" ; then 
  122.   echo shar: Will not clobber existing file \"'faillog.4'\"
  123. else
  124.   echo shar: Extracting \"'faillog.4'\" \(972 characters\)
  125.   sed "s/^X//" >'faillog.4' <<'END_OF_FILE'
  126. X.\" Copyright 1989, 1990, John F. Haugh II
  127. X.\" All rights reserved.
  128. X.\"
  129. X.\" Use, duplication, and disclosure prohibited without
  130. X.\" the express written permission of the author.
  131. X.\"
  132. X.\"    @(#)faillog.4    3.1    09:34:18    21 Nov 1990
  133. X.\"
  134. X.TH FAILLOG 4
  135. X.SH NAME
  136. Xfaillog \- Login failure logging file
  137. X.SH DESCRIPTION
  138. X.I faillog
  139. Xmaintains a count of login failures and the limits for each account.
  140. XThe file is fixed length record, indexed by numerical UID.
  141. XEach record contains the count of login failures since the last
  142. Xsuccessful login;
  143. Xthe maximum number of failures before the account is disabled;
  144. Xthe line the last login failure occured on;
  145. Xand the date the last login failure occured.
  146. X.PP
  147. XThe structure of the file is
  148. X.DS
  149. X
  150. X        struct    faillog {
  151. X                short   fail_cnt;
  152. X                short   fail_max;
  153. X                char    fail_line[12];
  154. X                time_t  fail_time;
  155. X        };
  156. X
  157. X.DE
  158. X.SH Files
  159. X/usr/adm/faillog \- login failure log
  160. X.SH See Also
  161. Xfaillog(8)
  162. END_OF_FILE
  163.   if test 972 -ne `wc -c <'faillog.4'`; then
  164.     echo shar: \"'faillog.4'\" unpacked with wrong size!
  165.   fi
  166.   # end of 'faillog.4'
  167. fi
  168. if test -f 'faillog.h' -a "${1}" != "-c" ; then 
  169.   echo shar: Will not clobber existing file \"'faillog.h'\"
  170. else
  171.   echo shar: Extracting \"'faillog.h'\" \(978 characters\)
  172.   sed "s/^X//" >'faillog.h' <<'END_OF_FILE'
  173. X/*
  174. X * Copyright 1989, 1990, 1992, John F. Haugh II
  175. X * All rights reserved.
  176. X *
  177. X * Permission is granted to copy and create derivative works for any
  178. X * non-commercial purpose, provided this copyright notice is preserved
  179. X * in all copies of source code, or included in human readable form
  180. X * and conspicuously displayed on all copies of object code or
  181. X * distribution media.
  182. X */
  183. X
  184. X/*
  185. X * faillog.h - login failure logging file format
  186. X *
  187. X *    @(#)faillog.h    3.1    20:36:28    07 Mar 1992
  188. X *
  189. X * The login failure file is maintained by login(1) and faillog(8)
  190. X * Each record in the file represents a separate UID and the file
  191. X * is indexed in that fashion.
  192. X */
  193. X
  194. X#ifdef    SVR4
  195. X#define    FAILFILE    "/var/adm/faillog"
  196. X#else
  197. X#define    FAILFILE    "/usr/adm/faillog"
  198. X#endif
  199. X
  200. Xstruct    faillog {
  201. X    short    fail_cnt;    /* failures since last success */
  202. X    short    fail_max;    /* failures before turning account off */
  203. X    char    fail_line[12];    /* last failure occured here */
  204. X    time_t    fail_time;    /* last failure occured then */
  205. X};
  206. END_OF_FILE
  207.   if test 978 -ne `wc -c <'faillog.h'`; then
  208.     echo shar: \"'faillog.h'\" unpacked with wrong size!
  209.   fi
  210.   # end of 'faillog.h'
  211. fi
  212. if test -f 'fields.c' -a "${1}" != "-c" ; then 
  213.   echo shar: Will not clobber existing file \"'fields.c'\"
  214. else
  215.   echo shar: Extracting \"'fields.c'\" \(1233 characters\)
  216.   sed "s/^X//" >'fields.c' <<'END_OF_FILE'
  217. X/*
  218. X * Copyright 1990, John F. Haugh II
  219. X * All rights reserved.
  220. X *
  221. X * Use, duplication, and disclosure prohibited without
  222. X * the express written permission of the author.
  223. X */
  224. X
  225. X#include <ctype.h>
  226. X#include <string.h>
  227. X#include <stdio.h>
  228. X
  229. X#ifndef    lint
  230. Xstatic    char    sccsid[] = "@(#)fields.c    3.2    08:26:23    26 Nov 1990";
  231. X#endif
  232. X
  233. Xextern    char    *Progname;
  234. X
  235. X/*
  236. X * valid_field - insure that a field contains all legal characters
  237. X *
  238. X * The supplied field is scanned for non-printing and other illegal
  239. X * characters.  If any illegal characters are found, valid_field
  240. X * returns -1.  Zero is returned for success.
  241. X */
  242. X
  243. Xint
  244. Xvalid_field (field, illegal)
  245. Xchar    *field;
  246. Xchar    *illegal;
  247. X{
  248. X    char    *cp;
  249. X
  250. X    for (cp = field;*cp && isprint (*cp) && ! strchr (illegal, *cp);cp++)
  251. X        ;
  252. X
  253. X    if (*cp)
  254. X        return -1;
  255. X    else
  256. X        return 0;
  257. X}
  258. X
  259. X/*
  260. X * change_field - change a single field if a new value is given.
  261. X *
  262. X * prompt the user with the name of the field being changed and the
  263. X * current value.
  264. X */
  265. X
  266. Xvoid
  267. Xchange_field (buf, prompt)
  268. Xchar    *buf;
  269. Xchar    *prompt;
  270. X{
  271. X    char    new[BUFSIZ];
  272. X    char    *cp;
  273. X
  274. X    printf ("\t%s [%s]: ", prompt, buf);
  275. X    if (fgets (new, BUFSIZ, stdin) != new)
  276. X        return;
  277. X
  278. X    if (cp = strchr (new, '\n'))
  279. X        *cp = '\0';
  280. X    else
  281. X        return;
  282. X
  283. X    if (new[0])
  284. X        strcpy (buf, new);
  285. X}
  286. END_OF_FILE
  287.   if test 1233 -ne `wc -c <'fields.c'`; then
  288.     echo shar: \"'fields.c'\" unpacked with wrong size!
  289.   fi
  290.   # end of 'fields.c'
  291. fi
  292. if test -f 'groupadd.1' -a "${1}" != "-c" ; then 
  293.   echo shar: Will not clobber existing file \"'groupadd.1'\"
  294. else
  295.   echo shar: Extracting \"'groupadd.1'\" \(1353 characters\)
  296.   sed "s/^X//" >'groupadd.1' <<'END_OF_FILE'
  297. X.\" Copyright 1991, John F. Haugh II
  298. X.\" All rights reserved.
  299. X.\"
  300. X.\" Permission is granted to copy and create derivative works for any
  301. X.\" non-commercial purpose, provided this copyright notice is preserved
  302. X.\" in all copies of source code, or included in human readable form
  303. X.\" and conspicuously displayed on all copies of object code or
  304. X.\" distribution media.
  305. X.\"
  306. X.\"    @(#)groupadd.1    3.1    13:28:00    13 Jul 1991
  307. X.\"
  308. X.TH GROUPADD 1M
  309. X.SH NAME
  310. Xgroupadd \- Create a new group
  311. X.SH SYNOPSIS
  312. X.B groupadd
  313. X[ \fB-g\fI gid \fR[ \fB-o\fR ] ]
  314. X.I group
  315. X.SH DESCRIPTION
  316. XThe \fIgroupadd\fR command
  317. Xcreates a new group account using the values specified on the
  318. Xcommand line and the default values from the system.
  319. XThe new group will be entered into the system files as needed.
  320. XThe options which apply to the \fIgroupadd\fR command are
  321. X.IP "\fB-g \fIgid\fR"
  322. XThe numerical value of the group's ID.
  323. XThis value must be unique, unless the \fI-o\fR option is used.
  324. XThe value must be non-negative.
  325. XThe default is to use the smallest ID value greater than 99 and
  326. Xgreater than every other group.
  327. XValues between 0 and 99 are typically reserved for system accounts.
  328. X.SH Files
  329. X/etc/group \- group account information
  330. X.br
  331. X/etc/gshadow \- secure group account information
  332. X.SH SEE ALSO
  333. X\fBchfn(1), chsh(1), useradd(1M), userdel(1M), usermod(1M),
  334. Xpasswd(1), groupdel(1M), groupmod(1M)
  335. END_OF_FILE
  336.   if test 1353 -ne `wc -c <'groupadd.1'`; then
  337.     echo shar: \"'groupadd.1'\" unpacked with wrong size!
  338.   fi
  339.   # end of 'groupadd.1'
  340. fi
  341. if test -f 'groupdel.1' -a "${1}" != "-c" ; then 
  342.   echo shar: Will not clobber existing file \"'groupdel.1'\"
  343. else
  344.   echo shar: Extracting \"'groupdel.1'\" \(1207 characters\)
  345.   sed "s/^X//" >'groupdel.1' <<'END_OF_FILE'
  346. X.\" Copyright 1991, 1993, John F. Haugh II
  347. X.\" All rights reserved.
  348. X.\"
  349. X.\" Permission is granted to copy and create derivative works for any
  350. X.\" non-commercial purpose, provided this copyright notice is preserved
  351. X.\" in all copies of source code, or included in human readable form
  352. X.\" and conspicuously displayed on all copies of object code or
  353. X.\" distribution media.
  354. X.\"
  355. X.\" This software is provided on an AS-IS basis and the author makes
  356. X.\" no warrantee of any kind.
  357. X.\"
  358. X.\"    @(#)groupdel.1    3.2    08:14:28    23 Apr 1993
  359. X.\"
  360. X.TH GROUPDEL 1M
  361. X.SH NAME
  362. Xgroupdel \- Delete a group
  363. X.SH SYNOPSIS
  364. X.B groupdel
  365. X.I group
  366. X.SH DESCRIPTION
  367. XThe \fIgroupdel\fR command modifies the system account files, deleting
  368. Xall entries that refer to \fIgroup\fR.
  369. XThe named group must exist.
  370. X.PP
  371. XYou must manually check all filesystems to insure that no files remain
  372. Xwith the named group as the file group ID.
  373. X.SH CAVEATS
  374. XYou may not remove the primary group of any existing user.
  375. XYou must remove the user before you remove the group.
  376. X.SH Files
  377. X/etc/group \- group information
  378. X.br
  379. X/etc/gshadow \- secure group information
  380. X.SH SEE ALSO
  381. X\fBchfn(1), chsh(1), useradd(1M), userdel(1M), usermod(1M),
  382. Xpasswd(1), groupadd(1M), groupmod(1M)
  383. END_OF_FILE
  384.   if test 1207 -ne `wc -c <'groupdel.1'`; then
  385.     echo shar: \"'groupdel.1'\" unpacked with wrong size!
  386.   fi
  387.   # end of 'groupdel.1'
  388. fi
  389. if test -f 'groups.1' -a "${1}" != "-c" ; then 
  390.   echo shar: Will not clobber existing file \"'groups.1'\"
  391. else
  392.   echo shar: Extracting \"'groups.1'\" \(1118 characters\)
  393.   sed "s/^X//" >'groups.1' <<'END_OF_FILE'
  394. X.\" Copyright 1991, 1992, John F. Haugh II
  395. X.\" All rights reserved.
  396. X.\"
  397. X.\" Permission is granted to copy and create derivative works for any
  398. X.\" non-commercial purpose, provided this copyright notice is preserved
  399. X.\" in all copies of source code, or included in human readable form
  400. X.\" and conspicuously displayed on all copies of object code or
  401. X.\" distribution media.
  402. X.\"
  403. X.\"    @(#)groups.1    3.2    14:52:10    28 Apr 1992
  404. X.\"
  405. X.TH GROUPS 1
  406. X.SH NAME
  407. Xgroups \- Display current group ID names
  408. X.SH SYNOPSIS
  409. X.B groups
  410. X[
  411. X.I user
  412. X]
  413. X.SH DESCRIPTION
  414. X.I groups
  415. Xdisplays the current group ID names
  416. Xor values.
  417. XIf the value does not have a corresponding entry in
  418. X\fB/etc/group\fR, the value will be displayed as the numerical group value.
  419. XThe optional \fIuser\fR parameter will display the groups for the named
  420. X\fIuser\R.
  421. X.SH Note
  422. XSystems which do not support concurrent group sets will have the information
  423. Xfrom \fB/etc/group\fR reported.
  424. XThe user must use \fInewgrp\fR or \fIsg\fR to change their current real and
  425. Xeffective group ID.
  426. X.SH Files
  427. X/etc/group \- group information
  428. X.SH See Also
  429. Xnewgrp(1), getuid(2), getgid(2), getgroups(2)
  430. END_OF_FILE
  431.   if test 1118 -ne `wc -c <'groups.1'`; then
  432.     echo shar: \"'groups.1'\" unpacked with wrong size!
  433.   fi
  434.   # end of 'groups.1'
  435. fi
  436. if test -f 'id.1' -a "${1}" != "-c" ; then 
  437.   echo shar: Will not clobber existing file \"'id.1'\"
  438. else
  439.   echo shar: Extracting \"'id.1'\" \(1003 characters\)
  440.   sed "s/^X//" >'id.1' <<'END_OF_FILE'
  441. X.\" Copyright 1991, John F. Haugh II
  442. X.\" All rights reserved.
  443. X.\"
  444. X.\" Permission is granted to copy and create derivative works for any
  445. X.\" non-commercial purpose, provided this copyright notice is preserved
  446. X.\" in all copies of source code, or included in human readable form
  447. X.\" and conspicuously displayed on all copies of object code or
  448. X.\" distribution media.
  449. X.\"
  450. X.\"    @(#)id.1    3.2    07:24:54    01 Aug 1991
  451. X.\"
  452. X.TH ID 1
  453. X.SH NAME
  454. Xid \- Display current user and group ID names
  455. X.SH SYNOPSIS
  456. X.B id
  457. X[
  458. X.B -a
  459. X]
  460. X.SH DESCRIPTION
  461. X.I id
  462. Xdisplays the current real and effective user and group ID names
  463. Xor values.
  464. XIf the value does not have a corresponding entry in \fB/etc/passwd\fR
  465. Xor \fB/etc/group\fR, the value will be displayed without the corresponding
  466. Xname.
  467. XThe optional \fB-a\fR flag will display the group set on systems which
  468. Xsupport multiple concurrent group membership.
  469. X.SH Files
  470. X/etc/passwd \- user account information
  471. X.br
  472. X/etc/group \- group information
  473. X.SH See Also
  474. Xgetuid(2), getgid(2), getgroups(2)
  475. END_OF_FILE
  476.   if test 1003 -ne `wc -c <'id.1'`; then
  477.     echo shar: \"'id.1'\" unpacked with wrong size!
  478.   fi
  479.   # end of 'id.1'
  480. fi
  481. if test -f 'lastlog.h' -a "${1}" != "-c" ; then 
  482.   echo shar: Will not clobber existing file \"'lastlog.h'\"
  483. else
  484.   echo shar: Extracting \"'lastlog.h'\" \(860 characters\)
  485.   sed "s/^X//" >'lastlog.h' <<'END_OF_FILE'
  486. X/*
  487. X * Copyright 1989, 1990, 1992, 1993, John F. Haugh II
  488. X * All rights reserved.
  489. X *
  490. X * Permission is granted to copy and create derivative works for any
  491. X * non-commercial purpose, provided this copyright notice is preserved
  492. X * in all copies of source code, or included in human readable form
  493. X * and conspicuously displayed on all copies of object code or
  494. X * distribution media.
  495. X *
  496. X * This software is provided on an AS-IS basis and the author makes
  497. X * not warrantee of any kind.
  498. X */
  499. X
  500. X/*
  501. X * lastlog.h - structure of lastlog file
  502. X *
  503. X *    @(#)lastlog.h    3.1.1.2    08:57:40    10 Jun 1993
  504. X *
  505. X *    This file defines a lastlog file structure which should be sufficient
  506. X *    to hold the information required by login.  It should only be used if
  507. X *    there is no real lastlog.h file.
  508. X */
  509. X
  510. Xstruct    lastlog    {
  511. X    time_t    ll_time;
  512. X    char    ll_line[8];
  513. X#ifdef    SVR4
  514. X    char    ll_host[16];
  515. X#endif
  516. X};
  517. END_OF_FILE
  518.   if test 860 -ne `wc -c <'lastlog.h'`; then
  519.     echo shar: \"'lastlog.h'\" unpacked with wrong size!
  520.   fi
  521.   # end of 'lastlog.h'
  522. fi
  523. if test -f 'lockpw.c' -a "${1}" != "-c" ; then 
  524.   echo shar: Will not clobber existing file \"'lockpw.c'\"
  525. else
  526.   echo shar: Extracting \"'lockpw.c'\" \(1264 characters\)
  527.   sed "s/^X//" >'lockpw.c' <<'END_OF_FILE'
  528. X/*
  529. X * Copyright 1992, John F. Haugh II
  530. X * All rights reserved.
  531. X *
  532. X * Permission is granted to copy and create derivative works for any
  533. X * non-commercial purpose, provided this copyright notice is preserved
  534. X * in all copies of source code, or included in human readable form
  535. X * and conspicuously displayed on all copies of object code or
  536. X * distribution media.
  537. X *
  538. X * This software is provided on an AS-IS basis and the author makes
  539. X * no warrantee of any kind.
  540. X */
  541. X
  542. X#ifndef    lint
  543. Xstatic    char    sccsid[] = "@(#)lockpw.c    3.1    08:12:51    12 Nov 1992";
  544. X#endif
  545. X
  546. X/*
  547. X * lckpwdf - lock the password files
  548. X */
  549. X
  550. Xint
  551. Xlckpwdf ()
  552. X{
  553. X    int    i;
  554. X
  555. X    /*
  556. X     * We have 15 seconds to lock the whole mess
  557. X     */
  558. X
  559. X    for (i = 0;i < 15;i++)
  560. X        if (pw_lock ())
  561. X            break;
  562. X        else
  563. X            sleep (1);
  564. X
  565. X    /*
  566. X     * Did we run out of time?
  567. X     */
  568. X
  569. X    if (i == 15)
  570. X        return -1;
  571. X
  572. X    /*
  573. X     * Nope, use any remaining time to lock the shadow password
  574. X     * file.
  575. X     */
  576. X
  577. X    for (;i < 15;i++)
  578. X        if (spw_lock ())
  579. X            break;
  580. X        else
  581. X            sleep (1);
  582. X
  583. X    /*
  584. X     * Out of time yet?
  585. X     */
  586. X
  587. X    if (i == 15) {
  588. X        pw_unlock ();
  589. X        return -1;
  590. X    }
  591. X
  592. X    /*
  593. X     * Nope - and both files are now locked.
  594. X     */
  595. X
  596. X    return 0;
  597. X}
  598. X
  599. X/*
  600. X * ulckpwdf - unlock the password files
  601. X */
  602. X
  603. Xint
  604. Xulckpwdf ()
  605. X{
  606. X
  607. X    /*
  608. X     * Unlock both files.
  609. X     */
  610. X
  611. X    return (pw_unlock () && spw_unlock ()) ? 0:-1;
  612. X}
  613. END_OF_FILE
  614.   if test 1264 -ne `wc -c <'lockpw.c'`; then
  615.     echo shar: \"'lockpw.c'\" unpacked with wrong size!
  616.   fi
  617.   # end of 'lockpw.c'
  618. fi
  619. if test -f 'logoutd.8' -a "${1}" != "-c" ; then 
  620.   echo shar: Will not clobber existing file \"'logoutd.8'\"
  621. else
  622.   echo shar: Extracting \"'logoutd.8'\" \(1003 characters\)
  623.   sed "s/^X//" >'logoutd.8' <<'END_OF_FILE'
  624. X.\" Copyright 1991, John F. Haugh II
  625. X.\" All rights reserved.
  626. X.\"
  627. X.\" Permission is granted to copy and create derivative works for any
  628. X.\" non-commercial purpose, provided this copyright notice is preserved
  629. X.\" in all copies of source code, or included in human readable form
  630. X.\" and conspicuously displayed on all copies of object code or
  631. X.\" distribution media.
  632. X.\"
  633. X.\"    @(#)logoutd.8    3.1    16:31:36    22 Sep 1991
  634. X.\"
  635. X.TH LOGOUTD 8
  636. X.SH NAME
  637. Xlogoutd \- Enforce login time restrictions
  638. X.SH SYNOPSIS
  639. X.B /etc/logoutd
  640. X.SH DESCRIPTION
  641. X.I logoutd enforces the login time and port restrictions specified in
  642. X/etc/porttime.
  643. X.I logoutd should be started from \fB/etc/rc\fR.
  644. XThe \fB/etc/utmp\fR file is scanned periodically and each user name
  645. Xis checked to see if the named user is permitted on the named port
  646. Xat the current time.
  647. XAny login session which is violating the restrictions in \fB/etc/porttime\fR
  648. Xis terminated.
  649. X.SH Files
  650. X/etc/porttime \- login and port permissions
  651. X.br
  652. X/etc/utmp \- current login sessions
  653. END_OF_FILE
  654.   if test 1003 -ne `wc -c <'logoutd.8'`; then
  655.     echo shar: \"'logoutd.8'\" unpacked with wrong size!
  656.   fi
  657.   # end of 'logoutd.8'
  658. fi
  659. if test -f 'mkrmdir.c' -a "${1}" != "-c" ; then 
  660.   echo shar: Will not clobber existing file \"'mkrmdir.c'\"
  661. else
  662.   echo shar: Extracting \"'mkrmdir.c'\" \(1338 characters\)
  663.   sed "s/^X//" >'mkrmdir.c' <<'END_OF_FILE'
  664. X/*
  665. X * Copyright 1991, John F. Haugh II
  666. X * All rights reserved.
  667. X *
  668. X * Permission is granted to copy and create derivative works for any
  669. X * non-commercial purpose, provided this copyright notice is preserved
  670. X * in all copies of source code, or included in human readable form
  671. X * and conspicuously displayed on all copies of object code or
  672. X * distribution media.
  673. X */
  674. X
  675. X#include <fcntl.h>
  676. X#include "config.h"
  677. X
  678. X#ifndef lint
  679. Xstatic    char    sccsid[] = "@(#)mkrmdir.c    3.3    07:43:57    17 Sep 1991";
  680. X#endif
  681. X
  682. X#ifdef    NEED_MKDIR
  683. X/*
  684. X * mkdir - create a directory
  685. X *
  686. X *    mkdir is provided for systems which do not include the mkdir()
  687. X *    system call.
  688. X */
  689. X
  690. Xint
  691. Xmkdir (dir, mode)
  692. Xchar    *dir;
  693. Xint    mode;
  694. X{
  695. X    int    status;
  696. X
  697. X    if (fork ()) {
  698. X        while (wait (&status) != -1)
  699. X            ;
  700. X
  701. X        return status >> 8;
  702. X    }
  703. X#ifdef    USE_SYSLOG
  704. X    closelog ();
  705. X#endif
  706. X    close (2);
  707. X    open ("/dev/null", O_WRONLY);
  708. X    umask (0777 & ~ mode);
  709. X    execl ("/bin/mkdir", "mkdir", dir, 0);
  710. X    _exit (128);
  711. X    /*NOTREACHED*/
  712. X}
  713. X#endif
  714. X#ifdef    NEED_RMDIR
  715. X/*
  716. X * rmdir - remove a directory
  717. X *
  718. X *    rmdir is provided for systems which do not include the rmdir()
  719. X *    system call.
  720. X */
  721. X
  722. Xint
  723. Xrmdir (dir)
  724. Xchar    *dir;
  725. X{
  726. X    int    status;
  727. X
  728. X    if (fork ()) {
  729. X        while (wait (&status) != -1)
  730. X            ;
  731. X
  732. X        return status >> 8;
  733. X    }
  734. X    close (2);
  735. X    open ("/dev/null", O_WRONLY);
  736. X    execl ("/bin/rmdir", "rmdir", dir, 0);
  737. X    _exit (128);
  738. X    /*NOTREACHED*/
  739. X}
  740. X#endif
  741. END_OF_FILE
  742.   if test 1338 -ne `wc -c <'mkrmdir.c'`; then
  743.     echo shar: \"'mkrmdir.c'\" unpacked with wrong size!
  744.   fi
  745.   # end of 'mkrmdir.c'
  746. fi
  747. if test -f 'motd.c' -a "${1}" != "-c" ; then 
  748.   echo shar: Will not clobber existing file \"'motd.c'\"
  749. else
  750.   echo shar: Extracting \"'motd.c'\" \(1079 characters\)
  751.   sed "s/^X//" >'motd.c' <<'END_OF_FILE'
  752. X/*
  753. X * Copyright 1989, 1990, 1991, John F. Haugh II
  754. X * All rights reserved.
  755. X *
  756. X * Permission is granted to copy and create derivative works for any
  757. X * non-commercial purpose, provided this copyright notice is preserved
  758. X * in all copies of source code, or included in human readable form
  759. X * and conspicuously displayed on all copies of object code or
  760. X * distribution media.
  761. X */
  762. X
  763. X#include <stdio.h>
  764. X#ifndef    BSD
  765. X#include <string.h>
  766. X#include <memory.h>
  767. X#else
  768. X#include <strings.h>
  769. X#define    strchr    index
  770. X#define    strrchr    rindex
  771. X#endif
  772. X#include "config.h"
  773. X
  774. X#ifndef    lint
  775. Xstatic    char    _sccsid[] = "@(#)motd.c    3.1    07:43:40    17 Sep 1991";
  776. X#endif
  777. X
  778. Xextern    char    *getdef_str();
  779. X
  780. Xvoid    motd ()
  781. X{
  782. X    FILE    *fp;
  783. X    char    motdlist[BUFSIZ], *motd, *mb;
  784. X    register int    c;
  785. X
  786. X    if ((mb = getdef_str("MOTD_FILE")) == NULL)
  787. X        return;
  788. X
  789. X    strncpy(motdlist, mb, sizeof(motdlist));
  790. X    motdlist[sizeof(motdlist)-1] = '\0';
  791. X
  792. X    for (mb = motdlist ; (motd = strtok(mb,":")) != NULL ; mb = NULL) {
  793. X        if ((fp = fopen(motd,"r")) != NULL) {
  794. X            while ((c = getc (fp)) != EOF)
  795. X                putchar (c);
  796. X            fclose (fp);
  797. X        }
  798. X    }
  799. X    fflush (stdout);
  800. X}
  801. END_OF_FILE
  802.   if test 1079 -ne `wc -c <'motd.c'`; then
  803.     echo shar: \"'motd.c'\" unpacked with wrong size!
  804.   fi
  805.   # end of 'motd.c'
  806. fi
  807. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  808.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  809. else
  810.   echo shar: Extracting \"'patchlevel.h'\" \(969 characters\)
  811.   sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  812. X/*
  813. X * Copyright 1991, 1992, John F. Haugh II
  814. X * All rights reserved.
  815. X *
  816. X * Permission is granted to copy and create derivative works for any
  817. X * non-commercial purpose, provided this copyright notice is preserved
  818. X * in all copies of source code, or included in human readable form
  819. X * and conspicuously displayed on all copies of object code or
  820. X * distribution media.
  821. X *
  822. X * Revision History
  823. X *    11/25/91    3.1.1    patchlevel 14
  824. X *        Added "login.defs" to Makefile
  825. X *    12/02/91    3.1.2    patchlevel 15
  826. X *        Bugs found by users
  827. X *    12/28/91    3.1.3    patchlevel 16
  828. X *        Changes for SunOS 4.1.1
  829. X *    02/08/92    3.1.4    patchlevel 17
  830. X *        Changes for SVR4, plus bug fixes
  831. X *    04/03/92    3.2.1    patchlevel 18
  832. X *        Minor bug fixes, new baseline
  833. X *    07/07/92    3.2.2    patchlevel 20
  834. X *        Added administrator defined authentication
  835. X *    11/04/92    3.2.3    patchlevel 21
  836. X *        Bug fixes for SVR4
  837. X *    07/23/93    3.3.0    patchlevel 23
  838. X *        New baseline release
  839. X */
  840. X
  841. X#define    RELEASE        3
  842. X#define    PATCHLEVEL    23
  843. X#define    VERSION        "3.3.0"
  844. END_OF_FILE
  845.   if test 969 -ne `wc -c <'patchlevel.h'`; then
  846.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  847.   fi
  848.   # end of 'patchlevel.h'
  849. fi
  850. if test -f 'pwauth.h' -a "${1}" != "-c" ; then 
  851.   echo shar: Will not clobber existing file \"'pwauth.h'\"
  852. else
  853.   echo shar: Extracting \"'pwauth.h'\" \(899 characters\)
  854.   sed "s/^X//" >'pwauth.h' <<'END_OF_FILE'
  855. X/*
  856. X * Copyright 1992, 1993, John F. Haugh II
  857. X * All rights reserved.
  858. X *
  859. X * Permission is granted to copy and create derivative works for any
  860. X * non-commercial purpose, provided this copyright notice is preserved
  861. X * in all copies of source code, or included in human readable form
  862. X * and conspicuously displayed on all copies of object code or
  863. X * distribution media.
  864. X *
  865. X * This software is provided on an AS-IS basis and the author makes
  866. X * not warrantee of any kind.
  867. X *
  868. X *    @(#)pwauth.h    3.2    17:40:49    01 May 1993
  869. X */
  870. X
  871. X#if    __STDC__
  872. Xint    pw_auth (char * program, char * user, int flag, char * input);
  873. X#else
  874. Xint    pw_auth ();
  875. X#endif
  876. X
  877. X/*
  878. X * Local access
  879. X */
  880. X
  881. X#define    PW_SU        1
  882. X#define    PW_LOGIN    2
  883. X
  884. X/*
  885. X * Administrative functions
  886. X */
  887. X
  888. X#define    PW_ADD        101
  889. X#define    PW_CHANGE    102
  890. X#define    PW_DELETE    103
  891. X
  892. X/*
  893. X * Network access
  894. X */
  895. X
  896. X#define    PW_TELNET    201
  897. X#define    PW_RLOGIN    202
  898. X#define    PW_FTP        203
  899. X#define    PW_REXEC    204
  900. END_OF_FILE
  901.   if test 899 -ne `wc -c <'pwauth.h'`; then
  902.     echo shar: \"'pwauth.h'\" unpacked with wrong size!
  903.   fi
  904.   # end of 'pwauth.h'
  905. fi
  906. if test -f 'pwunconv.8' -a "${1}" != "-c" ; then 
  907.   echo shar: Will not clobber existing file \"'pwunconv.8'\"
  908. else
  909.   echo shar: Extracting \"'pwunconv.8'\" \(1293 characters\)
  910.   sed "s/^X//" >'pwunconv.8' <<'END_OF_FILE'
  911. X.\" Copyright 1989, 1990, 1993 John F. Haugh II
  912. X.\" All rights reserved.
  913. X.\"
  914. X.\" Permission is granted to copy and create derivative works for any
  915. X.\" non-commercial purpose, provided this copyright notice is preserved
  916. X.\" in all copies of source code, or included in human readable form
  917. X.\" and conspicuously displayed on all copies of object code or
  918. X.\" distribution media.
  919. X.\"
  920. X.\" This software is provided on an AS-IS basis and the author makes
  921. X.\" no warrantee of any kind.
  922. X.\"
  923. X.\"    @(#)pwunconv.8    3.2    12:24:15    02 May 1993
  924. X.\"
  925. X.TH PWUNCONV 8
  926. X.SH NAME
  927. Xpwunconv \- restore old password file from shadow password file
  928. X.SH SYNOPSIS
  929. Xpwunconv
  930. X.SH DESCRIPTION
  931. X\fIPwunconv\fR copies the password file information from the shadow
  932. Xpassword file,
  933. Xmerging entries from an optional existing shadow file.
  934. XThe new password file is left in \fBnpasswd\fR.
  935. XThis file is created with modes which allow read access for
  936. Xthe owner only.
  937. XThere is no new shadow file.
  938. XPassword aging information is translated where possible.
  939. XThere is some loss of resolution in the password aging information.
  940. X.SH FILES
  941. X/etc/passwd \- old encrypted passwords and password aging
  942. X.br
  943. X/etc/shadow \- previously converted shadow password file
  944. X.br
  945. X./npasswd \- new password file
  946. X.SH SEE ALSO
  947. Xpasswd(1),
  948. Xpasswd(4),
  949. Xshadow(4),
  950. Xpwconv(8)
  951. END_OF_FILE
  952.   if test 1293 -ne `wc -c <'pwunconv.8'`; then
  953.     echo shar: \"'pwunconv.8'\" unpacked with wrong size!
  954.   fi
  955.   # end of 'pwunconv.8'
  956. fi
  957. if test -f 'spdbm.c' -a "${1}" != "-c" ; then 
  958.   echo shar: Will not clobber existing file \"'spdbm.c'\"
  959. else
  960.   echo shar: Extracting \"'spdbm.c'\" \(1235 characters\)
  961.   sed "s/^X//" >'spdbm.c' <<'END_OF_FILE'
  962. X/*
  963. X * Copyright 1990, 1991, John F. Haugh II
  964. X * All rights reserved.
  965. X *
  966. X * Use, duplication, and disclosure prohibited without
  967. X * the express written permission of the author.
  968. X */
  969. X
  970. X#ifndef    lint
  971. Xstatic    char    sccsid[] = "@(#)spdbm.c    3.3    08:46:22    12 Sep 1991";
  972. X#endif
  973. X
  974. X#include <string.h>
  975. X#include <stdio.h>
  976. X#include "config.h"
  977. X#include "shadow.h"
  978. X
  979. X#ifdef    NDBM
  980. X#include <ndbm.h>
  981. XDBM    *sp_dbm;
  982. X
  983. X/*
  984. X * sp_dbm_update
  985. X *
  986. X * Updates the DBM password files, if they exist.
  987. X */
  988. X
  989. Xint
  990. Xsp_dbm_update (sp)
  991. Xstruct    spwd    *sp;
  992. X{
  993. X    datum    key;
  994. X    datum    content;
  995. X    char    data[BUFSIZ];
  996. X    int    len;
  997. X    static    int    once;
  998. X
  999. X    if (! once) {
  1000. X        if (! sp_dbm)
  1001. X            setspent ();
  1002. X
  1003. X        once++;
  1004. X    }
  1005. X    if (! sp_dbm)
  1006. X        return 0;
  1007. X
  1008. X    len = spw_pack (sp, data);
  1009. X
  1010. X    content.dsize = len;
  1011. X    content.dptr = data;
  1012. X
  1013. X    key.dsize = strlen (sp->sp_namp);
  1014. X    key.dptr = sp->sp_namp;
  1015. X    if (dbm_store (sp_dbm, key, content, DBM_REPLACE))
  1016. X        return 0;
  1017. X
  1018. X    return 1;
  1019. X}
  1020. X
  1021. X/*
  1022. X * sp_dbm_remove
  1023. X *
  1024. X * Updates the DBM password files, if they exist.
  1025. X */
  1026. X
  1027. Xint
  1028. Xsp_dbm_remove (user)
  1029. Xchar    *user;
  1030. X{
  1031. X    datum    key;
  1032. X    static    int    once;
  1033. X
  1034. X    if (! once) {
  1035. X        if (! sp_dbm)
  1036. X            setspent ();
  1037. X
  1038. X        once++;
  1039. X    }
  1040. X    if (! sp_dbm)
  1041. X        return 0;
  1042. X
  1043. X    key.dsize = strlen (user);
  1044. X    key.dptr = user;
  1045. X    if (dbm_delete (sp_dbm, key))
  1046. X        return 0;
  1047. X
  1048. X    return 1;
  1049. X}
  1050. X#endif
  1051. END_OF_FILE
  1052.   if test 1235 -ne `wc -c <'spdbm.c'`; then
  1053.     echo shar: \"'spdbm.c'\" unpacked with wrong size!
  1054.   fi
  1055.   # end of 'spdbm.c'
  1056. fi
  1057. if test -f 'tz.c' -a "${1}" != "-c" ; then 
  1058.   echo shar: Will not clobber existing file \"'tz.c'\"
  1059. else
  1060.   echo shar: Extracting \"'tz.c'\" \(931 characters\)
  1061.   sed "s/^X//" >'tz.c' <<'END_OF_FILE'
  1062. X/*
  1063. X * Copyright 1991, John F. Haugh II and Chip Rosenthal
  1064. X * All rights reserved.
  1065. X *
  1066. X * Permission is granted to copy and create derivative works for any
  1067. X * non-commercial purpose, provided this copyright notice is preserved
  1068. X * in all copies of source code, or included in human readable form
  1069. X * and conspicuously displayed on all copies of object code or
  1070. X * distribution media.
  1071. X */
  1072. X
  1073. X#ifndef lint
  1074. Xstatic    char    sccsid[] = "@(#)tz.c    3.1    07:47:56    17 Sep 1991";
  1075. X#endif
  1076. X
  1077. X#include <stdio.h>
  1078. X
  1079. X/*
  1080. X * tz - return local timezone name
  1081. X *
  1082. X * Tz() determines the name of the local timezone by reading the
  1083. X * contents of the file named by ``fname''.
  1084. X */
  1085. X
  1086. Xchar *
  1087. Xtz (fname)
  1088. Xchar    *fname;
  1089. X{
  1090. X    FILE *fp;
  1091. X    static char tzbuf[64];
  1092. X
  1093. X    if ((fp = fopen(fname,"r")) == NULL)
  1094. X        return "TZ=CST6CDT";
  1095. X    else if (fgets(tzbuf, sizeof(tzbuf), fp) == NULL)
  1096. X        strcpy(tzbuf, "TZ=CST6CDT");
  1097. X    else
  1098. X        tzbuf[strlen(tzbuf) - 1] = '\0';
  1099. X
  1100. X    (void) fclose(fp);
  1101. X    return tzbuf;
  1102. X}
  1103. END_OF_FILE
  1104.   if test 931 -ne `wc -c <'tz.c'`; then
  1105.     echo shar: \"'tz.c'\" unpacked with wrong size!
  1106.   fi
  1107.   # end of 'tz.c'
  1108. fi
  1109. echo shar: End of archive 14 \(of 14\).
  1110. cp /dev/null ark14isdone
  1111. MISSING=""
  1112. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
  1113.     if test ! -f ark${I}isdone ; then
  1114.     MISSING="${MISSING} ${I}"
  1115.     fi
  1116. done
  1117. if test "${MISSING}" = "" ; then
  1118.     echo You have unpacked all 14 archives.
  1119.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1120. else
  1121.     echo You still must unpack the following archives:
  1122.     echo "        " ${MISSING}
  1123. fi
  1124. exit 0
  1125. exit 0 # Just in case...
  1126.