From jwk@stack.nl  Mon May 19 08:14:55 2003
Return-Path: <jwk@stack.nl>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 6791D37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 May 2003 08:14:55 -0700 (PDT)
Received: from skynet.stack.nl (skynet.stack.nl [131.155.140.225])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8144743F93
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 May 2003 08:14:54 -0700 (PDT)
	(envelope-from jwk@stack.nl)
Received: by skynet.stack.nl (Postfix, from userid 65534)
	id 4B7AA3E27; Mon, 19 May 2003 17:15:50 +0200 (CEST)
Received: from turtle.stack.nl (turtle.stack.nl [2001:610:1108:5010::132])
	by skynet.stack.nl (Postfix) with ESMTP
	id 381E63E25; Mon, 19 May 2003 17:15:44 +0200 (CEST)
Received: by turtle.stack.nl (Postfix, from userid 887)
	id 3EC9B1CC5D; Mon, 19 May 2003 17:14:47 +0200 (CEST)
Message-Id: <20030519151447.3EC9B1CC5D@turtle.stack.nl>
Date: Mon, 19 May 2003 17:14:47 +0200 (CEST)
From: Jan Willem Knopper <jwk@stack.nl>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Jilles Tjoelker <jilles@stack.nl>
Subject: lines in /etc/group longer than 1024 chars are ignored
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         52433
>Category:       bin
>Synopsis:       lines in /etc/group longer than 1024 chars are ignored
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 19 08:20:09 PDT 2003
>Closed-Date:    Thu Jun 01 16:02:55 GMT 2006
>Last-Modified:  Thu Jun 01 16:02:55 GMT 2006
>Originator:     Jan Willem Knopper
>Release:        FreeBSD 5.1-BETA i386
>Organization:
M.C.G.V. Stack
>Environment:
System: FreeBSD turtle.stack.nl 5.1-BETA FreeBSD 5.1-BETA #10: Mon May 12 15:30:54 CEST 2003 jilles@turtle.stack.nl:/usr/obj/usr/src/sys/TURTLE i386

since the manpage of /etc/group mentioned something about compatibility and
long lines: (from before FreeBSD 3.0)

compatibility options in kernel config (as in GENERIC)

options         COMPAT_43               #Compatible with BSD 4.3 [KEEP THIS!]
options         COMPAT_FREEBSD4         #Compatible with FreeBSD4

>Description:
	getgrouplist only returns groups with lines larger than 1024 
	characters if getgrnam is previously called on that group in that
	process.

	This problem only occurs on FreeBSD 5 and not on FreeBSD 4.
>How-To-Repeat:
#include        <stdio.h>
#include        <grp.h>
#include        <unistd.h>

int
main(void)
{
	struct group *longgroup;
	int i, ngroups=16; /* NGROUPS_MAX is 16 */
	gid_t basegid=0, groups[16];

	if ((i=getgrouplist("user", basegid, groups, &ngroups))==-1) {
                perror("getgrouplist");
                return 1;
        }

        printf("ngroups:%d\n", ngroups);

        printf("%d", groups[1]);
        for (i=1;i<ngroups;i++) {
                printf(", %d", groups[i]);
        }
        printf("\n");
	
        longgroup=getgrnam("longgroup");
        if (!longgroup) {
                perror("getgrnam");
                return 1;
        }

	basegid=0; ngroups=16;
	if ((i=getgrouplist("user", basegid, groups, &ngroups))==-1) {
                perror("getgrouplist");
                return 1;
        }

        printf("ngroups:%d\n", ngroups);

        printf("%d", groups[1]);
        for (i=1;i<ngroups;i++) {
                printf(", %d", groups[i]);
        }
        printf("\n");
	
	return(0);
}
>Fix:
	None known.
>Release-Note:
>Audit-Trail:

From: Jan Willem Knopper <jwk@stack.nl>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc: Jan Willem Knopper <jwk@stack.nl>
Subject: Re: bin/52433: lines in /etc/group longer than 1024 chars are ignored
Date: Tue, 20 May 2003 18:11:33 +0200

 FreeBSD-gnats-submit@FreeBSD.org schreef:
 > >Category:       bin
 > >Responsible:    freebsd-bugs
 > >Synopsis:       lines in /etc/group longer than 1024 chars are ignored
 > >Arrival-Date:   Mon May 19 08:20:09 PDT 2003
 
 correction:
 
 With less than 1024 chars the problem still occurs (though it seems to
 be fixed at around 600 chars).
 
 A work-around is `ssh localhost` which does set the group information
 correctly.
 
 Jan Willem Knopper

From: jilles@stack.nl (Jilles Tjoelker)
To: freebsd-gnats-submit@FreeBSD.org, jwk@stack.nl
Cc:  
Subject: Re: bin/52433: lines in /etc/group longer than 1024 chars are ignored
Date: Wed, 28 May 2003 13:38:04 +0200 (CEST)

 The 1024-char limit is for getgrouplist(3), login(1) and su(1) need less to
 function correctly.
 
 The problem did not occur on 5.0-RELEASE. It is very likely that it has
 something to do with the NSS changes recently.
State-Changed-From-To: open->closed 
State-Changed-By: maxim 
State-Changed-When: Thu Jun 1 16:02:17 UTC 2006 
State-Changed-Why:  
Hello, 

I just fixed the bug in HEAD and will MFC a diff to RELENG_6 in 
one month. 

There are several PRs in GNATS about this issue.  I decided 
to left 98111 opened and close all duplications.  If you have 
any comments please submit them as follow-ups to 

http://www.freebsd.org/cgi/query-pr.cgi?pr=98111. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=52433 
>Unformatted:
