Skip site navigation (1)Skip section navigation (2)
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:   bin/52433: lines in /etc/group longer than 1024 chars are ignored
Message-ID:  <20030519151447.3EC9B1CC5D@turtle.stack.nl>
Resent-Message-ID: <200305191520.h4JFK99O046930@freefall.freebsd.org>

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

>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:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 19 08:20:09 PDT 2003
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030519151447.3EC9B1CC5D>