Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Nov 1998 02:24:08 +0800 (CST)
From:      clkao@CirX.ORG
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/8753: pwd_mkdb problem when having comments in passwd file
Message-ID:  <199811181824.CAA27802@genius.cirx.org>

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

>Number:         8753
>Category:       bin
>Synopsis:       pwd_mkdb problem when having comments in passwd file
>Confidential:   yes
>Severity:       critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 18 17:00:00 PST 1998
>Last-Modified:
>Originator:     Chia-liang Kao
>Organization:
CirX
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

FreeBSD genius.cirx.org 3.0-CURRENT FreeBSD 3.0-CURRENT #9: Fri Oct 23 01:36:18 CST 1998     clkao@genius.cirx.org:/usr/src/sys/compile/GENIUS  i386

>Description:

getpwent in libc access the db file with a incresing key number; 
where the key pwd_mkdb used is still increasing even if the line is a comment.

Thus, getpwent will fail to retreive the data with the missing key, returning
NULL and the applications will think it is the end of the world.

>How-To-Repeat:

and an empty line or a comment in your master.passwd file and re-pwd_mkdb it.

>Fix:
	
	apply the following patch:
Index: pwd_mkdb.c
===================================================================
RCS file: /usr/local/ncvs//src/usr.sbin/pwd_mkdb/pwd_mkdb.c,v
retrieving revision 1.27
diff -u -r1.27 pwd_mkdb.c
--- pwd_mkdb.c	1998/09/29 20:01:21	1.27
+++ pwd_mkdb.c	1998/11/18 18:16:25
@@ -287,6 +287,10 @@
 		    (pwd.pw_name[0] == '+' || pwd.pw_name[0] == '-'))
 			yp_enabled = 1;
 #define	COMPACT(e)	t = e; while ((*p++ = *t++));
+#ifdef PASSWD_IGNORE_COMMENTS
+		if(is_comment)
+			--cnt;
+#endif
 		if (!is_comment && 
 		    (!username || (strcmp(username, pwd.pw_name) == 0))) {
 			/* Create insecure data. */
>Audit-Trail:
>Unformatted:

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



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