From aa510d6741622bd40bae9c6c3f4e9d1599c033ee Mon Sep 17 00:00:00 2001 From: Eivind Eklund Date: Sat, 6 Nov 1999 20:21:04 +0000 Subject: [PATCH] Flag empty UID entries as errors (to stop typos from turning into alternate root accounts). --- lib/libc/gen/pw_scan.c | 7 ++++++- usr.sbin/pwd_mkdb/pw_scan.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/libc/gen/pw_scan.c b/lib/libc/gen/pw_scan.c index 5190686e5e78..0ce9b1d6b19a 100644 --- a/lib/libc/gen/pw_scan.c +++ b/lib/libc/gen/pw_scan.c @@ -78,7 +78,12 @@ pw_scan(bp, pw) if (!(p = strsep(&bp, ":"))) /* uid */ goto fmt; - if(p[0]) pw->pw_fields |= _PWF_UID; + if (p[0]) + pw->pw_fields |= _PWF_UID; + else { + warnx("no uid for user %s", pw->pw_name); + return (0); + } id = atol(p); if (root && id) { warnx("root uid should be 0"); diff --git a/usr.sbin/pwd_mkdb/pw_scan.c b/usr.sbin/pwd_mkdb/pw_scan.c index 5190686e5e78..0ce9b1d6b19a 100644 --- a/usr.sbin/pwd_mkdb/pw_scan.c +++ b/usr.sbin/pwd_mkdb/pw_scan.c @@ -78,7 +78,12 @@ pw_scan(bp, pw) if (!(p = strsep(&bp, ":"))) /* uid */ goto fmt; - if(p[0]) pw->pw_fields |= _PWF_UID; + if (p[0]) + pw->pw_fields |= _PWF_UID; + else { + warnx("no uid for user %s", pw->pw_name); + return (0); + } id = atol(p); if (root && id) { warnx("root uid should be 0");