
4/18/92

This, again, is John Haugh II's shadow password suite, ported for
use with linux.  It's a full blown, already integrated password
system, useable under systems including System V Release 4 / SunOS.

Far fewer changes were required to make it work under linux 0.95
(and 0.95c+), than were needed for 0.12.  I've included three new
patches of Mr. Haugh's, and fixed up a handful of things myself.
No kernel patch is needed now.

I still make no claims as to suitability, &c, but it works for
me.

I blew off the utmpx support.  utmp is supported.

The pwent routines used, as this system comes configured, are
*not* the same as those in the gcc 2.1 libc.  I wouldn't blame
you if you were to modify the distribution to conform - and if
you do, and mail your changes to me, I'll probably make it a
separate patch.  I'm happier having a system that at least
*partially* knows how to deal with the BSD quota, and AT&T
aging fields.  We may never use them, but they take very little
room, and they're easier to add now, than later.  (If those
fields ever *do* add up to something, it's because you have
so many users you want the fields.)

I'm not including any binaries this time.  These programs
are just too big statically linked, I don't relish creating
so many .a's, and I feel that one of the big reasons UNIX is
outliving DOS, is that UNIX has traditionally not been encumbered
by things like binary compatibility.  Large, infrequent,
internally consistent binary releases, I find important; ABI's,
I find distressing; intermediate code systems, I have an
Appreciation for.

I used to compile this with gcc 1.40, though I've rehashed
things a bit since then.  It's now configured more specifically
for gcc 2.1.  I'm currently running these binaries on my 40 Meg
(that's disk, not RAM) system, with shared libraries, and separate
/ and /usr partitions - though I've moved my shared library to be
physically on root, and of course reversed the direction of the
relevant symlink.

To compile the system, you need:
- the sources...
- gcc 2.1
- an m4 binary
- a patch binary
- some crypt library: ufc works
- some ndbm clone: sdbm works, with sdbm.h as /usr/include/ndbm.h

The compilation procedure should go something like:

./go # to extract Mr. Haugh's base code, and apply patches
cd src
make pwd.h
cp pwd.h /usr/include/.
make
make -n install # to make sure everything looks kosher, be careful!
make install

...though you'll likely need to edit /usr/include/grp.h:
gcc doesn't like one of the prototypes - change the gid_t
in getgrgid to an int.  This feels like backward motion,
and yet the header file is one place that such a detail
"is ok" - user programs still use gid_t's, so the
abstraction is preserved within applications.

Following is the README from the first time I released a port of
this package:

------------------------------------------------------------------

This is John Haugh II's shadow password suite, ported for use with
Linux.

The only thing I'll guarantee about this port, is that it's not
perfect.  I'm providing my changes on a "use at your own risk"
basis.  You should seriously consider sticking with poe's package,
as it will almost certainly be in release 0.13 of linux.

To get "it" working relatively quickly:
1) Apply the echonl.patch I've included, to your kernel.  It
   adds ECHONL support, for termios.  You can run the password
   suite without this, but, for EG, when you su to root, your
   root shell prompt will appear on the same line the password
   prompt did.  It's cosmetic only.
2) Unpack the "binaries.tar" file
3) Inspect the script "quick.install", to be sure it
   won't wipe out something you want to keep
4) sh quick.install

To recompile the system, you may need to taylor your linux
environment.  Mine is modified as described in the following
list.  To recompile, you'll likely want most of these changes,
with the noteable possible exceptions of 1, 14 and 15.

1) An early release of hlu's gcc, and the attendant BSD stdio
2) /usr/include/utmp.h, from the poe init/getty/login package
3) /usr/lib/libsdbm.a, the ndbm clone.  I've placed sdbm.h
   in /usr/include, with a symlink to ndbm.h.  gdbm may work
   just as well or better.
4) A modifed /usr/include/grp.h (the changes are just as simple
   as they sound):
	endgrent returns int, not void
	setgrent returns int, not void
	getgrgid accepts int, not gid_t
5) A trivial strdup in libc.a, and a prototype in /usr/include/string.h

char *strdup(string)
const char *string;
	{
	char *result;
	result = malloc(strlen(string)+1);
	strcpy(result,string);
	return result;
	}

extern char * strdup(const char *string);

6) #define'd ut_name to ut_user in /usr/include/pwd.h, *after* the
   struct definition.
7) poe's utmp2.o in libc.a
10) My degenerate getlogin.o in libc.a; It does *not* inspect utmp.
    poe's is likely better; I've not looked at it yet.

#include <stdio.h>
#include <pwd.h>

char *getlogin()
{
	struct passwd *pw_ent;
	pw_ent = getpwuid(getuid());
	if (pw_ent)
		return pw_ent->pw_name;
	else
		return NULL;
}

11) The lastlog.h and faillog.h from the shadow password stuff, in
    /usr/include
12) The "echonl.patch" for the kernel, so cr's don't get lost when
    ECHO is turned off, but ECHONL is turned on.
13) An m4 binary.
14) I've removed all the insn-string stuff, from the linux Makefile.
15) Some of the more common patches, such as nonblocking I/O,
    and virtual consoles.

To rebuild the system:
1) Pay lip service to the changes I've outlined above.
2) apply the echonl.patch to your kernel
3) unpack the shadow-password sources
4) apply the included patch to the shadow password stuff
5) make
6) Get some coffee
7) make install

Much luck, and enjoy.

