diff options
author | sheldonh <sheldonh@FreeBSD.org> | 1999-11-15 16:45:37 +0000 |
---|---|---|
committer | sheldonh <sheldonh@FreeBSD.org> | 1999-11-15 16:45:37 +0000 |
commit | c973e062a1f6aeb029f3a0f13c59e48f0984c8f9 (patch) | |
tree | 3668680eeb15e1cb1e29b40b87155e3efebda0e7 /usr.sbin/pwd_mkdb/pw_scan.c | |
parent | f2208af484555e6923ed0044b8df4ed291c49bc7 (diff) | |
download | FreeBSD-src-c973e062a1f6aeb029f3a0f13c59e48f0984c8f9.zip FreeBSD-src-c973e062a1f6aeb029f3a0f13c59e48f0984c8f9.tar.gz |
Add to pwd_mkdb a -q option to silence warnings about large IDs. Add a
suitably ominous warning in the manual page.
The diff applied is not the one provided in the attributed PR.
PR: 13344
Reviewed by: bde
Diffstat (limited to 'usr.sbin/pwd_mkdb/pw_scan.c')
-rw-r--r-- | usr.sbin/pwd_mkdb/pw_scan.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/pwd_mkdb/pw_scan.c b/usr.sbin/pwd_mkdb/pw_scan.c index 0ce9b1d..a24380f 100644 --- a/usr.sbin/pwd_mkdb/pw_scan.c +++ b/usr.sbin/pwd_mkdb/pw_scan.c @@ -56,6 +56,13 @@ static const char rcsid[] = #include "pw_scan.h" +/* + * Some software assumes that IDs are short. We should emit warnings + * for id's which can not be stored in a short, but we are more liberal + * by default, warning for IDs greater than USHRT_MAX. + */ +int pw_big_ids_warning = 1; + int pw_scan(bp, pw) char *bp; @@ -89,8 +96,8 @@ pw_scan(bp, pw) warnx("root uid should be 0"); return (0); } - if (id > USHRT_MAX) { - warnx("%s > max uid value (%d)", p, USHRT_MAX); + if (pw_big_ids_warning && id > USHRT_MAX) { + warnx("%s > max uid value (%u)", p, USHRT_MAX); /*return (0);*/ /* THIS SHOULD NOT BE FATAL! */ } pw->pw_uid = id; @@ -99,8 +106,8 @@ pw_scan(bp, pw) goto fmt; if(p[0]) pw->pw_fields |= _PWF_GID; id = atol(p); - if (id > USHRT_MAX) { - warnx("%s > max gid value (%d)", p, USHRT_MAX); + if (pw_big_ids_warning && id > USHRT_MAX) { + warnx("%s > max gid value (%u)", p, USHRT_MAX); /* return (0); This should not be fatal! */ } pw->pw_gid = id; |