home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume39 / shadow / patch01 next >
Encoding:
Text File  |  1993-09-08  |  11.7 KB  |  477 lines

  1. Newsgroups: comp.sources.misc
  2. From: jfh@rpp386.cactus.org (John F. Haugh II)
  3. Subject: v39i078:  shadow - Shadow Password Suite, v3.3, Patch01
  4. Message-ID: <1993Sep8.115808.19554@sparky.sterling.com>
  5. X-Md4-Signature: ed2c21933c033660bbe0825a72ce18c6
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Wed, 8 Sep 1993 11:58:08 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: jfh@rpp386.cactus.org (John F. Haugh II)
  12. Posting-number: Volume 39, Issue 78
  13. Archive-name: shadow/patch01
  14. Environment: UNIX
  15. Patch-To: shadow: Volume 38, Issue 120-133
  16.  
  17. This patch brings the Shadow Password Suite from version 3.3.0 to 3.3.1.
  18. It corrects a deficiency in BSD-based systems which lack the getut*()
  19. functions for accessing the /etc/utmp file.  This affects SunOS 4.1.x in
  20. that certain commands will not bind with the getutent() library routine.
  21. --
  22. Prereq: "3.3.0"
  23. Index: patchlevel.h
  24. *** patchlevel.h.old    Thu Aug 26 08:05:43 1993
  25. --- patchlevel.h    Thu Aug 26 08:05:42 1993
  26. ***************
  27. *** 25,32 ****
  28.    *        Bug fixes for SVR4
  29.    *    07/23/93    3.3.0    patchlevel 23
  30.    *        New baseline release
  31.    */
  32.   
  33.   #define    RELEASE        3
  34. ! #define    PATCHLEVEL    23
  35. ! #define    VERSION        "3.3.0"
  36. --- 25,34 ----
  37.    *        Bug fixes for SVR4
  38.    *    07/23/93    3.3.0    patchlevel 23
  39.    *        New baseline release
  40. +  *    08/23/93    3.3.1    patchlevel 24
  41. +  *        Bug fixes for SunOS 4.1.1
  42.    */
  43.   
  44.   #define    RELEASE        3
  45. ! #define    PATCHLEVEL    24
  46. ! #define    VERSION        "3.3.1"
  47. Index: Makefile
  48. *** Makefile.old    Thu Aug 26 08:05:44 1993
  49. --- Makefile    Thu Aug 26 08:05:44 1993
  50. ***************
  51. *** 11,19 ****
  52.   # This software is provided on an AS-IS basis and the author makes
  53.   # no warrantee of any kind.
  54.   #
  55. ! #    @(#)Makefile    3.25.1.18    09:57:59  - Shadow password system
  56.   #
  57. ! #    @(#)Makefile    3.25.1.18    09:57:59    08 Aug 1993
  58.   #
  59.   SHELL = /bin/sh
  60.   
  61. --- 11,19 ----
  62.   # This software is provided on an AS-IS basis and the author makes
  63.   # no warrantee of any kind.
  64.   #
  65. ! #    @(#)Makefile    3.25.1.19    07:59:43  - Shadow password system
  66.   #
  67. ! #    @(#)Makefile    3.25.1.19    07:59:43    26 Aug 1993
  68.   #
  69.   SHELL = /bin/sh
  70.   
  71. ***************
  72. *** 23,29 ****
  73.   # The version with the utilities added was release 2.  It is now unsupported.
  74.   # The version with database-like file access is release 3.
  75.   RELEASE = 3
  76. ! VERSION = ver3.3.0
  77.   GFLAGS = -n $(VERSION)
  78.   GET = get_file
  79.   
  80. --- 23,29 ----
  81.   # The version with the utilities added was release 2.  It is now unsupported.
  82.   # The version with database-like file access is release 3.
  83.   RELEASE = 3
  84. ! VERSION = ver3.3.1
  85.   GFLAGS = -n $(VERSION)
  86.   GET = get_file
  87.   
  88. ***************
  89. *** 193,199 ****
  90.   
  91.   FILES2 = passwd.c port.c lmain.c sulogin.c pwpack.c dialup.c
  92.   
  93. ! FILES3 = chfn.c chsh.c smain.c faillog.c pwconv.c shadow.c pwck.c
  94.   
  95.   FILES4 = gpmain.c chage.c pwent.c valid.c setup.c entry.c ttytype.c port.h
  96.   
  97. --- 193,199 ----
  98.   
  99.   FILES2 = passwd.c port.c lmain.c sulogin.c pwpack.c dialup.c
  100.   
  101. ! FILES3 = chfn.c chsh.c smain.c faillog.c pwconv.c shadow.c pwck.c utent.c
  102.   
  103.   FILES4 = gpmain.c chage.c pwent.c valid.c setup.c entry.c ttytype.c port.h
  104.   
  105. Index: Makefile.sun4
  106. *** Makefile.sun4.old    Thu Aug 26 08:05:46 1993
  107. --- Makefile.sun4    Thu Aug 26 08:05:46 1993
  108. ***************
  109. *** 11,19 ****
  110.   # This software is provided on an AS-IS basis and the author makes
  111.   # no warrantee of any kind.
  112.   #
  113. ! #    @(#)Makefile.sun4    3.11    08:11:03  - Shadow password system (SunOS 4.1.1 version)
  114.   #
  115. ! #    @(#)Makefile.sun4    3.11    08:11:03    19 Jul 1993
  116.   #
  117.   SHELL = /bin/sh
  118.   
  119. --- 11,19 ----
  120.   # This software is provided on an AS-IS basis and the author makes
  121.   # no warrantee of any kind.
  122.   #
  123. ! #    @(#)Makefile.sun4    3.12    08:00:07  - Shadow password system (SunOS 4.1.1 version)
  124.   #
  125. ! #    @(#)Makefile.sun4    3.12    08:00:07    26 Aug 1993
  126.   #
  127.   SHELL = /bin/sh
  128.   
  129. ***************
  130. *** 148,154 ****
  131.       spdbm.c dpmain.c gshadow.c gsdbm.c gspack.c sgroupio.c useradd.c \
  132.       userdel.c patchlevel.h usermod.c copydir.c mkrmdir.c groupadd.c \
  133.       groupdel.c groupmod.c tz.c console.c hushed.c getdef.c scologin.c \
  134. !     logoutd.c groups.c pwauth.c lockpw.c chowndir.c
  135.   
  136.   FILES1 = README patchlevel.h newgrp.c Makefile config.h pwunconv.c obscure.c \
  137.       age.c id.c
  138. --- 148,154 ----
  139.       spdbm.c dpmain.c gshadow.c gsdbm.c gspack.c sgroupio.c useradd.c \
  140.       userdel.c patchlevel.h usermod.c copydir.c mkrmdir.c groupadd.c \
  141.       groupdel.c groupmod.c tz.c console.c hushed.c getdef.c scologin.c \
  142. !     logoutd.c groups.c pwauth.c lockpw.c chowndir.c utent.c
  143.   
  144.   FILES1 = README patchlevel.h newgrp.c Makefile config.h pwunconv.c obscure.c \
  145.       age.c id.c
  146. ***************
  147. *** 155,161 ****
  148.   
  149.   FILES2 = passwd.c port.c lmain.c sulogin.c pwpack.c dialup.c
  150.   
  151. ! FILES3 = chfn.c chsh.c smain.c faillog.c pwconv.c shadow.c pwck.c
  152.   
  153.   FILES4 = gpmain.c chage.c pwent.c valid.c setup.c entry.c ttytype.c port.h
  154.   
  155. --- 155,161 ----
  156.   
  157.   FILES2 = passwd.c port.c lmain.c sulogin.c pwpack.c dialup.c
  158.   
  159. ! FILES3 = chfn.c chsh.c smain.c faillog.c pwconv.c shadow.c pwck.c utent.c
  160.   
  161.   FILES4 = gpmain.c chage.c pwent.c valid.c setup.c entry.c ttytype.c port.h
  162.   
  163. ***************
  164. *** 224,230 ****
  165.       libshadow.a(shadow.o) \
  166.       libshadow.a(shadowio.o) \
  167.       libshadow.a(sppack.o) \
  168. !     libshadow.a(lockpw.o)
  169.       $(RANLIB) libshadow.a
  170.   
  171.   libsec: $(LIBSEC)(shadow.o)
  172. --- 224,231 ----
  173.       libshadow.a(shadow.o) \
  174.       libshadow.a(shadowio.o) \
  175.       libshadow.a(sppack.o) \
  176. !     libshadow.a(lockpw.o) \
  177. !     libshadow.a(utent.o)
  178.       $(RANLIB) libshadow.a
  179.   
  180.   libsec: $(LIBSEC)(shadow.o)
  181. ***************
  182. *** 595,600 ****
  183. --- 596,602 ----
  184.   libshadow.a(port.o): port.h
  185.   libshadow.a(rad64.o): config.h
  186.   libshadow.a(lockpw.o):
  187. + libshadow.a(utent.o): config.h
  188.   
  189.   clean:
  190.       -rm -f susetup.c *.o a.out core npasswd nshadow *.pag *.dir pwd.h
  191. Index: useradd.1
  192. *** useradd.1.old    Thu Aug 26 08:05:47 1993
  193. --- useradd.1    Thu Aug 26 08:05:47 1993
  194. ***************
  195. *** 10,16 ****
  196.   .\" This software is provided on an AS-IS basis and the author makes
  197.   .\" no warrantee of any kind.
  198.   .\"
  199. ! .\"    @(#)useradd.1    3.4    07:58:25    06 May 1993
  200.   .\"
  201.   .TH USERADD 1M
  202.   .SH NAME
  203. --- 10,16 ----
  204.   .\" This software is provided on an AS-IS basis and the author makes
  205.   .\" no warrantee of any kind.
  206.   .\"
  207. ! .\"    @(#)useradd.1    3.5    07:45:38    26 Aug 1993
  208.   .\"
  209.   .TH USERADD 1M
  210.   .SH NAME
  211. ***************
  212. *** 35,40 ****
  213. --- 35,41 ----
  214.   [ \fB-b\fI default_home\fR ]
  215.   [ \fB-f\fI default_inactive\fR ]
  216.   [ \fB-e\fI default_exiration\fR ]
  217. + [ \fB-s\fI default_shell\fR ]
  218.   .SH DESCRIPTION
  219.   .SS Creating New Users
  220.   When invoked without the \fB-D\fR option, the \fIuseradd\fR command
  221. ***************
  222. *** 121,126 ****
  223. --- 122,130 ----
  224.   The group name or ID for a new user's initial group.
  225.   The named group must exist, and a numerical group ID must have
  226.   an existing entry .
  227. + .IP "\fB-s \fIdefault_shell\fR"
  228. + The name of the new user's login shell.
  229. + The named program will be used for all future new user accounts.
  230.   .PP
  231.   If no options are specified, \fIuseradd\fR displays the current
  232.   default values.
  233. Index: useradd.c
  234. *** useradd.c.old    Thu Aug 26 08:05:49 1993
  235. --- useradd.c    Thu Aug 26 08:05:49 1993
  236. ***************
  237. *** 13,19 ****
  238.    */
  239.   
  240.   #ifndef lint
  241. ! static    char    sccsid[] = "@(#)useradd.c    3.13    07:59:56    06 May 1993";
  242.   #endif
  243.   
  244.   #include "config.h"
  245. --- 13,19 ----
  246.    */
  247.   
  248.   #ifndef lint
  249. ! static    char    sccsid[] = "@(#)useradd.c    3.14    08:20:53    23 Aug 1993";
  250.   #endif
  251.   
  252.   #include "config.h"
  253. ***************
  254. *** 745,753 ****
  255.   #endif
  256.       if (! out_shell)
  257.   #ifdef    SVR4
  258. !         fprintf (ofp, "defshell=%d\n", def_shell);
  259.   #else
  260. !         fprintf (ofp, "SHELL=%d\n", def_shell);
  261.   #endif
  262.       if (! out_skel)
  263.   #ifdef    SVR4
  264. --- 745,753 ----
  265.   #endif
  266.       if (! out_shell)
  267.   #ifdef    SVR4
  268. !         fprintf (ofp, "defshell=%s\n", def_shell);
  269.   #else
  270. !         fprintf (ofp, "SHELL=%s\n", def_shell);
  271.   #endif
  272.       if (! out_skel)
  273.   #ifdef    SVR4
  274. ***************
  275. *** 860,874 ****
  276.               fprintf (stderr, "%s: unknown group %s\n", Prog, list);
  277.               errors++;
  278.           }
  279.   
  280.           /*
  281.            * Add the GID value from the group file to the user's
  282.            * list of groups.
  283.            */
  284.   
  285.           user_groups[user_ngroups++] = grp->gr_gid;
  286. -         list = cp;
  287.       } while (list);
  288.   
  289.       /*
  290. --- 860,885 ----
  291.               fprintf (stderr, "%s: unknown group %s\n", Prog, list);
  292.               errors++;
  293.           }
  294. +         list = cp;
  295.   
  296. + #ifdef    USE_NIS
  297.           /*
  298. +          * Don't add this group if they are an NIS group.  Tell
  299. +          * the user to go to the server for this group.
  300. +          */
  301. +         if (__isgrNIS ()) {
  302. +             fprintf (stderr, "%s: group `%s' is a NIS group.\n",
  303. +                 Prog, grp->gr_name);
  304. +             continue;
  305. +         }
  306. + #endif
  307. +         /*
  308.            * Add the GID value from the group file to the user's
  309.            * list of groups.
  310.            */
  311.   
  312.           user_groups[user_ngroups++] = grp->gr_gid;
  313.       } while (list);
  314.   
  315.       /*
  316. ***************
  317. *** 967,973 ****
  318. --- 978,986 ----
  319.       pwent->pw_uid = user_id;
  320.       pwent->pw_gid = user_gid;
  321.       pwent->pw_gecos = user_comment;
  322. + #ifdef    ATT_COMMENT
  323.       pwent->pw_comment = "";
  324. + #endif
  325.       pwent->pw_dir = user_home;
  326.       pwent->pw_shell = user_shell;
  327.   }
  328. ***************
  329. *** 1349,1355 ****
  330.                       def_expire = strtoday (optarg);
  331.                   else {
  332.   #ifdef    SHADOWPWD
  333. !                     user_expire = strtoday (optarg);
  334.   #ifdef    ITI_AGING
  335.                       user_expire *= DAY;
  336.   #endif
  337. --- 1362,1368 ----
  338.                       def_expire = strtoday (optarg);
  339.                   else {
  340.   #ifdef    SHADOWPWD
  341. !                     user_expire = atoi (optarg);
  342.   #ifdef    ITI_AGING
  343.                       user_expire *= DAY;
  344.   #endif
  345. ***************
  346. *** 1414,1419 ****
  347. --- 1427,1433 ----
  348.                   }
  349.                   sflg++;
  350.                   strncpy (user_shell, optarg, BUFSIZ);
  351. +                 strncpy (def_shell, user_shell, BUFSIZ);
  352.                   break;
  353.               case 'u':
  354.                   uflg++;
  355. Index: utent.c
  356. *** /tmp/da000W_    Thu Aug 26 07:55:01 1993
  357. --- utent.c    Thu Aug 26 08:05:50 1993
  358. ***************
  359. *** 0 ****
  360. --- 1,107 ----
  361. + /*
  362. +  * Copyright 1993, John F. Haugh II
  363. +  * All rights reserved.
  364. +  *
  365. +  * Permission is granted to copy and create derivative works for any
  366. +  * non-commercial purpose, provided this copyright notice is preserved
  367. +  * in all copies of source code, or included in human readable form
  368. +  * and conspicuously displayed on all copies of object code or
  369. +  * distribution media.
  370. +  *
  371. +  * This software is provided on an AS-IS basis and the author makes
  372. +  * no warrantee of any kind.
  373. +  */
  374. + #include "config.h"
  375. + #ifdef    NEED_UTENT
  376. + #include <stdio.h>
  377. + #include <fcntl.h>
  378. + #include <utmp.h>
  379. + #ifndef    lint
  380. + static    char    sccsid[] = "@(#)utent.c    1.1    08:19:29    23 Aug 1993";
  381. + #endif
  382. + #ifndef    UTMP_FILE
  383. + #define    UTMP_FILE    "/etc/utmp"
  384. + #endif
  385. + static    int    utmp_fd = -1;
  386. + static    struct    utmp    utmp_buf;
  387. + static    struct    utmp    last_utmp_buf;
  388. + /*
  389. +  * setutent - open or rewind the utmp file
  390. +  */
  391. + void
  392. + setutent ()
  393. + {
  394. +     if (utmp_fd == -1)
  395. +         if ((utmp_fd = open (UTMP_FILE, O_RDWR)) == -1)
  396. +             utmp_fd = open (UTMP_FILE, O_RDONLY);
  397. +     if (utmp_fd != -1)
  398. +         lseek (utmp_fd, 0L, 0);
  399. + }
  400. + /*
  401. +  * endutent - close the utmp file
  402. +  */
  403. + void
  404. + endutent ()
  405. + {
  406. +     if (utmp_fd != -1)
  407. +         close (utmp_fd);
  408. +     utmp_fd = -1;
  409. + }
  410. + /*
  411. +  * getutent - get the next record from the utmp file
  412. +  */
  413. + struct utmp *
  414. + getutent ()
  415. + {
  416. +     if (utmp_fd == -1)
  417. +         setutent ();
  418. +     if (utmp_fd == -1)
  419. +         return 0;
  420. +     if (read (utmp_fd, &utmp_buf, sizeof utmp_buf) != sizeof utmp_buf)
  421. +         return 0;
  422. +     last_utmp_buf = utmp_buf;
  423. +     return &utmp_buf;
  424. + }
  425. + /*
  426. +  * getutline - get the utmp entry matching ut_line
  427. +  */
  428. + struct utmp *
  429. + getutline (utent)
  430. + #if defined(__STDC__)
  431. + const    struct    utmp    *utent;
  432. + #else
  433. + struct    utmp    *utent;
  434. + #endif
  435. + {
  436. +     struct    utmp    save;
  437. +     struct    utmp    *new;
  438. +     save = *utent;
  439. +     while (new = getutent ())
  440. +         if (strncmp (new->ut_line, save.ut_line, sizeof new->ut_line))
  441. +             continue;
  442. +         else
  443. +             return new;
  444. +     return (struct utmp *) 0;
  445. + }
  446. + #endif
  447. -- 
  448. John F. Haugh II                  [ PGP 2.1 ] !'s: ...!cs.utexas.edu!rpp386!jfh
  449. Ma Bell: (512) 251-2151     [ DoF #17 ] [ PADI ]     @'s: jfh@rpp386.cactus.org
  450. "The only people who will pay more income taxes are the wealthiest 2 percent,
  451.  those living in households making over $200,000 a year." -- Bill Clinton
  452.  
  453. exit 0 # Just in case...
  454.