Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Aug 1999 10:16:36 +0200
From:      Sheldon Hearn <sheldonh@uunet.co.za>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/13344: [PATCH] Reduce pwd_mkdb verbosity for id's > USHRT_MAX
Message-ID:  <67538.935482596@axl.noc.iafrica.com>

next in thread | raw e-mail | index | archive | help

>Number:         13344
>Category:       ports
>Synopsis:       [PATCH] Reduce pwd_mkdb verbosity for id's > USHRT_MAX
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 24 01:20:00 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Sheldon Hearn
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
UUNET South Africa
>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 ,

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?67538.935482596>