Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Feb 1998 20:35:42 +0100
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
Subject:   Re: bin/5610: getpwnam and getpwuid do not use the +@netgroup convention in /etc/passwd.
Message-ID:  <19980211203542.52477@physik.TU-Berlin.DE>

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

--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?19980211203542.52477>