Date: Tue, 24 Aug 1999 10:31:50 +0200 From: Sheldon Hearn <sheldonh@uunet.co.za> To: freebsd-bugs@freebsd.org Subject: Re: bin/13344: [PATCH] Reduce pwd_mkdb verbosity for id's > USHRT_MAX Message-ID: <67815.935483510@axl.noc.iafrica.com>
index | next in thread | raw e-mail
>Submitter-Id: current-users
>Originator: Sheldon Hearn
>Organization: UUNET South Africa
>Confidential: no
>Synopsis: [PATCH] Reduce pwd_mkdb verbosity for id's > USHRT_MAX
>Severity: non-critical
>Priority: medium
>Category: ports
>Release: FreeBSD 4.0-CURRENT i386
>Class: change-request
>Environment:
FreeBSD 4.0-CURRENT
>Description:
The pwd_mkdb(8) program issues one warning for every UID greater
than USHRT_MAX and one warning for every GID greater than
USHRT_MAX. Since these messages only warn about the potential
for legacy software to choke on these ID's, it seems appropriate
that only one such message be produced for each of the UID and
GID cases.
>How-To-Repeat:
Add the following lines with vipw, save and quit:
pwtest97:*:2147483645:31::0:0:Test Account97:/tmp:/sbin/nologin
pwtest98:*:2147483646:31::0:0:Test Account98:/tmp:/sbin/nologin
pwtest99:*:2147483647:31::0:0:Test Account99:/tmp:/sbin/nologin
The following messages are printed:
pwd_mkdb: 2147483645 > legacy max uid value (65535)
pwd_mkdb: 2147483646 > legacy max uid value (65535)
pwd_mkdb: 2147483647 > legacy max uid value (65535)
This is annoying with a passwd file containing many thousands of
entries.
>Fix:
Although I'm tempted to use a simple error message something
like "one or more uid's are greater than the legacy maximum", I
think it's best we keep the format of the original message
intact for the sake of those who have scripts that watch the
output of pwd_mkdb.
Therefore, I propose the following change, which I'll commit
soon unless I receive objections.
Index: pw_scan.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pwd_mkdb/pw_scan.c,v
retrieving revision 1.6
diff -u -d -r1.6 pw_scan.c
--- pw_scan.c 1997/10/10 06:27:06 1.6
+++ pw_scan.c 1999/08/24 07:48:37
@@ -56,6 +56,9 @@
#include "pw_scan.h"
+static int big_uids = 0; /* Used for legacy max uid_t warning */
+static int big_gids = 0; /* Used for legacy max gid_t warning */
+
int
pw_scan(bp, pw)
char *bp;
@@ -84,9 +87,9 @@
warnx("root uid should be 0");
return (0);
}
- if (id > USHRT_MAX) {
- warnx("%s > max uid value (%d)", p, USHRT_MAX);
- /*return (0);*/ /* THIS SHOULD NOT BE FATAL! */
+ if (id > USHRT_MAX && !(big_uids++)) {
+ warnx("%s > legacy max uid value (%d): "
+ "no more such warnings", p, USHRT_MAX);
}
pw->pw_uid = id;
@@ -94,9 +97,9 @@
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);
- /* return (0); This should not be fatal! */
+ if (id > USHRT_MAX && !(big_gids++)) {
+ warnx("%s > max gid value (%d): "
+ "no more such warnings", p, USHRT_MAX);
}
pw->pw_gid = id;
Index: pwd_mkdb.8
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pwd_mkdb/pwd_mkdb.8,v
retrieving revision 1.9
diff -u -d -r1.9 pwd_mkdb.8
--- pwd_mkdb.8 1999/07/12 20:12:20 1.9
+++ pwd_mkdb.8 1999/08/24 08:06:24
@@ -149,6 +149,13 @@
to install them.
The program was renamed in order that previous users of the program
not be surprised by the changes in functionality.
+.Pp
+The
+.Nm
+program will produce warnings if it finds a UID or GID larger than the
+historical maximum (USHRT_MAX), as these may cause problems for legacy
+software. Only the first such UID and the first such GID will produce a
+warning.
.Sh SEE ALSO
.Xr chpass 1 ,
.Xr passwd 1 ,
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?67815.935483510>
