HomeFreeBSD

Make pw(8) showuser work the same with or without -R <path> for non-root

Description

Make pw(8) showuser work the same with or without -R <path> for non-root
users. Without -R, pw(8) uses getpwnam(3), which will open master.passwd
for the root user or passwd for non-root users. With -R <path> pw(8) was
always opening <path>/master.passwd, which would fail for a non-root user,
then falsely claim the userid you're trying to show doesn't exist.

Now for a non-root user it opens <path>/passwd and zeroes out the 3 fields
that aren't available in the passwd file, which duplicates the behavior of
getpwnam(3). The net effect is that the showuser output is identical
whether using -R or not.

Details

Provenance
ianAuthored on
Parents
rS336624: fix use of empty in Makefile.ec2
Branches
Unknown
Tags
Unknown