summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/pw_scan.c
diff options
context:
space:
mode:
authormaxim <maxim@FreeBSD.org>2002-10-11 11:35:30 +0000
committermaxim <maxim@FreeBSD.org>2002-10-11 11:35:30 +0000
commit7d25fb4f0a7f37f8e156559c3326d143e998bb41 (patch)
treeae0be00a3c9cf34ae350eaba66fdd24013887501 /lib/libc/gen/pw_scan.c
parent83305ff8ce4afeb36db9dc9cd4ce5f4b7522a66a (diff)
downloadFreeBSD-src-7d25fb4f0a7f37f8e156559c3326d143e998bb41.zip
FreeBSD-src-7d25fb4f0a7f37f8e156559c3326d143e998bb41.tar.gz
Do not allow empty GIDs for non-NIS entries.
MFC after: 2 weeks
Diffstat (limited to 'lib/libc/gen/pw_scan.c')
-rw-r--r--lib/libc/gen/pw_scan.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libc/gen/pw_scan.c b/lib/libc/gen/pw_scan.c
index 3d49aa8..e785511 100644
--- a/lib/libc/gen/pw_scan.c
+++ b/lib/libc/gen/pw_scan.c
@@ -124,6 +124,13 @@ __pw_scan(char *bp, struct passwd *pw, int flags)
goto fmt;
if (p[0])
pw->pw_fields |= _PWF_GID;
+ else {
+ if (pw->pw_name[0] != '+' && pw->pw_name[0] != '-') {
+ if (flags & _PWSCAN_WARN)
+ warnx("no gid for user %s", pw->pw_name);
+ return (0);
+ }
+ }
id = strtoul(p, &ep, 10);
if (errno == ERANGE) {
if (flags & _PWSCAN_WARN)
OpenPOWER on IntegriCloud