summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>1999-11-06 20:21:04 +0000
committereivind <eivind@FreeBSD.org>1999-11-06 20:21:04 +0000
commit3729f7b2f637bab62ff74096ebc7a65a7d513b2b (patch)
tree6b2722dd3873d084e0fc71b6349a83787384c2aa
parenta6deb04268899d424813321956e726cf72cf96a9 (diff)
downloadFreeBSD-src-3729f7b2f637bab62ff74096ebc7a65a7d513b2b.zip
FreeBSD-src-3729f7b2f637bab62ff74096ebc7a65a7d513b2b.tar.gz
Flag empty UID entries as errors (to stop typos from turning into
alternate root accounts).
-rw-r--r--lib/libc/gen/pw_scan.c7
-rw-r--r--usr.sbin/pwd_mkdb/pw_scan.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/libc/gen/pw_scan.c b/lib/libc/gen/pw_scan.c
index 5190686..0ce9b1d 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 5190686..0ce9b1d 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");
OpenPOWER on IntegriCloud