Path: utzoo!attcan!uunet!mailrus!cs.utexas.edu!samsung!gem.mps.ohio-state.edu!apple!uokmax!occrsh!att!laidbak!laiter!stevea From: stevea@laiter.i88.isc.com (Steve Alexander) Newsgroups: comp.unix.i386 Subject: Re: Using "getpwent" in SYSV/386 Message-ID: <1989Nov21.150350.2984@i88.isc.com> Date: 21 Nov 89 15:03:50 GMT References: <785@ctdi.UUCP> <11633@smoke.BRL.MIL> <2941@levels.sait.edu.au> Sender: usenet@i88.isc.com (Usenet News) Reply-To: stevea@i88.isc.com (Steve Alexander) Organization: INTERACTIVE Systems Corporation, Naperville, IL Lines: 19 In article <2941@levels.sait.edu.au> CCDN@levels.sait.edu.au (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 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@i88.isc.com INTERACTIVE Systems Corporation, Naperville, IL | ...!{sun,ico}!laidbak!stevea