From owner-freebsd-bugs Wed Feb 11 11:37:00 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA01485 for freebsd-bugs-outgoing; Wed, 11 Feb 1998 11:37:00 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from emmi.physik.TU-Berlin.DE (emmi.physik.TU-Berlin.DE [130.149.160.103]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA01322; Wed, 11 Feb 1998 11:35:58 -0800 (PST) (envelope-from ibex@emmi.physik.TU-Berlin.DE) Received: from cip5201.physik.TU-Berlin.DE (cip5201.physik.TU-Berlin.DE [130.149.161.224]) by emmi.physik.TU-Berlin.DE (8.8.8/8.8.8) with ESMTP id UAA04159; Wed, 11 Feb 1998 20:35:43 +0100 (CET) (envelope-from ibex@emmi.physik.TU-Berlin.DE) Received: (from ibex@localhost) by cip5201.physik.TU-Berlin.DE (8.8.7/8.8.7) id UAA00517; Wed, 11 Feb 1998 20:35:43 +0100 (CET) Message-ID: <19980211203542.52477@physik.TU-Berlin.DE> Date: Wed, 11 Feb 1998 20:35:42 +0100 From: Dirk Froemberg To: freebsd-gnats-submit@FreeBSD.ORG, kmitch@cslab.vt.edu, wpaul@FreeBSD.ORG, freebsd-bugs@FreeBSD.ORG Subject: Re: bin/5610: getpwnam and getpwuid do not use the +@netgroup convention in /etc/passwd. Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=6TrnltStXW4iwmi0 X-Mailer: Mutt 0.89i Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --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