home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-02-02 | 62.3 KB | 2,733 lines |
- Newsgroups: comp.sources.misc
- From: jfh@rpp386.cactus.org (John F Haugh II)
- Subject: v28i009: shadow - Shadow Login Suite, Patch02
- Message-ID: <1992Feb2.041641.27504@sparky.imd.sterling.com>
- X-Md4-Signature: 8039136d4efa3407a9f66c0bd8a4f4cc
- Date: Sun, 2 Feb 1992 04:16:41 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: jfh@rpp386.cactus.org (John F Haugh II)
- Posting-number: Volume 28, Issue 9
- Archive-name: shadow/patch02
- Environment: UNIX
- Patch-To: shadow: Volume 26, Issue 54-64
-
- This enclosed patch corrects a number of bugs which were found by various
- users. All users should apply this patch immediately. You must have the
- current Shadow Login Suite code at patchlevel 3.1.1. Another patch will
- be following immediately for SunOS 4.1.1 related changes. It will be bring
- you up to 3.1.3. You may want to wait until then before applying this
- patch.
-
- Patch and enjoy!
-
- Prereq: "3.1.1"
- Index: patchlevel.h
- *** rel3/patchlevel.h Sat Dec 28 19:42:22 1991
- --- patchlevel.h Sat Dec 28 19:42:26 1991
- ***************
- *** 11,18 ****
- * Revision History
- * 11/25/91 3.1.1 patchlevel 14
- * Added "login.defs" to Makefile
- */
-
- #define RELEASE 3
- ! #define PATCHLEVEL 14
- ! #define VERSION "3.1.1"
- --- 11,20 ----
- * Revision History
- * 11/25/91 3.1.1 patchlevel 14
- * Added "login.defs" to Makefile
- + * 12/02/91 3.1.2 patchlevel 15
- + * Bugs found by users
- */
-
- #define RELEASE 3
- ! #define PATCHLEVEL 15
- ! #define VERSION "3.1.2"
- Index: README
- *** rel3/README Sat Dec 28 19:40:37 1991
- --- README Sat Dec 28 19:42:33 1991
- ***************
- *** 1,7 ****
- ! [ @(#)README 3.6 08:27:47 10/31/91 ]
-
- This is the explanatory document for John F. Haugh II's login replacement,
- ! release 3. This document was last updated 10/31/91.
-
- This software is copyright 1988, 1989, 1990, 1991, John F. Haugh II. All
- rights reserved. Use, duplication and disclosure is permitted according
- --- 1,7 ----
- ! [ @(#)README 3.7 11:58:37 12/28/91 ]
-
- This is the explanatory document for John F. Haugh II's login replacement,
- ! release 3. This document was last updated 12/28/91.
-
- This software is copyright 1988, 1989, 1990, 1991, John F. Haugh II. All
- rights reserved. Use, duplication and disclosure is permitted according
- ***************
- *** 12,17 ****
- --- 12,21 ----
- transmission costs. You are free to copy this software provided you
- do not restrict the rights of the recipients to further copy this software.
-
- + This source code is currently archived on ftp.cs.widener.edu in the
- + directory pub/src/adm. The file name is "shadow" followed by the
- + version number.
- +
- THIS SOFTWARE IS BEING DISTRIBUTED AS-IS. THE AUTHORS DISCLAIM ALL
- LIABILITY FOR ANY CONSEQUENCES OF USE. THE USER IS SOLELY RESPONSIBLE
- FOR THE MAINTENANCE OF THIS SOFTWARE PACKAGE. THE AUTHORS ARE UNDER NO
- ***************
- *** 25,31 ****
- Also, thanks for Dennis L. Mumaugh for the initial shadow password
- information and to Tony Walton (olapw@olgb1.oliv.co.uk) for the System
- V Release 4 changes. Effort in porting to SunOS has been contributed
- ! by Dr. Michael Newberry (miken@cs.adfa.oz.au).
-
- New for Release 3:
- The objects are being combined into libraries to make maintenance
- --- 29,36 ----
- Also, thanks for Dennis L. Mumaugh for the initial shadow password
- information and to Tony Walton (olapw@olgb1.oliv.co.uk) for the System
- V Release 4 changes. Effort in porting to SunOS has been contributed
- ! by Dr. Michael Newberry (miken@cs.adfa.oz.au) and Micheal J. Miller, Jr.
- ! (mke@kaberd.rain.com)
-
- New for Release 3:
- The objects are being combined into libraries to make maintenance
- ***************
- *** 46,51 ****
- --- 51,60 ----
- been added. The man pages for these commands have been written
- as well.
-
- + Warning:
- + The newuser command will be removed in a later release.
- + The libsec.a library will be removed in a later release.
- +
- Begin by reading and editing the config.h file. All options are selected
- by using #define's. A brief description for each available option appears
- below. You may want to print this file out as it is LONG and you will
- ***************
- *** 60,65 ****
- --- 69,81 ----
- selected at run time. You should refer to the login.5 manual page for
- more information regarding these options.
-
- + There are several files which you may have to replace. If you system has
- + a lastlog.h file, you should replace the one which I provide with your
- + system version. The pwd.h file that is produced by "make" must agree
- + exactly with the system supplied version. You should re-arrange the
- + fields or #define's until they match. The same is true for "shadow.h",
- + if you system provides one.
- +
- Login Defaults File -
- This option selects the name of the file to read for the
- run-time configurable options. The default value for
- ***************
- *** 204,206 ****
- --- 220,253 ----
- [ this is now possible using chfn and the -o option. i would appreciate
- anyone who is able to confirm that this code runs reasonably on some
- BSD release. - jfh ]
- +
- + SunOS 4.1.1 Notes: (mke@kaberd.rain.com) Michael J. Miller Jr.
- +
- + [ These notes were edited from the original. The standard Makefile
- + and config.h have notes indicating the changes required for SunOS. ]
- +
- + You'll need to do the following to get the shadow password dist to
- + compile on a sun 4.1.1 system.
- +
- + If using csh, then type 'rehash'. cd to the /etc directory and type
- + 'pwconv'. This will create two files, nshadow and npasswd.
- + now type 'mkpasswd -f nshadow' and 'mkpasswd -f npasswd'. This will
- + create the shadow password file.
- +
- + Note: The shadow group stuff does not work with sunos.
- +
- + Note: ftp will still use the old password file.
- +
- + Note: if you run suns pcnfs, be aware that it will still be looking at the
- + old password file as well. I may work out a patch for this, as I am
- + fairly certain the stuff on the sun side comes with source.
- +
- + Note: I have compiled this package with the standard c compiler and
- + suns unbundled c compiler at an optomization level of 2 in
- + both casses. Haven't tried gcc yet, so I don't know wether it
- + works. Same goes for suns C++ compiler.
- +
- + Note: has been compiled on a sun 3/75 running sunos 4.1.1. Should compile
- + fine on sun 4's running 4.1.1, and may compile on suns running
- + 4.1. Have no idea what sort of success people will have that
- + are running 4.03 and older versions.
- Index: Makefile
- *** rel3/Makefile Sat Dec 28 19:42:24 1991
- --- Makefile Sat Dec 28 19:42:37 1991
- ***************
- *** 8,16 ****
- # and conspicuously displayed on all copies of object code or
- # distribution media.
- #
- ! # @(#)Makefile 3.25 09:47:59 - Shadow password system
- #
- ! # @(#)Makefile 3.25 09:47:59 11/25/91
- #
- SHELL = /bin/sh
-
- --- 8,16 ----
- # and conspicuously displayed on all copies of object code or
- # distribution media.
- #
- ! # @(#)Makefile 3.25.1.3 19:39:43 - Shadow password system
- #
- ! # @(#)Makefile 3.25.1.3 19:39:43 12/28/91
- #
- SHELL = /bin/sh
-
- ***************
- *** 22,47 ****
- RELEASE = 3
- GFLAGS = -t -r$(RELEASE)
-
- ! # Define the directory login is copied to. BE VERY CAREFUL!!! BSD and SUN
- ! # seems to use /bin, USG seems to use /etc. If you define SCOLOGIN, you
- ! # MUST use /etc as LOGINDIR.
- # LOGINDIR = /bin
- LOGINDIR = /etc
-
- # Define any special libraries required to access the directory routines.
- # NDIR = -lndir
- NDIR = -lx
-
- # Pick your favorite C compiler and tags command
- CC = cc
- TAGS = ctags
-
- ! # OS. Pick one of USG (AT&T, SYSV, SYS3), BSD, or SUN.
- OS = -DUSG
- # OS = -DBSD
- # OS = -DSUN
-
- ! # Do you have to do ranlib? Sorry to hear that ...
- RANLIB = ranlib
- # RANLIB = echo
-
- --- 22,54 ----
- RELEASE = 3
- GFLAGS = -t -r$(RELEASE)
-
- ! # Define the directory login is copied to. BE VERY CAREFUL!!! BSD old SunOS
- ! # seems to use /bin, USG seems to use /etc, SunOS 4.1.1 seems to use /usr/bin.
- ! # If you define SCOLOGIN, you MUST use /etc as LOGINDIR.
- # LOGINDIR = /bin
- LOGINDIR = /etc
- + # LOGINDIR = /usr/bin
-
- # Define any special libraries required to access the directory routines.
- + # Some systems require -lndir for the directory routines. SCO Xenix uses
- + # -lx for that. Your system might need nothing.
- # NDIR = -lndir
- NDIR = -lx
- + # NDIR =
-
- # Pick your favorite C compiler and tags command
- CC = cc
- TAGS = ctags
-
- ! # OS. Pick one of USG (AT&T, SYSV, SYS3), BSD, SUN (SunOS 2 and 3),
- ! # or SUN4 (SunOS 4.1.1.).
- ! # OS = -DUSG -DSYS3
- OS = -DUSG
- # OS = -DBSD
- # OS = -DSUN
- + # OS = -DSUN4
-
- ! # Do you have to do ranlib (probably SUN, BSD and XENIX)?
- RANLIB = ranlib
- # RANLIB = echo
-
- ***************
- *** 51,56 ****
- --- 58,64 ----
-
- # Configuration Flags
- #
- + # DEST_INCLUDE_DIR - local include files
- # LIBS - system libraries
- # -lsocket - needed for TCP/IP and possibly SYSLOG
- # -ldbm or -lndbm - needed for DBM support
- ***************
- *** 58,81 ****
- # CFLAGS - C compiler flags
- # -DLAI_TCP - needed for SCO Xenix Lachman TCP/IP
-
- # Flags for SCO Xenix/386
- ! CFLAGS = -O -M3 -g $(OS)
- LIBS = -lcrypt -lndbm
- # LIBS = -lcrypt -ldbm
- LDFLAGS = -M3 -g
- LTFLAGS =
- - # This should be Slibsec.a for small model, or Llibsec.a for
- - # large model or whatever. MUST AGREE WITH CFLAGS!!!
- - LIBSEC = Slibsec.a
-
- # Flags for normal machines
- ! # CFLAGS = -O -g $(OS)
- # LIBS =
- # LDFLAGS = -g
- # LIBSEC = libsec.a
-
- # Names for root user and group, and bin user and group. See your
- ! # /etc/passwd and /etc/group files.
- RUID = root
- RGID = root
- # RGID = wheel
- --- 66,99 ----
- # CFLAGS - C compiler flags
- # -DLAI_TCP - needed for SCO Xenix Lachman TCP/IP
-
- + DEST_INCLUDE_DIR = /usr/include
- +
- # Flags for SCO Xenix/386
- ! CFLAGS = -O -M3 -g $(OS) -I$(DEST_INCLUDE_DIR)
- LIBS = -lcrypt -lndbm
- # LIBS = -lcrypt -ldbm
- LDFLAGS = -M3 -g
- LTFLAGS =
-
- # Flags for normal machines
- ! # CFLAGS = -O -g $(OS) -I$(DEST_INCLUDE_DIR)
- # LIBS =
- # LDFLAGS = -g
- +
- + # Flags for SunOS 4.1.1
- + # CFLAGS = -O2 $(OS)
- + # LIBS =
- + # LDFLAGS =
- +
- + # This should be Slibsec.a for small model, or Llibsec.a for
- + # large model or whatever. MUST AGREE WITH CFLAGS!!! For non-Intel
- + # machines, just use libsec.a
- + LIBSEC = Slibsec.a
- # LIBSEC = libsec.a
-
- # Names for root user and group, and bin user and group. See your
- ! # /etc/passwd and /etc/group files. BSD and SUN use "wheel", most
- ! # others use "root" for RGID.
- RUID = root
- RGID = root
- # RGID = wheel
- ***************
- *** 82,87 ****
- --- 100,108 ----
- BUID = bin
- BGID = bin
-
- + # Where the login.defs file will be copied. Must agree with config.h
- + DEST_LOGIN_DEFS = /etc/login.defs
- +
- # Rules for .L (lint) files.
- .SUFFIXES: .L
- LINT = lint
- ***************
- *** 180,185 ****
- --- 201,208 ----
- FILES9 = groupadd.c groupdel.c groupmod.c tz.c console.c hushed.c getdef.c \
- scologin.c logoutd.c sulog.c getpass.c userdel.c
-
- + FILES_SUN = Makefile.sun4 README.sun4 config.h.sun4
- +
- MAN_1 = chage.1 chfn.1 chsh.1 id.1 login.1 newgrp.1 passwd.1 su.1 \
- useradd.1 userdel.1 usermod.1 groupadd.1 groupdel.1 groupmod.1 \
- groups.1
- ***************
- *** 237,243 ****
- cp mkpasswd pwconv pwunconv sulogin chpasswd newusers \
- useradd userdel usermod groupadd groupdel groupmod logoutd /etc
- cp su passwd gpasswd dpasswd faillog newgrp chfn chsh chage id /bin
- ! cp dialup.h shadow.h pwd.h /usr/include
- chown $(RUID) $(LOGINDIR)/login /etc/pwconv /etc/pwunconv /etc/sulogin \
- /bin/su /bin/passwd /bin/gpasswd /bin/newgrp /etc/mkpasswd \
- /bin/dpasswd /bin/chsh /bin/chfn /bin/chage /etc/useradd \
- --- 260,266 ----
- cp mkpasswd pwconv pwunconv sulogin chpasswd newusers \
- useradd userdel usermod groupadd groupdel groupmod logoutd /etc
- cp su passwd gpasswd dpasswd faillog newgrp chfn chsh chage id /bin
- ! cp dialup.h shadow.h pwd.h $(DEST_INCLUDE_DIR)
- chown $(RUID) $(LOGINDIR)/login /etc/pwconv /etc/pwunconv /etc/sulogin \
- /bin/su /bin/passwd /bin/gpasswd /bin/newgrp /etc/mkpasswd \
- /bin/dpasswd /bin/chsh /bin/chfn /bin/chage /etc/useradd \
- ***************
- *** 248,257 ****
- /bin/dpasswd /bin/chsh /bin/chfn /bin/chage /etc/useradd \
- /etc/userdel /etc/usermod /etc/groupadd /etc/groupdel \
- /etc/groupmod /etc/logoutd
- ! chown $(BUID) /bin/faillog /bin/id /usr/include/shadow.h \
- ! /usr/include/dialup.h /usr/include/pwd.h
- ! chgrp $(BGID) /bin/faillog /bin/id /usr/include/shadow.h \
- ! /usr/include/dialup.h /usr/include/pwd.h
- chmod 700 /etc/pwconv /etc/pwunconv /etc/sulogin /etc/mkpasswd \
- /etc/chpasswd /etc/newusers /bin/dpasswd /bin/chage \
- /etc/useradd /etc/userdel /etc/usermod /etc/groupadd \
- --- 271,280 ----
- /bin/dpasswd /bin/chsh /bin/chfn /bin/chage /etc/useradd \
- /etc/userdel /etc/usermod /etc/groupadd /etc/groupdel \
- /etc/groupmod /etc/logoutd
- ! chown $(BUID) /bin/faillog /bin/id $(DEST_INCLUDE_DIR)/shadow.h \
- ! $(DEST_INCLUDE_DIR)/dialup.h $(DEST_INCLUDE_DIR)/pwd.h
- ! chgrp $(BGID) /bin/faillog /bin/id $(DEST_INCLUDE_DIR)/shadow.h \
- ! $(DEST_INCLUDE_DIR)/dialup.h $(DEST_INCLUDE_DIR)/pwd.h
- chmod 700 /etc/pwconv /etc/pwunconv /etc/sulogin /etc/mkpasswd \
- /etc/chpasswd /etc/newusers /bin/dpasswd /bin/chage \
- /etc/useradd /etc/userdel /etc/usermod /etc/groupadd \
- ***************
- *** 259,270 ****
- chmod 4711 $(LOGINDIR)/login /bin/su /bin/passwd /bin/gpasswd \
- /bin/newgrp /bin/chfn /bin/chsh
- chmod 711 /bin/faillog /bin/id
- ! chmod 444 /usr/include/shadow.h /usr/include/dialup.h \
- ! /usr/include/pwd.h
- ! [ -f /etc/login.defs ] || (cp login.defs /etc ; \
- ! chown $(RUID) /etc/login.defs ; \
- ! chgrp $(RGID) /etc/login.defs ; \
- ! chmod 600 /etc/login.defs )
- [ -z "$(SCOLOGIN)" ] || (cp scologin /bin/login ; \
- chown $(RUID) /bin/login ; \
- chgrp $(RGID) /bin/login ; \
- --- 282,293 ----
- chmod 4711 $(LOGINDIR)/login /bin/su /bin/passwd /bin/gpasswd \
- /bin/newgrp /bin/chfn /bin/chsh
- chmod 711 /bin/faillog /bin/id
- ! chmod 444 $(DEST_INCLUDE_DIR)/shadow.h $(DEST_INCLUDE_DIR)/dialup.h \
- ! $(DEST_INCLUDE_DIR)/pwd.h
- ! [ -f $(DEST_LOGIN_DEFS) ] || (cp $(DEST_LOGIN_DEFS) /etc ; \
- ! chown $(RUID) $(DEST_LOGIN_DEFS) ; \
- ! chgrp $(RGID) $(DEST_LOGIN_DEFS) ; \
- ! chmod 600 $(DEST_LOGIN_DEFS) )
- [ -z "$(SCOLOGIN)" ] || (cp scologin /bin/login ; \
- chown $(RUID) /bin/login ; \
- chgrp $(RGID) /bin/login ; \
- ***************
- *** 273,280 ****
- lint: su.lint login.lint pwconv.lint pwunconv.lint passwd.lint sulogin.lint \
- faillog.lint newgrp.lint gpasswd.lint mkpasswd.lint chfn.lint \
- chsh.lint chage.lint dpasswd.lint id.lint useradd.lint userdel.lint \
- ! usermod.lint groupadd.lint groupdel.lint groupmod.lint $(ALLSRCS:.c=.L)
- ! logoutd.lint
-
- tags: $(ALLSRCS)
- $(TAGS) $(ALLSRCS)
- --- 296,303 ----
- lint: su.lint login.lint pwconv.lint pwunconv.lint passwd.lint sulogin.lint \
- faillog.lint newgrp.lint gpasswd.lint mkpasswd.lint chfn.lint \
- chsh.lint chage.lint dpasswd.lint id.lint useradd.lint userdel.lint \
- ! usermod.lint groupadd.lint groupdel.lint groupmod.lint logoutd.lint \
- ! $(ALLSRCS:.c=.L)
-
- tags: $(ALLSRCS)
- $(TAGS) $(ALLSRCS)
- ***************
- *** 388,394 ****
- $(LINT) $(LINTFLAGS) id.c > id.lint
-
- groups: groups.o libshadow.a
- ! $(CC) -c $(CFLAGS) groups.o libshadow.a $(LIBS)
-
- groups.lint: groups.c
- $(LINT) $(LINTFLAGS) groups.c > groups.lint
- --- 411,417 ----
- $(LINT) $(LINTFLAGS) id.c > id.lint
-
- groups: groups.o libshadow.a
- ! $(CC) -o groups $(LDFLAGS) groups.o libshadow.a $(LIBS)
-
- groups.lint: groups.c
- $(LINT) $(LINTFLAGS) groups.c > groups.lint
- ***************
- *** 436,442 ****
- [ -f s.pwd.h.m4 ] && get -t -r$(RELEASE) s.pwd.h.m4
-
- pwd.h: pwd.h.m4
- ! m4 $(OS) pwd.h.m4 >pwd.h
-
- logoutd: logoutd.o libshadow.a
- $(CC) -o logoutd $(LDFLAGS) logoutd.o libshadow.a
- --- 459,465 ----
- [ -f s.pwd.h.m4 ] && get -t -r$(RELEASE) s.pwd.h.m4
-
- pwd.h: pwd.h.m4
- ! m4 $(OS) < pwd.h.m4 > pwd.h
-
- logoutd: logoutd.o libshadow.a
- $(CC) -o logoutd $(LDFLAGS) logoutd.o libshadow.a
- ***************
- *** 449,455 ****
- susetup.c: setup.c
- cp setup.c susetup.c
-
- ! susetup.o: config.h setup.c pwd.h
- $(CC) -c $(CFLAGS) -DSU susetup.c
-
- scologin: scologin.o
- --- 472,478 ----
- susetup.c: setup.c
- cp setup.c susetup.c
-
- ! susetup.o: config.h susetup.c pwd.h
- $(CC) -c $(CFLAGS) -DSU susetup.c
-
- scologin: scologin.o
- ***************
- *** 522,528 ****
-
- shar: login.sh.01 login.sh.02 login.sh.03 login.sh.04 login.sh.05 \
- login.sh.06 login.sh.07 login.sh.08 login.sh.09 login.sh.10 \
- ! login.sh.11
-
- login.sh.01: $(FILES1) Makefile
- shar -a $(FILES1) > login.sh.01
- --- 545,551 ----
-
- shar: login.sh.01 login.sh.02 login.sh.03 login.sh.04 login.sh.05 \
- login.sh.06 login.sh.07 login.sh.08 login.sh.09 login.sh.10 \
- ! login.sh.11 login.sh.12
-
- login.sh.01: $(FILES1) Makefile
- shar -a $(FILES1) > login.sh.01
- ***************
- *** 556,558 ****
- --- 579,584 ----
-
- login.sh.11: $(DOCS2) Makefile
- shar -a $(DOCS2) > login.sh.11
- +
- + login.sh.12: $(FILES_SUN) Makefile
- + shar -a $(FILES_SUN) > login.sh.12
- Index: pwdbm.c
- *** rel3/pwdbm.c Sat Dec 28 19:41:15 1991
- --- pwdbm.c Sat Dec 28 19:42:39 1991
- ***************
- *** 10,16 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)pwdbm.c 3.5 09:29:30 6/6/91";
- #endif
-
- #ifdef BSD
- --- 10,16 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)pwdbm.c 3.6 12:10:31 12/28/91";
- #endif
-
- #ifdef BSD
- ***************
- *** 109,114 ****
- --- 109,115 ----
- {
- datum key;
- static int once;
- + char data[BUFSIZ];
-
- if (! once) {
- #ifdef NDBM
- Index: useradd.c
- *** rel3/useradd.c Sat Dec 28 19:41:44 1991
- --- useradd.c Sat Dec 28 19:42:41 1991
- ***************
- *** 10,18 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)useradd.c 3.6 14:38:26 10/27/91";
- #endif
-
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <stdio.h>
- --- 10,19 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)useradd.c 3.8 19:40:07 12/28/91";
- #endif
-
- + #include "config.h"
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <stdio.h>
- ***************
- *** 29,35 ****
- #include <string.h>
- #endif
-
- - #include "config.h"
- #include "shadow.h"
-
- #ifdef USE_SYSLOG
- --- 30,35 ----
- ***************
- *** 547,553 ****
- return -1;
- }
- #ifdef USE_SYSLOG
- ! syslog (LOG_INFO, "defaults: group=%d, home=%s, inactive=%d, expire=%d",
- def_group, def_home, def_inactive, def_expire);
- #endif
- return 0;
- --- 547,554 ----
- return -1;
- }
- #ifdef USE_SYSLOG
- ! syslog (LOG_INFO,
- ! "defaults: group=%d, home=%s, inactive=%d, expire=%d\n",
- def_group, def_home, def_inactive, def_expire);
- #endif
- return 0;
- ***************
- *** 709,715 ****
- --- 710,718 ----
- {
- int i;
- struct group *grp;
- + #ifdef SHADOWGRP
- struct sgrp *sgrp;
- + #endif
-
- /*
- * Lock and open the group file. This will load all of the group
- ***************
- *** 969,975 ****
- Prog, optarg);
- exit (1);
- }
- ! user_gid = grp->gr_gid;
- break;
- case 'G':
- Gflg++;
- --- 972,981 ----
- Prog, optarg);
- exit (1);
- }
- ! if (Dflg)
- ! def_group = grp->gr_gid;
- ! else
- ! user_gid = grp->gr_gid;
- break;
- case 'G':
- Gflg++;
- ***************
- *** 1192,1205 ****
- #endif
-
- /*
- ! * The open routines for the DBM files don't use read-write
- * as the mode, so we have to clue them in.
- */
-
- - #if defined(DBM) || defined(NDBM)
- - pw_dbm_mode = O_RDWR;
- - #endif
- #ifdef NDBM
- sp_dbm_mode = O_RDWR;
- gr_dbm_mode = O_RDWR;
- #ifdef SHADOWGRP
- --- 1198,1209 ----
- #endif
-
- /*
- ! * The open routines for the NDBM files don't use read-write
- * as the mode, so we have to clue them in.
- */
-
- #ifdef NDBM
- + pw_dbm_mode = O_RDWR;
- sp_dbm_mode = O_RDWR;
- gr_dbm_mode = O_RDWR;
- #ifdef SHADOWGRP
- Index: usermod.c
- *** rel3/usermod.c Sat Dec 28 19:41:46 1991
- --- usermod.c Sat Dec 28 19:42:44 1991
- ***************
- *** 10,16 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)usermod.c 3.5 14:38:40 10/27/91";
- #endif
-
- #include <sys/types.h>
- --- 10,16 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)usermod.c 3.8 19:40:17 12/28/91";
- #endif
-
- #include <sys/types.h>
- ***************
- *** 31,36 ****
- --- 31,38 ----
-
- #include "config.h"
- #include "shadow.h"
- + #include <faillog.h>
- + #include <lastlog.h>
-
- #ifdef USE_SYSLOG
- #include <syslog.h>
- ***************
- *** 473,495 ****
- new_pwent (pwent)
- struct passwd *pwent;
- {
- ! if (lflg)
- pwent->pw_name = strdup (user_newname);
- !
- ! if (uflg)
- pwent->pw_uid = user_newid;
- !
- ! if (gflg)
- pwent->pw_gid = user_gid;
- !
- if (cflg)
- pwent->pw_gecos = strdup (user_comment);
-
- ! if (dflg)
- pwent->pw_dir = strdup (user_newhome);
- !
- ! if (sflg)
- pwent->pw_shell = strdup (user_shell);
- }
-
- /*
- --- 475,518 ----
- new_pwent (pwent)
- struct passwd *pwent;
- {
- ! if (lflg) {
- ! #ifdef USE_SYSLOG
- ! syslog (LOG_INFO, "change user name `%s' to `%s'\n",
- ! pwent->pw_name, user_newname);
- ! #endif
- pwent->pw_name = strdup (user_newname);
- ! }
- ! if (uflg) {
- ! #ifdef USE_SYSLOG
- ! syslog (LOG_INFO, "change user `%s' UID from `%d' to `%d'\n",
- ! pwent->pw_name, pwent->pw_uid, user_newid);
- ! #endif
- pwent->pw_uid = user_newid;
- ! }
- ! if (gflg) {
- ! #ifdef USE_SYSLOG
- ! syslog (LOG_INFO, "change user `%s' GID from `%d' to `%d'\n",
- ! pwent->pw_name, pwent->pw_gid, user_gid);
- ! #endif
- pwent->pw_gid = user_gid;
- ! }
- if (cflg)
- pwent->pw_gecos = strdup (user_comment);
-
- ! if (dflg) {
- ! #ifdef USE_SYSLOG
- ! syslog (LOG_INFO, "change user `%s' home from `%s' to `%s'\n",
- ! pwent->pw_name, pwent->pw_dir, user_newhome);
- ! #endif
- pwent->pw_dir = strdup (user_newhome);
- ! }
- ! if (sflg) {
- ! #ifdef USE_SYSLOG
- ! syslog (LOG_INFO, "change user `%s' shell from `%s' to `%s'\n",
- ! pwent->pw_name, pwent->pw_shell, user_shell);
- ! #endif
- pwent->pw_shell = strdup (user_shell);
- + }
- }
-
- /*
- ***************
- *** 506,513 ****
- if (lflg)
- spent->sp_namp = strdup (user_newname);
-
- ! spent->sp_inact = user_inactive;
- ! spent->sp_expire = user_expire;
- }
-
- /*
- --- 529,548 ----
- if (lflg)
- spent->sp_namp = strdup (user_newname);
-
- ! if (fflg) {
- ! #ifdef USE_SYSLOG
- ! syslog (LOG_INFO, "change user `%s' inactive from `%d' to `%d'\n",
- ! spent->sp_namp, spent->sp_inact, user_inactive);
- ! #endif
- ! spent->sp_inact = user_inactive;
- ! }
- ! if (eflg) {
- ! #ifdef USE_SYSLOG
- ! syslog (LOG_INFO, "change user `%s' expiration from `%d' to `%d'\n",
- ! spent->sp_namp, spent->sp_expire, user_expire);
- ! #endif
- ! spent->sp_expire = user_expire;
- ! }
- }
-
- /*
- ***************
- *** 523,531 ****
- int i;
- int is_member;
- int was_member;
- - int was_admin;
- struct group *grp;
- struct sgrp *sgrp;
-
- /*
- * Lock and open the group file. This will load all of the group
- --- 558,568 ----
- int i;
- int is_member;
- int was_member;
- struct group *grp;
- + #ifdef SHADOWGRP
- + int was_admin;
- struct sgrp *sgrp;
- + #endif
-
- /*
- * Lock and open the group file. This will load all of the group
- ***************
- *** 1076,1084 ****
- /*
- * move_home - move the user's home directory
- *
- ! * move_home() creates the user's home directory if it does not
- ! * already exist. It will be created mode 755 owned by the user
- ! * with the user's default group.
- */
-
- move_home ()
- --- 1113,1121 ----
- /*
- * move_home - move the user's home directory
- *
- ! * move_home() moves the user's home directory to a new location.
- ! * The files will be copied if the directory cannot simply be
- ! * renamed.
- */
-
- move_home ()
- ***************
- *** 1118,1124 ****
- }
-
- /*
- ! * main - useradd command
- */
-
- main (argc, argv)
- --- 1155,1200 ----
- }
-
- /*
- ! * update_files - update the lastlog and faillog files
- ! */
- !
- ! update_files ()
- ! {
- ! struct lastlog ll;
- ! struct faillog fl;
- ! int fd;
- !
- ! /*
- ! * Relocate the "lastlog" entries for the user. The old entry
- ! * is left alone in case the UID was shared. It doesn't hurt
- ! * anything to just leave it be.
- ! */
- !
- ! if ((fd = open ("/usr/adm/lastlog", O_RDWR)) != -1) {
- ! lseek (fd, (long) user_id * sizeof ll, 0);
- ! if (read (fd, &ll, sizeof ll) == sizeof ll) {
- ! lseek (fd, (long) user_newid * sizeof ll, 0);
- ! write (fd, &ll, sizeof ll);
- ! }
- ! close (fd);
- ! }
- !
- ! /*
- ! * Relocate the "faillog" entries in the same manner.
- ! */
- !
- ! if ((fd = open (FAILFILE, O_RDWR)) != -1) {
- ! lseek (fd, (long) user_id * sizeof fl, 0);
- ! if (read (fd, &fl, sizeof fl) == sizeof fl) {
- ! lseek (fd, (long) user_newid * sizeof ll, 0);
- ! write (fd, &fl, sizeof fl);
- ! }
- ! close (fd);
- ! }
- ! }
- !
- ! /*
- ! * main - usermod command
- */
-
- main (argc, argv)
- ***************
- *** 1139,1152 ****
- #endif
-
- /*
- ! * The open routines for the DBM files don't use read-write
- * as the mode, so we have to clue them in.
- */
-
- - #if defined(DBM) || defined(NDBM)
- - pw_dbm_mode = O_RDWR;
- - #endif
- #ifdef NDBM
- sp_dbm_mode = O_RDWR;
- gr_dbm_mode = O_RDWR;
- #ifdef SHADOWGRP
- --- 1215,1226 ----
- #endif
-
- /*
- ! * The open routines for the NDBM files don't use read-write
- * as the mode, so we have to clue them in.
- */
-
- #ifdef NDBM
- + pw_dbm_mode = O_RDWR;
- sp_dbm_mode = O_RDWR;
- gr_dbm_mode = O_RDWR;
- #ifdef SHADOWGRP
- ***************
- *** 1168,1173 ****
- --- 1242,1250 ----
-
- if (mflg)
- move_home ();
- +
- + if (uflg)
- + update_files ();
-
- exit (0);
- /*NOTREACHED*/
- Index: lmain.c
- *** rel3/lmain.c Sat Dec 28 19:40:52 1991
- --- lmain.c Sat Dec 28 19:42:48 1991
- ***************
- *** 9,14 ****
- --- 9,15 ----
- * distribution media.
- */
-
- + #include "config.h"
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <stdio.h>
- ***************
- *** 29,36 ****
- #else
- #include <sgtty.h>
- #endif
- ! #include "config.h"
- ! #include "lastlog.h"
- #include "faillog.h"
- #include "shadow.h"
-
- --- 30,36 ----
- #else
- #include <sgtty.h>
- #endif
- ! #include <lastlog.h>
- #include "faillog.h"
- #include "shadow.h"
-
- ***************
- *** 47,53 ****
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)lmain.c 3.15 14:38:18 10/27/91";
- #endif
-
- /* danger - side effects */
- --- 47,53 ----
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)lmain.c 3.17 19:39:58 12/28/91";
- #endif
-
- /* danger - side effects */
- ***************
- *** 68,74 ****
- int hflg;
- #endif
- int preauth_flag;
- ! #ifndef BSD
- struct termio termio;
- #endif
-
- --- 68,74 ----
- int hflg;
- #endif
- int preauth_flag;
- ! #if defined(USG) || defined(SUN4)
- struct termio termio;
- #endif
-
- ***************
- *** 178,187 ****
- if (cp = strchr (term, '/'))
- *cp = '\0';
-
- if (! (pwd = getpwnam (name)))
- return 0;
-
- ! return ruserok (remote_host, pwd->pw_uid == 0, remote_name, name);
- }
-
- get_remote_string (buf, size)
- --- 178,203 ----
- if (cp = strchr (term, '/'))
- *cp = '\0';
-
- + #if defined(USG) || defined(SUN4)
- + (void) ioctl (0, TCGETA, &termio);
- +
- + termio.c_iflag |= ICRNL|IXON;
- + termio.c_oflag |= OPOST|ONLCR;
- + termio.c_lflag |= ICANON|ECHO|ECHOE;
- + (void) ioctl (0, TCSETA, &termio);
- + #endif
- if (! (pwd = getpwnam (name)))
- return 0;
-
- ! /*
- ! * ruserok() returns 0 for success on modern systems, and 1 on
- ! * older ones. If you are having trouble with people logging
- ! * in without giving a required password, THIS is the culprit -
- ! * go fix the #define in config.h.
- ! */
- !
- ! return ruserok (remote_host, pwd->pw_uid == 0,
- ! remote_name, name) == RUSEROK;
- }
-
- get_remote_string (buf, size)
- ***************
- *** 226,237 ****
- {
- char name[32];
- char pass[32];
- - char hush[BUFSIZ];
- char tty[BUFSIZ];
- int retries;
- int failed;
- int flag;
- - int i;
- int subroot = 0;
- char *fname;
- char *cp;
- --- 242,251 ----
- ***************
- *** 374,379 ****
- --- 388,394 ----
- top:
- (void) alarm (ALARM); /* only allow ALARM sec. for login */
-
- + environ = newenvp; /* make new environment active */
- retries = RETRIES;
- while (1) { /* repeatedly get login/password pairs */
- pass[0] = '\0';
- ***************
- *** 448,454 ****
- --- 463,471 ----
- * been authenticated and so on.
- */
-
- + #ifdef RLOGIN
- have_name:
- + #endif
- if (getdef_bool("DIALUPS_CHECK_ENAB")) {
- alarm (30);
- if (pwent.pw_name &&
- ***************
- *** 510,517 ****
- else
- STRFCPY (failent.ut_name, "UNKNOWN");
- time (&failent.ut_time);
- failent.ut_type = USER_PROCESS;
- !
- failtmp (&failent);
- }
-
- --- 527,535 ----
- else
- STRFCPY (failent.ut_name, "UNKNOWN");
- time (&failent.ut_time);
- + #ifdef USG_UTMP
- failent.ut_type = USER_PROCESS;
- ! #endif
- failtmp (&failent);
- }
-
- ***************
- *** 554,562 ****
- #endif
- exit (0);
- }
- -
- - environ = newenvp; /* make new environment active */
- -
- if (getenv ("IFS")) /* don't export user IFS ... */
- addenv ("IFS= \t\n"); /* ... instead, set a safe IFS */
-
- --- 572,577 ----
- Index: smain.c
- *** rel3/smain.c Sat Dec 28 19:40:58 1991
- --- smain.c Sat Dec 28 19:42:51 1991
- ***************
- *** 13,19 ****
- #include <stdio.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)smain.c 3.9 08:27:43 10/31/91";
- #endif
-
- /*
- --- 13,19 ----
- #include <stdio.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)smain.c 3.10 12:04:52 12/28/91";
- #endif
-
- /*
- ***************
- *** 21,27 ****
- * kept right here
- */
-
- ! #ifdef USG
- #include <string.h>
- #include <memory.h>
- #define bzero(a,n) memset(a, 0, n)
- --- 21,28 ----
- * kept right here
- */
-
- ! #include "config.h"
- ! #if defined(USG) || defined(SUN4)
- #include <string.h>
- #include <memory.h>
- #define bzero(a,n) memset(a, 0, n)
- ***************
- *** 34,40 ****
- #endif
-
- #include <signal.h>
- - #include "config.h"
- #include "lastlog.h"
- #include "pwd.h"
- #include "shadow.h"
- --- 35,40 ----
- ***************
- *** 127,134 ****
- void die (killed)
- int killed;
- {
- ! #ifdef BSD
- ! static struct sgtty sgtty;
-
- if (killed)
- stty (0, &sgtty);
- --- 127,134 ----
- void die (killed)
- int killed;
- {
- ! #if defined(BSD) || defined(SUN)
- ! static struct sgttyb sgtty;
-
- if (killed)
- stty (0, &sgtty);
- ***************
- *** 236,241 ****
- --- 236,253 ----
-
- if (fakelogin && (cp=getdef_str("ENV_HZ")) )
- addenv (cp); /* set the default $HZ, if one */
- +
- + /*
- + * The terminal type will be left alone if it is present in the
- + * environment already.
- + */
- +
- + if (fakelogin && (cp = getenv ("TERM"))) {
- + char term[BUFSIZ];
- +
- + sprintf (term, "TERM=%s", cp);
- + addenv (term);
- + }
-
- /*
- * The next argument must be either a user ID, or some flag to
- Index: logoutd.c
- *** rel3/logoutd.c Sat Dec 28 19:41:53 1991
- --- logoutd.c Sat Dec 28 19:42:52 1991
- ***************
- *** 1,6 ****
- /*
- * Copyright 1991, John F. Haugh II
- - * An unpublished work.
- * All rights reserved.
- *
- * Permission is granted to copy and create derivative works for any
- --- 1,5 ----
- ***************
- *** 11,17 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)logoutd.c 3.1 16:31:39 9/22/91";
- #endif
-
- #include <sys/types.h>
- --- 10,16 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)logoutd.c 3.2 11:50:28 12/28/91";
- #endif
-
- #include <sys/types.h>
- ***************
- *** 18,23 ****
- --- 17,23 ----
- #include <stdio.h>
- #include <signal.h>
- #include <utmp.h>
- + #include "config.h"
-
- main ()
- {
- ***************
- *** 24,35 ****
- --- 24,44 ----
- int i;
- struct utmp utmp;
- int fd;
- + #if defined(BSD) || defined(SUN) || defined(SUN4)
- + char tty_name[BUFSIZ];
- + int tty_fd;
- + #endif
-
- for (i = 0;close (i) == 0;i++)
- ;
-
- #ifdef NDEBUG
- + #ifdef USG
- setpgrp ();
- + #endif
- + #if defined(BSD) || defined(SUN) || defined(SUN4)
- + setpgid (getpid ());
- + #endif
- signal (SIGHUP, SIG_IGN);
-
- if (fork () > 0)
- ***************
- *** 43,57 ****
- continue;
-
- while (read (fd, &utmp, sizeof utmp) == sizeof utmp) {
- if (utmp.ut_type != USER_PROCESS)
- continue;
- !
- if (isttytime (utmp.ut_user, utmp.ut_line, time (0)))
- continue;
- !
- kill (- utmp.ut_pid, SIGHUP);
- sleep (10);
- kill (- utmp.ut_pid, SIGKILL);
- }
- close (fd);
- }
- --- 52,86 ----
- continue;
-
- while (read (fd, &utmp, sizeof utmp) == sizeof utmp) {
- + #ifdef USG_UTMP
- if (utmp.ut_type != USER_PROCESS)
- continue;
- ! #endif
- ! #ifdef BSD_UTMP
- ! if (utmp.ut_user[0] == '\0')
- ! continue;
- ! #endif
- if (isttytime (utmp.ut_user, utmp.ut_line, time (0)))
- continue;
- ! #ifdef USG_UTMP
- kill (- utmp.ut_pid, SIGHUP);
- sleep (10);
- kill (- utmp.ut_pid, SIGKILL);
- + #endif
- + #if defined(BSD) || defined(SUN) || defined(SUN4)
- +
- + /*
- + * vhangup() the line to kill try and kill
- + * whatever is out there using it.
- + */
- +
- + strcat (strcpy (tty_name, "/dev/"), utmp.ut_line);
- + if ((tty_fd = open (tty_name, O_RDONLY|O_NDELAY)) == -1)
- + continue;
- +
- + vhangup (tty_fd);
- + close (tty_fd);
- + #endif
- }
- close (fd);
- }
- Index: utmp.c
- *** rel3/utmp.c Sat Dec 28 19:41:33 1991
- --- utmp.c Sat Dec 28 19:42:54 1991
- ***************
- *** 24,30 ****
- #include <stdio.h>
- #include "config.h"
-
- ! #if defined(SUN) || defined(BSD)
- #ifndef WTMP_FILE
- #define WTMP_FILE "/usr/adm/wtmp"
- #endif
- --- 24,30 ----
- #include <stdio.h>
- #include "config.h"
-
- ! #if defined(SUN) || defined(BSD) || defined(SUN4)
- #ifndef WTMP_FILE
- #define WTMP_FILE "/usr/adm/wtmp"
- #endif
- ***************
- *** 31,37 ****
- #endif /* SUN || BSD */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)utmp.c 3.12 07:43:36 9/17/91";
- #endif
-
- extern struct utmp utent;
- --- 31,37 ----
- #endif /* SUN || BSD */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)utmp.c 3.13 11:58:53 12/28/91";
- #endif
-
- extern struct utmp utent;
- ***************
- *** 77,83 ****
- #endif
- #endif
-
- ! #ifndef SUN
- setutent ();
- #endif /* SUN */
-
- --- 77,83 ----
- #endif
- #endif
-
- ! #if !defined(SUN) && !defined(SUN4)
- setutent ();
- #endif /* SUN */
-
- ***************
- *** 126,137 ****
- (void) time (&utent.ut_time);
- }
- #else /* !USG */
- bzero (&utent, sizeof utent);
- if (! (line = ttyname (0))) {
- puts (NO_TTY);
- exit (1);
- }
- ! if (strncmp (line, "/dev/", 5))
- line += 5;
-
- (void) strncpy (utent.ut_line, line, sizeof utent.ut_line);
- --- 126,142 ----
- (void) time (&utent.ut_time);
- }
- #else /* !USG */
- +
- + /*
- + * Hand-craft a new utmp entry.
- + */
- +
- bzero (&utent, sizeof utent);
- if (! (line = ttyname (0))) {
- puts (NO_TTY);
- exit (1);
- }
- ! if (strncmp (line, "/dev/", 5) == 0)
- line += 5;
-
- (void) strncpy (utent.ut_line, line, sizeof utent.ut_line);
- ***************
- *** 158,172 ****
- if (! (fd = open ("/etc/utmp", O_RDWR)))
- return;
-
- while (! found && read (fd, &utmp, sizeof utmp) == sizeof utmp) {
- if (! strncmp (line, utmp.ut_line, (int) sizeof utmp.ut_line))
- found++;
- }
- if (! found) {
- (void) bzero (&utmp, sizeof utmp);
- (void) strncpy (utmp.ut_line, line, (int) sizeof utmp.ut_line);
- }
- ! #if defined(SUN) || defined(BSD)
- (void) strncpy (utmp.ut_name, name, (int) sizeof utent.ut_name);
- #else /* SUN */
- (void) strncpy (utmp.ut_user, name, (int) sizeof utent.ut_user);
- --- 163,191 ----
- if (! (fd = open ("/etc/utmp", O_RDWR)))
- return;
-
- + #if !defined(SUN) && !defined(BSD) && !defined(SUN4)
- while (! found && read (fd, &utmp, sizeof utmp) == sizeof utmp) {
- if (! strncmp (line, utmp.ut_line, (int) sizeof utmp.ut_line))
- found++;
- }
- + #endif
- if (! found) {
- +
- + /*
- + * This is a brand-new entry. Clear it out and fill it in
- + * later.
- + */
- +
- (void) bzero (&utmp, sizeof utmp);
- (void) strncpy (utmp.ut_line, line, (int) sizeof utmp.ut_line);
- }
- !
- ! /*
- ! * Fill in the parts of the UTMP entry. BSD has just the name,
- ! * while System V has the name, PID and a type.
- ! */
- !
- ! #if defined(SUN) || defined(BSD) || defined(SUN4)
- (void) strncpy (utmp.ut_name, name, (int) sizeof utent.ut_name);
- #else /* SUN */
- (void) strncpy (utmp.ut_user, name, (int) sizeof utent.ut_user);
- ***************
- *** 173,182 ****
- utmp.ut_type = USER_PROCESS;
- utmp.ut_pid = getpid ();
- #endif /* SUN || BSD */
- (void) time (&utmp.ut_time);
-
- ! if (found)
- lseek (fd, (long) - sizeof utmp, 1);
-
- (void) write (fd, &utmp, sizeof utmp);
- (void) close (fd);
- --- 192,231 ----
- utmp.ut_type = USER_PROCESS;
- utmp.ut_pid = getpid ();
- #endif /* SUN || BSD */
- +
- + /*
- + * Put in the current time (common to everyone)
- + */
- +
- (void) time (&utmp.ut_time);
-
- ! #ifdef UT_HOST
- ! /*
- ! * Update the host name field for systems with networking support
- ! */
- !
- ! (void) strncpy (utmp.ut_host, utent.ut_host, (int) sizeof utmp.ut_host);
- ! #endif
- !
- ! /*
- ! * Locate the correct position in the UTMP file for this
- ! * entry.
- ! */
- !
- ! #if defined(SUN) || defined(BSD) || defined(SUN4)
- ! (void) lseek (fd, (long) (sizeof utmp) * ttyslot (), 0);
- ! #else
- ! if (found) /* Back up a splot */
- lseek (fd, (long) - sizeof utmp, 1);
- + else /* Otherwise, go to the end of the file */
- + lseek (fd, (long) 0, 2);
- + #endif
- +
- + /*
- + * Scribble out the new entry and close the file. We're done
- + * with UTMP, next we do WTMP (which is real easy, put it on
- + * the end of the file.
- + */
-
- (void) write (fd, &utmp, sizeof utmp);
- (void) close (fd);
- Index: groupdel.c
- *** rel3/groupdel.c Sat Dec 28 19:41:49 1991
- --- groupdel.c Sat Dec 28 19:42:56 1991
- ***************
- *** 10,16 ****
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)groupdel.c 3.3 08:43:48 9/12/91";
- #endif
-
- #include <sys/types.h>
- --- 10,16 ----
- */
-
- #ifndef lint
- ! static char sccsid[] = "@(#)groupdel.c 3.5 19:39:55 12/28/91";
- #endif
-
- #include <sys/types.h>
- ***************
- *** 58,64 ****
-
- usage ()
- {
- ! fprintf (stderr, "usage: groupmod group\n");
- exit (2);
- }
-
- --- 58,64 ----
-
- usage ()
- {
- ! fprintf (stderr, "usage: groupdel group\n");
- exit (2);
- }
-
- ***************
- *** 71,77 ****
- --- 71,79 ----
- void
- grp_update ()
- {
- + #ifdef NDBM
- struct group *ogrp;
- + #endif
-
- if (! gr_remove (group_name)) {
- fprintf (stderr, "%s: error removing group entry\n", Prog);
- Index: entry.c
- *** rel3/entry.c Sat Dec 28 19:41:07 1991
- --- entry.c Sat Dec 28 19:42:58 1991
- ***************
- *** 9,14 ****
- --- 9,15 ----
- * distribution media.
- */
-
- + #include "config.h"
- #include "pwd.h"
- #ifndef BSD
- #include <string.h>
- ***************
- *** 17,29 ****
- #define strchr index
- #define strrchr rindex
- #endif
- - #include "config.h"
- #ifdef SHADOWPWD
- #include "shadow.h"
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)entry.c 3.4 08:57:50 7/10/91";
- #endif
-
- struct passwd *fgetpwent ();
- --- 18,29 ----
- #define strchr index
- #define strrchr rindex
- #endif
- #ifdef SHADOWPWD
- #include "shadow.h"
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)entry.c 3.5 11:59:41 12/28/91";
- #endif
-
- struct passwd *fgetpwent ();
- Index: newusers.c
- *** rel3/newusers.c Sat Dec 28 19:41:13 1991
- --- newusers.c Sat Dec 28 19:43:00 1991
- ***************
- *** 15,32 ****
- * adding entries in the related directories.
- */
-
- #include <stdio.h>
- #include "pwd.h"
- #include <grp.h>
- #include <fcntl.h>
- #include <string.h>
- - #include "config.h"
- #ifdef SHADOWPWD
- #include "shadow.h"
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)newusers.c 3.5 07:44:18 9/17/91";
- #endif
-
- char *Prog;
- --- 15,32 ----
- * adding entries in the related directories.
- */
-
- + #include "config.h"
- #include <stdio.h>
- #include "pwd.h"
- #include <grp.h>
- #include <fcntl.h>
- #include <string.h>
- #ifdef SHADOWPWD
- #include "shadow.h"
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)newusers.c 3.6 12:04:31 12/28/91";
- #endif
-
- char *Prog;
- ***************
- *** 222,228 ****
-
- if (uid[0] >= '0' && uid[0] <= '9') {
- i = atoi (uid);
- ! } if (uid[0] && (pwd = pw_locate (uid))) {
- i = pwd->pw_uid;
- } else {
- i = 100;
- --- 222,228 ----
-
- if (uid[0] >= '0' && uid[0] <= '9') {
- i = atoi (uid);
- ! } else if (uid[0] && (pwd = pw_locate (uid))) {
- i = pwd->pw_uid;
- } else {
- i = 100;
- ***************
- *** 459,465 ****
- else
- break;
- }
- ! if (*cp || nfields != 6) {
- fprintf (stderr, "%s: line %d: invalid line\n",
- Prog, line);
- continue;
- --- 459,465 ----
- else
- break;
- }
- ! if (nfields != 6) {
- fprintf (stderr, "%s: line %d: invalid line\n",
- Prog, line);
- continue;
- Index: pwpack.c
- *** rel3/pwpack.c Sat Dec 28 19:40:53 1991
- --- pwpack.c Sat Dec 28 19:43:02 1991
- ***************
- *** 1,5 ****
- /*
- ! * Copyright 1990, John F. Haugh II
- * All rights reserved.
- *
- * Permission is granted to copy and create derivative works for any
- --- 1,5 ----
- /*
- ! * Copyright 1990, 1991, John F. Haugh II
- * All rights reserved.
- *
- * Permission is granted to copy and create derivative works for any
- ***************
- *** 9,14 ****
- --- 9,15 ----
- * distribution media.
- */
-
- + #include "config.h"
- #include <stdio.h>
- #include "pwd.h"
- #ifdef BSD
- ***************
- *** 18,27 ****
- #else
- #include <string.h>
- #endif
- - #include "config.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)pwpack.c 3.3 12:31:23 12/12/90";
- #endif
-
- /*
- --- 19,27 ----
- #else
- #include <string.h>
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)pwpack.c 3.4 11:50:31 12/28/91";
- #endif
-
- /*
- Index: pwent.c
- *** rel3/pwent.c Sat Dec 28 19:41:05 1991
- --- pwent.c Sat Dec 28 19:43:07 1991
- ***************
- *** 9,14 ****
- --- 9,15 ----
- * distribution media.
- */
-
- + #include "config.h"
- #include <stdio.h>
- #include "pwd.h"
- #ifdef BSD
- ***************
- *** 18,24 ****
- #else
- #include <string.h>
- #endif
- - #include "config.h"
-
- /*
- * If AUTOSHADOW is enable, the getpwnam and getpwuid calls will
- --- 19,24 ----
- ***************
- *** 60,66 ****
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)pwent.c 3.6 08:09:35 7/15/91";
- #endif
-
- #define SBUFSIZ 64
- --- 60,66 ----
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)pwent.c 3.7 12:04:47 12/28/91";
- #endif
-
- #define SBUFSIZ 64
- ***************
- *** 472,478 ****
- return 0;
- }
-
- ! #ifdef SUN
-
- /*
- * putpwent - Output a (struct passwd) in character format
- --- 472,478 ----
- return 0;
- }
-
- ! #ifdef NEED_PUTPWENT
-
- /*
- * putpwent - Output a (struct passwd) in character format
- ***************
- *** 488,495 ****
- struct passwd *p;
- FILE *f;
- {
- ! return (fprintf (f, "%s:%s:%d:%d:%s,%s:%s:%s\n",
- p->pw_name, p->pw_passwd, p->pw_uid, p->pw_gid,
- ! p->pw_gecos, p->pw_comment, p->pw_dir, p->pw_shell) == EOF);
- }
- ! #endif /* SUN */
- --- 488,513 ----
- struct passwd *p;
- FILE *f;
- {
- ! int status;
- !
- ! #if defined(SUN) || defined(BSD) || defined(SUN4)
- ! status = fprintf (f, "%s:%s:%d:%d:%s,%s:%s:%s\n",
- p->pw_name, p->pw_passwd, p->pw_uid, p->pw_gid,
- ! p->pw_gecos, p->pw_comment, p->pw_dir, p->pw_shell) == EOF;
- ! #else
- ! status = fprintf (f, "%s:%s", p->pw_name, p->pw_passwd) == EOF;
- ! #ifdef ATT_AGE
- ! if (p->pw_age && p->pw_age[0])
- ! status |= fprintf (f, ",%s", p->pw_age) == EOF;
- ! #endif
- ! status |= fprintf (f, ":%d:%d:%s", p->pw_uid, p->pw_gid,
- ! p->pw_gecos) == EOF;
- ! #ifdef ATT_COMMENT
- ! if (p->pw_comment && p->pw_comment[0])
- ! status |= fprintf (f, ",%s", p->pw_comment) == EOF;
- ! #endif
- ! status |= fprintf (f, ":%s:%s\n", p->pw_dir, p->pw_shell) == EOF;
- ! #endif
- ! return status;
- }
- ! #endif /* NEED_PUTPWENT */
- Index: pwunconv.c
- *** rel3/pwunconv.c Sat Dec 28 19:40:42 1991
- --- pwunconv.c Sat Dec 28 19:43:08 1991
- ***************
- *** 19,33 ****
- * possible.
- */
-
- #include <sys/types.h>
- #include <stdio.h>
- #include <fcntl.h>
- #include "pwd.h"
- - #include "config.h"
- #include "shadow.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)pwunconv.c 3.3 09:08:06 5/28/91";
- #endif
-
- #ifdef ITI_AGING
- --- 19,33 ----
- * possible.
- */
-
- + #include "config.h"
- #include <sys/types.h>
- #include <stdio.h>
- #include <fcntl.h>
- #include "pwd.h"
- #include "shadow.h"
-
- #ifndef lint
- ! static char sccsid[] = "@(#)pwunconv.c 3.4 11:59:24 12/28/91";
- #endif
-
- #ifdef ITI_AGING
- Index: ttytype.c
- *** rel3/ttytype.c Sat Dec 28 19:41:08 1991
- --- ttytype.c Sat Dec 28 19:43:10 1991
- ***************
- *** 21,27 ****
- #include "config.h"
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)ttytype.c 3.1 07:43:33 9/17/91";
- #endif
-
- extern char *getdef_str();
- --- 21,27 ----
- #include "config.h"
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)ttytype.c 3.3 19:40:04 12/28/91";
- #endif
-
- extern char *getdef_str();
- ***************
- *** 37,43 ****
- FILE *fp;
- char buf[BUFSIZ];
- char termvar[BUFSIZ];
- ! char *ttytype;
- char *cp;
- char *type;
- char *port;
- --- 37,43 ----
- FILE *fp;
- char buf[BUFSIZ];
- char termvar[BUFSIZ];
- ! char *typefile;
- char *cp;
- char *type;
- char *port;
- ***************
- *** 45,57 ****
-
- if (getenv ("TERM"))
- return;
- ! if ((ttytype=getdef_str("TTYTYPE_FILE")) == NULL )
- return;
- ! if (access (ttytype, 0))
- return;
-
- ! if (! (fp = fopen (ttytype, "r"))) {
- ! perror (ttytype);
- return;
- }
- while (fgets (buf, BUFSIZ, fp)) {
- --- 45,57 ----
-
- if (getenv ("TERM"))
- return;
- ! if ((typefile=getdef_str("TTYTYPE_FILE")) == NULL )
- return;
- ! if (access (typefile, 0))
- return;
-
- ! if (! (fp = fopen (typefile, "r"))) {
- ! perror (typefile);
- return;
- }
- while (fgets (buf, BUFSIZ, fp)) {
- ***************
- *** 61,67 ****
- if (cp = strchr (buf, '\n'))
- *cp = '\0';
-
- ! #if defined(SUN) || defined(BSD)
- if ((port = strtok (buf, "\t"))
- && (type = strtok ((char *) 0, "\t"))
- && (type = strtok ((char *) 0, "\t"))) {
- --- 61,67 ----
- if (cp = strchr (buf, '\n'))
- *cp = '\0';
-
- ! #if defined(SUN) || defined(BSD) || defined(SUN4)
- if ((port = strtok (buf, "\t"))
- && (type = strtok ((char *) 0, "\t"))
- && (type = strtok ((char *) 0, "\t"))) {
- ***************
- *** 74,81 ****
- if (strcmp (line, port) == 0)
- break;
- }
- - }
- #endif
- if (! feof (fp) && ! ferror (fp)) {
- strcat (strcpy (termvar, "TERM="), type);
- addenv (termvar);
- --- 74,81 ----
- if (strcmp (line, port) == 0)
- break;
- }
- #endif
- + }
- if (! feof (fp) && ! ferror (fp)) {
- strcat (strcpy (termvar, "TERM="), type);
- addenv (termvar);
- Index: pwd.h.m4
- *** rel3/pwd.h.m4 Sat Dec 28 19:41:27 1991
- --- pwd.h.m4 Sat Dec 28 19:43:11 1991
- ***************
- *** 15,21 ****
- * It is not derived from any of those sources. Note that it can be
- * site-defined to have non-POSIX features as well.
- *
- ! * @(#)pwd.h.m4 3.1 08:54:41 11/3/91
- */
-
- #ifndef PWD_H
- --- 15,21 ----
- * It is not derived from any of those sources. Note that it can be
- * site-defined to have non-POSIX features as well.
- *
- ! * @(#)pwd.h.m4 3.2 12:04:43 12/28/91
- */
-
- #ifndef PWD_H
- ***************
- *** 30,35 ****
- --- 30,37 ----
- #include <sys/types.h>
- #endif
-
- + ifdef(`SUN4', `#define ATT_AGE')
- + ifdef(`SUN4', `#define ATT_COMMENT')
- ifdef(`SUN', `#define BSD_QUOTAS')
- ifdef(`BSD', `#define BSD_QUOTAS')
- ifdef(`USG', `#define ATT_AGE')
- Index: port.c
- *** rel3/port.c Sat Dec 28 19:40:51 1991
- --- port.c Sat Dec 28 19:43:13 1991
- ***************
- *** 24,30 ****
- #include "port.h"
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)port.c 3.1 08:59:32 2/8/91";
- #endif
-
- extern int errno;
- --- 24,30 ----
- #include "port.h"
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)port.c 3.2 11:58:29 12/28/91";
- #endif
-
- extern int errno;
- ***************
- *** 32,38 ****
- static FILE *ports;
-
- /*
- ! * setttyent - open /etc/porttime file or rewind
- *
- * the /etc/porttime file is rewound if already open, or
- * opened for reading.
- --- 32,38 ----
- static FILE *ports;
-
- /*
- ! * setportent - open /etc/porttime file or rewind
- *
- * the /etc/porttime file is rewound if already open, or
- * opened for reading.
- ***************
- *** 39,45 ****
- */
-
- void
- ! setttyent ()
- {
- if (ports)
- rewind (ports);
- --- 39,45 ----
- */
-
- void
- ! setportent ()
- {
- if (ports)
- rewind (ports);
- ***************
- *** 48,54 ****
- }
-
- /*
- ! * endttyent - close the /etc/porttime file
- *
- * the /etc/porttime file is closed and the ports variable set
- * to NULL to indicate that the /etc/porttime file is no longer
- --- 48,54 ----
- }
-
- /*
- ! * endportent - close the /etc/porttime file
- *
- * the /etc/porttime file is closed and the ports variable set
- * to NULL to indicate that the /etc/porttime file is no longer
- ***************
- *** 56,62 ****
- */
-
- void
- ! endttyent ()
- {
- if (ports)
- fclose (ports);
- --- 56,62 ----
- */
-
- void
- ! endportent ()
- {
- if (ports)
- fclose (ports);
- ***************
- *** 65,71 ****
- }
-
- /*
- ! * getttyent - read a single entry from /etc/porttime
- *
- * the next line in /etc/porttime is converted to a (struct port)
- * and a pointer to a static (struct port) is returned to the
- --- 65,71 ----
- }
-
- /*
- ! * getportent - read a single entry from /etc/porttime
- *
- * the next line in /etc/porttime is converted to a (struct port)
- * and a pointer to a static (struct port) is returned to the
- ***************
- *** 74,80 ****
- */
-
- struct port *
- ! getttyent ()
- {
- static struct port port; /* static struct to point to */
- static char buf[BUFSIZ]; /* some space for stuff */
- --- 74,80 ----
- */
-
- struct port *
- ! getportent ()
- {
- static struct port port; /* static struct to point to */
- static char buf[BUFSIZ]; /* some space for stuff */
- ***************
- *** 92,98 ****
- */
-
- if (! ports)
- ! setttyent ();
-
- if (! ports) {
- errno = saveerr;
- --- 92,98 ----
- */
-
- if (! ports)
- ! setportent ();
-
- if (! ports) {
- errno = saveerr;
- ***************
- *** 307,315 ****
- int i, j;
- struct port *port;
-
- ! setttyent ();
-
- ! while (port = getttyent ()) {
- if (port->pt_names == 0 || port->pt_users == 0)
- continue;
-
- --- 307,315 ----
- int i, j;
- struct port *port;
-
- ! setportent ();
-
- ! while (port = getportent ()) {
- if (port->pt_names == 0 || port->pt_users == 0)
- continue;
-
- ***************
- *** 329,335 ****
- if (port->pt_users[j] != 0)
- break;
- }
- ! endttyent ();
- return port;
- }
-
- --- 329,335 ----
- if (port->pt_users[j] != 0)
- break;
- }
- ! endportent ();
- return port;
- }
-
- Index: chsh.c
- *** rel3/chsh.c Sat Dec 28 19:40:57 1991
- --- chsh.c Sat Dec 28 19:43:15 1991
- ***************
- *** 15,21 ****
- #include <signal.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)chsh.c 3.6 20:58:54 8/15/91";
- #endif
-
- /*
- --- 15,21 ----
- #include <signal.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)chsh.c 3.7 11:58:57 12/28/91";
- #endif
-
- /*
- ***************
- *** 42,48 ****
- --- 42,53 ----
- #define LOG_WARN LOG_WARNING
- #endif
- #endif
- + #ifdef USE_RLIMIT
- + #include <sys/resource.h>
-
- + struct rlimit rlimit_fsize = { RLIM_INFINITY, RLIM_INFINIT };
- + #endif
- +
- /*
- * Global variables.
- */
- ***************
- *** 373,379 ****
- --- 378,389 ----
- * keyboard signals are set to be ignored.
- */
-
- + #ifdef HAVE_ULIMIT
- ulimit (2, 30000);
- + #endif
- + #ifdef HAVE_RLIMIT
- + setrlimit (RLIMIT_FSIZE, &rlimit_fsize);
- + #endif
- if (setuid (0)) {
- fprintf (stderr, NOTROOT);
- #ifdef USE_SYSLOG
- Index: chfn.c
- *** rel3/chfn.c Sat Dec 28 19:40:56 1991
- --- chfn.c Sat Dec 28 19:43:17 1991
- ***************
- *** 15,21 ****
- #include <signal.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)chfn.c 3.7 10:14:35 8/15/91";
- #endif
-
- /*
- --- 15,21 ----
- #include <signal.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)chfn.c 3.8 11:59:27 12/28/91";
- #endif
-
- /*
- ***************
- *** 42,48 ****
- --- 42,53 ----
- #define LOG_WARN LOG_WARNING
- #endif
- #endif
- + #ifdef USE_RLIMIT
- + #include <sys/resource.h>
-
- + struct rlimit rlimit_fsize = { RLIM_INFINITY, RLIM_INFINIT };
- + #endif
- +
- /*
- * Global variables.
- */
- ***************
- *** 467,473 ****
- --- 472,483 ----
- * keyboard signals are set to be ignored.
- */
-
- + #ifdef HAVE_ULIMIT
- ulimit (2, 30000);
- + #endif
- + #ifdef HAVE_RLIMIT
- + setrlimit (RLIMIT_FSIZE, &rlimit_fsize);
- + #endif
- if (setuid (0)) {
- fprintf (stderr, NOTROOT);
- #ifdef USE_SYSLOG
- Index: passwd.c
- *** rel3/passwd.c Sat Dec 28 19:40:46 1991
- --- passwd.c Sat Dec 28 19:43:19 1991
- ***************
- *** 9,14 ****
- --- 9,15 ----
- * distribution media.
- */
-
- + #include "config.h"
- #include <sys/types.h>
- #include <time.h>
- #include <stdio.h>
- ***************
- *** 16,22 ****
- #include <signal.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)passwd.c 3.6 08:43:55 9/12/91";
- #endif
-
- /*
- --- 17,23 ----
- #include <signal.h>
-
- #ifndef lint
- ! static char sccsid[] = "@(#)passwd.c 3.7 12:04:36 12/28/91";
- #endif
-
- /*
- ***************
- *** 34,40 ****
- #define strrchr rindex
- #endif
-
- - #include "config.h"
- #include "pwd.h"
- #include "lastlog.h"
- #include "shadow.h"
- --- 35,40 ----
- ***************
- *** 46,51 ****
- --- 46,56 ----
- #define LOG_WARN LOG_WARNING
- #endif
- #endif
- + #ifdef USE_RLIMIT
- + #include <sys/resource.h>
- +
- + struct rlimit rlimit_fsize = { RLIM_INFINITY, RLIM_INFINIT };
- + #endif
-
- /*
- * Password aging constants
- ***************
- *** 426,431 ****
- --- 431,437 ----
- char **argv;
- {
- char buf[BUFSIZ]; /* I/O buffer for messages, etc. */
- + char new_passwd[BUFSIZ]; /* Buffer for changed passwords */
- char *cp; /* Miscellaneous character pointing */
- time_t min; /* Minimum days before change */
- time_t max; /* Maximum days until change */
- ***************
- *** 434,439 ****
- --- 440,446 ----
- int i; /* Loop control variable */
- int flag; /* Current option to process */
- int lflg = 0; /* -l - lock account option */
- + int uflg = 0; /* -u - unlock account option */
- int dflg = 0; /* -d - delete password option */
- int xflg = 0; /* -x - set maximum days */
- int nflg = 0; /* -n - set minimum days */
- ***************
- *** 512,518 ****
- * which are restricted to root only.
- */
-
- ! while ((flag = getopt (argc, argv, "ldx:n:w:i:S")) != EOF) {
- switch (flag) {
- case 'x':
- max = strtol (optarg, &cp, 10);
- --- 519,525 ----
- * which are restricted to root only.
- */
-
- ! while ((flag = getopt (argc, argv, "ludx:n:w:i:S")) != EOF) {
- switch (flag) {
- case 'x':
- max = strtol (optarg, &cp, 10);
- ***************
- *** 554,559 ****
- --- 561,569 ----
- case 'l':
- lflg++;
- break;
- + case 'u':
- + uflg++;
- + break;
- default:
- usage ();
- }
- ***************
- *** 570,576 ****
- wflg || iflg || Sflg) && optind >= argc)
- usage ();
-
- ! if ((dflg + lflg + (xflg || nflg || wflg || iflg) + Sflg) > 1)
- usage ();
-
- /*
- --- 580,586 ----
- wflg || iflg || Sflg) && optind >= argc)
- usage ();
-
- ! if ((dflg + lflg + uflg + (xflg || nflg || wflg || iflg) + Sflg) > 1)
- usage ();
-
- /*
- ***************
- *** 655,661 ****
- * If there are no other flags, just change the password.
- */
-
- ! if (! (dflg || lflg || xflg || nflg || wflg || iflg)) {
-
- /*
- * See if the user is permitted to change the password.
- --- 665,671 ----
- * If there are no other flags, just change the password.
- */
-
- ! if (! (dflg || lflg || uflg || xflg || nflg || wflg || iflg)) {
-
- /*
- * See if the user is permitted to change the password.
- ***************
- *** 681,689 ****
- if (dflg) /* Set password to blank */
- sp->sp_pwdp = "";
-
- ! if (lflg) /* Set password to "locked" value */
- ! sp->sp_pwdp = "!";
- !
- if (xflg)
- sp->sp_max = (max * DAY) / SCALE;
-
- --- 691,709 ----
- if (dflg) /* Set password to blank */
- sp->sp_pwdp = "";
-
- ! if (lflg) { /* Set password to "locked" value */
- ! if (sp->sp_pwdp && sp->sp_pwdp[0] != '!') {
- ! strcpy (new_passwd, "!");
- ! strcat (new_passwd, sp->sp_pwdp);
- ! sp->sp_pwdp = new_passwd;
- ! }
- ! }
- ! if (uflg) { /* Undo password "locked" value */
- ! if (sp->sp_pwdp && sp->sp_pwdp[0] == '!') {
- ! strcpy (new_passwd, sp->sp_pwdp + 1);
- ! sp->sp_pwdp = new_passwd;
- ! }
- ! }
- if (xflg)
- sp->sp_max = (max * DAY) / SCALE;
-
- ***************
- *** 703,709 ****
- --- 723,734 ----
- * keyboard signals are set to be ignored.
- */
-
- + #ifdef HAVE_ULIMIT
- ulimit (2, 30000);
- + #endif
- + #ifdef HAVE_RLIMIT
- + setrlimit (RLIMIT_FSIZE, &rlimit_fsize);
- + #endif
- if (setuid (0)) {
- fprintf (stderr, NOTROOT);
- #ifdef USE_SYSLOG
- Index: gpmain.c
- *** rel3/gpmain.c Sat Dec 28 19:41:02 1991
- --- gpmain.c Sat Dec 28 19:43:22 1991
- ***************
- *** 17,45 ****
- #include <fcntl.h>
- #include <signal.h>
- #include <errno.h>
- ! #ifndef BSD
- #include <termio.h>
- #ifdef SYS3
- ! #include <sys/ioctl.h>
- ! #endif
- #include <string.h>
- #ifndef SYS3
- ! #include <memory.h>
- ! #endif
- ! #else
- #include <sgtty.h>
- #include <strings.h>
- #define strchr index
- #define strrchr rindex
- ! #endif
- #include "config.h"
-
- ! #if !defined(BSD) || !defined(SUN)
- #define bzero(p,l) memset(p, 0, l)
- #endif
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)gpmain.c 3.10 07:44:08 9/17/91";
- #endif
-
- char name[BUFSIZ];
- --- 17,45 ----
- #include <fcntl.h>
- #include <signal.h>
- #include <errno.h>
- ! #if defined(USG) || defined(SUN4)
- #include <termio.h>
- #ifdef SYS3
- ! # include <sys/ioctl.h>
- ! #endif /* SYS3 */
- #include <string.h>
- #ifndef SYS3
- ! # include <memory.h>
- ! #endif /* !SYS3 */
- ! #else /* SUN || BSD */
- #include <sgtty.h>
- #include <strings.h>
- #define strchr index
- #define strrchr rindex
- ! #endif /* !SUN && !BSD */
- #include "config.h"
-
- ! #ifdef USG
- #define bzero(p,l) memset(p, 0, l)
- #endif
-
- #ifndef lint
- ! static char _sccsid[] = "@(#)gpmain.c 3.12 19:39:50 12/28/91";
- #endif
-
- char name[BUFSIZ];
- ***************
- *** 169,177 ****
- --- 169,179 ----
- struct group *gr = 0;
- struct group *getgrnam ();
- struct group *sgetgrent ();
- + #ifdef SHADOWGRP
- struct sgrp *sg = 0;
- struct sgrp sgent;
- struct sgrp *getsgnam ();
- + #endif
- struct passwd *pw = 0;
- struct passwd *getpwuid ();
- struct passwd *getpwnam ();
- ***************
- *** 547,556 ****
- * then reset.
- */
-
- ! void die (killed)
- int killed;
- {
- ! #ifdef BSD
- static struct sgtty sgtty;
-
- if (killed)
- --- 549,559 ----
- * then reset.
- */
-
- ! void
- ! die (killed)
- int killed;
- {
- ! #if defined(BSD) || defined(SUN)
- static struct sgtty sgtty;
-
- if (killed)
- Index: setup.c
- *** rel3/setup.c Sat Dec 28 19:41:07 1991
- --- setup.c Sat Dec 28 19:43:24 1991
- ***************
- *** 33,39 ****
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)setup.c 3.8 07:43:12 9/17/91";
- #endif
-
- #ifndef SU
- --- 33,39 ----
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)setup.c 3.9 11:58:33 12/28/91";
- #endif
-
- #ifndef SU
- ***************
- *** 71,79 ****
- extern int errno;
- char buf[BUFSIZ];
- #ifndef SU
- ! char tty[30];
- #endif
- char *cp;
- int i;
- long l;
-
- --- 71,81 ----
- extern int errno;
- char buf[BUFSIZ];
- #ifndef SU
- ! char tty[sizeof utent.ut_line + 8];
- #endif
- char *cp;
- + char *maildir; /* the directory in which the mailbox resides */
- + char *mailfile; /* the name of the mailbox */
- int i;
- long l;
-
- ***************
- *** 176,191 ****
- cp = getdef_str( info->pw_uid == 0 ? "ENV_SUPATH" : "ENV_PATH" );
- addenv( cp != NULL ? cp : "PATH=/bin:/usr/bin" );
-
- ! #if defined(BSD) || defined(SUN)
- (void) strcat (strcpy (buf, "USER="), info->pw_name);
- #else
- (void) strcat (strcpy (buf, "LOGNAME="), info->pw_name);
- ! #endif /* BSD || SUN */
- addenv (buf);
-
- ! if ( (cp=getdef_str("MAIL_DIR")) == NULL )
- ! cp = "/usr/spool/mail";
- (void) strcat (strcat (strcat (strcpy (buf,
- ! "MAIL="), cp), "/"), info->pw_name);
- addenv (buf);
- }
- --- 178,202 ----
- cp = getdef_str( info->pw_uid == 0 ? "ENV_SUPATH" : "ENV_PATH" );
- addenv( cp != NULL ? cp : "PATH=/bin:/usr/bin" );
-
- ! #if defined(BSD) || defined(SUN) || defined(SUN4)
- (void) strcat (strcpy (buf, "USER="), info->pw_name);
- #else
- (void) strcat (strcpy (buf, "LOGNAME="), info->pw_name);
- ! #endif /* BSD || SUN || SUN4 */
- addenv (buf);
-
- ! if ( (cp=getdef_str("MAIL_DIR")) != NULL ) {
- ! maildir = cp;
- ! mailfile = info->pw_name;
- ! } else if ( (cp=getdef_str("MAIL_FILE")) != NULL) {
- ! maildir = info->pw_dir;
- ! mailfile = cp;
- ! } else {
- ! maildir = "/usr/spool/mail";
- ! mailfile = info->pw_name;
- ! }
- !
- (void) strcat (strcat (strcat (strcpy (buf,
- ! "MAIL="), maildir), "/"), mailfile);
- addenv (buf);
- }
- Index: newgrp.c
- *** rel3/newgrp.c Sat Dec 28 19:40:39 1991
- --- newgrp.c Sat Dec 28 19:43:26 1991
- ***************
- *** 24,35 ****
- #endif
- #include "config.h"
-
- ! #if !defined(BSD) && !defined(SUN)
- #define bzero(p,n) memset(p, 0, n)
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)newgrp.c 3.7 08:43:39 9/12/91";
- #endif
-
- #ifdef NGROUPS
- --- 24,35 ----
- #endif
- #include "config.h"
-
- ! #if !defined(BSD) && !defined(SUN) && !defined(SUN4)
- #define bzero(p,n) memset(p, 0, n)
- #endif
-
- #ifndef lint
- ! static char sccsid[] = "@(#)newgrp.c 3.8 11:59:02 12/28/91";
- #endif
-
- #ifdef NGROUPS
- Index: config.h
- *** rel3/config.h Sat Dec 28 19:40:41 1991
- --- config.h Sat Dec 28 19:43:28 1991
- ***************
- *** 12,18 ****
- /*
- * Configuration file for login.
- *
- ! * @(#)config.h 3.13 08:27:18 10/31/91
- */
-
-
- --- 12,18 ----
- /*
- * Configuration file for login.
- *
- ! * @(#)config.h 3.15 12:43:13 12/28/91
- */
-
-
- ***************
- *** 81,86 ****
- --- 81,94 ----
- #undef UT_HOST
-
- /*
- + * Define the "success" code from ruserok(). Most modern systems use 0
- + * for success and -1 for failure, while certain older versions use 1
- + * for success and 0 for failure. Please check your manpage to be sure.
- + */
- +
- + #define RUSEROK 0
- +
- + /*
- * Select one of the following
- */
-
- ***************
- *** 93,98 ****
- --- 101,107 ----
- */
-
- #define HAVE_ULIMIT /* Define if your UNIX supports ulimit() */
- + #undef HAVE_RLIMIT /* Define if your UNIX supports setrlimit() */
- #define GETPWENT /* Define if you want my GETPWENT(3) routines */
- #define GETGRENT /* Define if you want my GETGRENT(3) routines */
- #define NEED_AL64 /* Define if library does not include a64l() */
- ***************
- *** 100,105 ****
- --- 109,115 ----
- #define NEED_RMDIR /* Define if system does not have rmdir() */
- #define NEED_RENAME /* Define if system does not have rename() */
- #define NEED_STRSTR /* Define if library does not include strstr() */
- + #undef NEED_PUTPWENT /* Define if library does not include putpwent()*/
- #define SIGTYPE int /* Type returned by signal() */
-
- /*
- ***************
- *** 123,125 ****
- --- 133,153 ----
-
- #define PWDFILE "/etc/passwd"
- #define GRPFILE "/etc/group"
- +
- + /*
- + * The structure of the utmp file. There are two kinds of UTMP files,
- + * "BSD" and "USG". "BSD" has no PID or type information, "USG" does.
- + * If you define neither of these, the type will be defaulted by using
- + * BSD, SUN, SYS3 and USG defines.
- + */
- +
- + #define USG_UTMP /**/
- + /* #define BSD_UTMP /**/
- +
- + #if !defined(USG_UTMP) && !defined(BSD_UTMP)
- + #if defined(BSD) || defined(SYS3) || defined(SUN)
- + #define BSD_UTMP
- + #else
- + #define USG_UTMP
- + #endif /* BSD || SYS3 || SUN */
- + #endif /* !USG_UTMP || !BSD_UTMP */
- --
- John F. Haugh II | Every 56 days. | UUCP: ...!cs.utexas.edu!rpp386!jfh
- Ma Bell: (512) 251-2151 | Give Blood, often. | Domain: jfh@rpp386.cactus.org
-
- HI ! I'm a mutating signature virus. You cannot resist helping me spread !
-
- exit 0 # Just in case...
-