summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2000-11-13 21:22:50 +0000
committernectar <nectar@FreeBSD.org>2000-11-13 21:22:50 +0000
commit7df19d145567bd8d1f27e401d308a3592bd0fc93 (patch)
tree94458cc31625cf8efa4b7e9d8fae0696e466eb7c /lib/libc/gen
parentcdfb854ffabc6d9e43133266b248f1f6a0321a92 (diff)
downloadFreeBSD-src-7df19d145567bd8d1f27e401d308a3592bd0fc93.zip
FreeBSD-src-7df19d145567bd8d1f27e401d308a3592bd0fc93.tar.gz
Fix bug introduced in previous commit: users obtained via compat mode
had uid, gid set to 0 if not otherwise specified! Submitted by: eivind
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/getpwent.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c
index 85bb988..38c90b4 100644
--- a/lib/libc/gen/getpwent.c
+++ b/lib/libc/gen/getpwent.c
@@ -213,9 +213,14 @@ __pwproto_set()
}
/* uid, gid */
- __pwproto->pw_uid = pw->pw_uid;
- __pwproto->pw_gid = pw->pw_gid;
- __pwproto_flags |= _PWF_UID | _PWF_GID;
+ if (pw->pw_fields & _PWF_UID) {
+ __pwproto->pw_uid = pw->pw_uid;
+ __pwproto_flags |= _PWF_UID;
+ }
+ if (pw->pw_fields & _PWF_GID) {
+ __pwproto->pw_gid = pw->pw_gid;
+ __pwproto_flags |= _PWF_GID;
+ }
/* gecos */
if(pw->pw_gecos && (pw->pw_gecos)[0]) {
OpenPOWER on IntegriCloud