Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Feb 1998 11:40:02 -0800 (PST)
From:      Dirk Froemberg <ibex@physik.TU-Berlin.DE>
To:        freebsd-bugs
Subject:   Re: bin/5610: getpwnam and getpwuid do not use the +@netgroup convention in /etc/passwd.
Message-ID:  <199802111940.LAA02332@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/5610; it has been noted by GNATS.

From: Dirk Froemberg <ibex@physik.TU-Berlin.DE>
To: freebsd-gnats-submit@freebsd.org, kmitch@cslab.vt.edu, wpaul@freebsd.org,
        freebsd-bugs@freebsd.org
Cc:  Subject: Re: bin/5610: getpwnam and getpwuid do not use the +@netgroup convention in /etc/passwd.
Date: Wed, 11 Feb 1998 20:35:42 +0100

 --6TrnltStXW4iwmi0
 Content-Type: text/plain; charset=us-ascii
 
 Keith Mitchell <kmitch@cslab.vt.edu> wrote:
 > The getpwnam and getpwuid system calls do not correctly lookup netgroups
 > int the passwd file via a +@netgroup entry.  They do, however work with
 > a +user entry.  The getpwent system call does parse the netgroup
 > imports.
 
 Hello!
 
 The problem seems to be _listmatch() in /usr/src/lib/libc/gen/getnetgrent.c:278.
 It is used by innetgr(3).
 
 If the first argument to _listmatch() is not a comma seperated list, ptr
 increases "forever" in line 296/297.
 
 The attached patch to getnetgrent.c solved the problem for me. Please have
 a look at it and feel free to use it.
 
 	Best regards Dirk
 
 -- 
 e-mail: ibex@physik.tu-berlin.de
 
 --6TrnltStXW4iwmi0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="getnetgrent.c.diff"
 
 *** getnetgrent.c.dist	Wed Nov 19 22:41:42 1997
 --- getnetgrent.c	Wed Feb 11 19:46:02 1998
 ***************
 *** 286,299 ****
   	while(isspace(*ptr))
   		ptr++;
   
 ! 	while (ptr < list + len) {
 ! 		cptr = ptr;
 ! 		while(*ptr != ','  && !isspace(*ptr))
 ! 			ptr++;
 ! 		if (strncmp(cptr, group, glen) == 0 && glen == (ptr - cptr))
   			return(1);
 ! 		while(*ptr == ','  || isspace(*ptr))
 ! 			ptr++;
   	}
   
   	return(0);
 --- 286,305 ----
   	while(isspace(*ptr))
   		ptr++;
   
 ! 	if ((strchr(list, ',') == NULL)) {
 ! 		if (strncmp(ptr, group, glen) == 0) {
   			return(1);
 ! 		}
 ! 	} else {
 ! 		while (ptr < list + len) {
 ! 			cptr = ptr;
 ! 			while(*ptr != ','  && !isspace(*ptr))
 ! 				ptr++;
 ! 			if (strncmp(cptr, group, glen) == 0 && glen == (ptr - cptr))
 ! 				return(1);
 ! 			while(*ptr == ','  || isspace(*ptr))
 ! 				ptr++;
 ! 		}
   	}
   
   	return(0);
 
 --6TrnltStXW4iwmi0--

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?199802111940.LAA02332>