Using "getpwent" in SYSV/386

Steve Alexander stevea at
Wed Nov 22 02:03:50 AEST 1989

In article <2941 at> CCDN at (david newall) writes:
>The purpose of /etc/shadow is NOT to make it inconvenient to access this
>data, assuming you have permission to access it.  I would have thought it
>reasonable for getpwent to fill in the pw_passwd field if it was invoked
>by root.  Alternatively, I would have thought "getshadowent" routines would
>have been provided (for the exclusive use of root processes).

There are functions to access the shadow password file.  They are in
/usr/lib/libsec.a.  There is a header file <shadow.h> that must
be included in order to use these functions.  Obviously this will only
work if the effective uid is root.

These functions return a pointer to a struct spwd which is defined in shadow.h.
Otherwise they work a lot like the normal password routines.  There are
also some password file locking routines in libsec.a; presumably they
are used when writing an entry to a password file.
Steve Alexander, Software Technologies Group    | stevea at
INTERACTIVE Systems Corporation, Naperville, IL | ...!{sun,ico}!laidbak!stevea

More information about the Comp.unix.i386 mailing list