summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorSheldon Hearn <sheldonh@FreeBSD.org>1999-11-15 16:45:37 +0000
committerSheldon Hearn <sheldonh@FreeBSD.org>1999-11-15 16:45:37 +0000
commit9259c33814862711fc6dc6c07c171c31d1789cde (patch)
tree9d77e7fc49aacb6c967b635296190f1b2ef98de5 /libc
parentf9f3afba9754829f8a22ecfea8d3f1c0c8d23bff (diff)
downloadpw-darwin-9259c33814862711fc6dc6c07c171c31d1789cde.tar.gz
pw-darwin-9259c33814862711fc6dc6c07c171c31d1789cde.tar.zst
pw-darwin-9259c33814862711fc6dc6c07c171c31d1789cde.zip
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 'libc')
-rw-r--r--libc/gen/pw_scan.c15
-rw-r--r--libc/gen/pw_scan.h4
2 files changed, 15 insertions, 4 deletions
diff --git a/libc/gen/pw_scan.c b/libc/gen/pw_scan.c
index 0ce9b1d..a24380f 100644
--- a/libc/gen/pw_scan.c
+++ b/libc/gen/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;
diff --git a/libc/gen/pw_scan.h b/libc/gen/pw_scan.h
index d1d4bc1..2519bd4 100644
--- a/libc/gen/pw_scan.h
+++ b/libc/gen/pw_scan.h
@@ -31,6 +31,10 @@
* SUCH DAMAGE.
*
* @(#)pw_scan.h 8.1 (Berkeley) 4/1/94
+ *
+ * $FreeBSD$
*/
+extern int pw_big_ids_warning;
+
extern int pw_scan __P((char *, struct passwd *));