]> git.cameronkatri.com Git - pw-darwin.git/commit
Re-apply r336625 which was reverted with r336638, now that the underlying
authorIan Lepore <ian@FreeBSD.org>
Thu, 26 Jul 2018 20:03:11 +0000 (20:03 +0000)
committerIan Lepore <ian@FreeBSD.org>
Thu, 26 Jul 2018 20:03:11 +0000 (20:03 +0000)
commitc9fa89c1c461381296da12d84e7eb81c4641a4ca
treeeca33aa0a34bd467e089dacd3996bcb63f4dc72d
parentcec26ff1cefd6235cfbefd07302a918e7217b0b1
Re-apply r336625 which was reverted with r336638, now that the underlying
pw_scan(3) has been fixed in a way that doesn't perturb other callers of
it or the getpwnam(3) family.

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 populates the fields in
the returned struct passwd which aren't present in that file with well-known
canonical values, which duplicates the behavior of getpwnam(3).  The net
effect is that the showuser output is identical whether using -R or not.
pw/pw_vpw.c