From owner-freebsd-bugs Wed Feb 11 11:40:04 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA02362 for freebsd-bugs-outgoing; Wed, 11 Feb 1998 11:40:04 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: (from gnats@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA02332; Wed, 11 Feb 1998 11:40:02 -0800 (PST) (envelope-from gnats) Date: Wed, 11 Feb 1998 11:40:02 -0800 (PST) Message-Id: <199802111940.LAA02332@hub.freebsd.org> To: freebsd-bugs Cc: From: Dirk Froemberg Subject: Re: bin/5610: getpwnam and getpwuid do not use the +@netgroup convention in /etc/passwd. Reply-To: Dirk Froemberg Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/5610; it has been noted by GNATS. From: Dirk Froemberg 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 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