#! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # README # Makefile # shadow.h # config.h.std # grent.c # chpasswd.c # shadowio.c # pwio.c # This archive created: Fri Nov 16 22:38:02 1990 # By: John F. Haugh II (River Parishes Programming, Austin TX) export PATH; PATH=/bin:/usr/bin:$PATH echo shar: "extracting 'README'" '(2813 characters)' if test -f 'README' then echo shar: "will not over-write existing file 'README'" else sed 's/^X//' << \SHAR_EOF > 'README' XThis little code drop contains two different utilities. The first Xoutlines how to modify password files in "batch" mode. The second Xis a utility for creating users in "batch" mode. X XThe first utility, "chpasswd", reads its standard input for colon Xseparated pairs of user names and passwords. The password for the Xnamed user is set to the cleartext which follows. A random salt Xis generated and used as input to the crypt() subroutine. X XThe second utility, "newusers", reads its standard input for Xrecords looking like entries in a password file. The entries in Xthis file are used to update the password file entries of existing Xusers, or to create new entries if the user does not exist. The Xexpected values for the fields are - X X name - a normal user name X password - the cleartext of the user's password. it X will be encrypted with a random salt. it X can't be blank just yet (or a value making X the account expired. give me some time). X uid - blank, or an integer. the uid is figured as X being the next highest uid. this may have X some problems. X gid - blank, or a group name. if blank, the gid will X be either the same as the uid, or the next X available gid. if a name, the user will be X added as a member. this isn't that well X thought out just yet ... X gecos - the new gecos field, or blank. X dir - the new home directory (which will be created X if it is non-blank and non-existent), or blank. X shell - the new login shell, or blank. X XEntries will be added to /etc/group as required, and if requested, Xentries to /etc/shadow will be updated as well. See the code if Xyou have any questions. Documentation will follow later. Oh - Xthe /etc/shadow file is in SVR4 format. Sorry, but that is the Xdirection this work is going. If you want SVR3.2 format, run Xwithout shadowing turned on, then use the pwconv utility to update Xthe shadow file. To get vanilla UNIX (no shadows of any kind) Xuse "config.h.std" in place of "config.h"; it has the correct Xdefines to get you boring, dull, uninteresting password files. X XAlong with this you get the first [?] release of a collection of Xlibrary routines for dealing with password files in a more orderly Xfashion. There will be more documentation and features in the Xfuture. The interface that this code presents is intended to Xremain fixed forever, with only the implmentation changing as Xneeded. X XSteve Simmons presented a talk on this work at the recent LISA Xconference. If you attended his talk, this is some of the code Xthat is being worked on. X XPlease notice that this code is COPYRIGHTED and that I do have a Xpolicy of enforcing copyrights. This is to protect the integrity Xof the work and not to restrict its use or normal distribution. XIf you have any questions regarding commercial distribution, Xplease feel free to contact me. SHAR_EOF if test 2813 -ne "`wc -c < 'README'`" then echo shar: "error transmitting 'README'" '(should have been 2813 characters)' fi fi echo shar: "extracting 'Makefile'" '(568 characters)' if test -f 'Makefile' then echo shar: "will not over-write existing file 'Makefile'" else sed 's/^X//' << \SHAR_EOF > 'Makefile' XLIBS = -ldbm -lcrypt XCFLAGS = -g X Xchpasswd: chpasswd.o libshadow.a X cc -o chpasswd -g chpasswd.o libshadow.a $(LIBS) X Xnewusers: newusers.o libshadow.a X cc -o newusers -g newusers.o libshadow.a $(LIBS) X Xchpasswd.o: config.h shadow.h Xencrypt.o: config.h Xpwent.o: config.h Xshadow.o: shadow.h Xshadowio.o: shadow.h X Xlibshadow.a: \ X libshadow.a(encrypt.o) \ X libshadow.a(grent.o) \ X libshadow.a(groupio.o) \ X libshadow.a(pwent.o) \ X libshadow.a(pwio.o) \ X libshadow.a(pwpack.o) \ X libshadow.a(rad64.o) \ X libshadow.a(shadow.o) \ X libshadow.a(shadowio.o) X ranlib libshadow.a SHAR_EOF if test 568 -ne "`wc -c < 'Makefile'`" then echo shar: "error transmitting 'Makefile'" '(should have been 568 characters)' fi fi echo shar: "extracting 'shadow.h'" '(1223 characters)' if test -f 'shadow.h' then echo shar: "will not over-write existing file 'shadow.h'" else sed 's/^X//' << \SHAR_EOF > 'shadow.h' X/* X * Copyright 1988, 1989, 1990, John F. Haugh II