From bsw71@mail.ru  Tue Jul 29 20:31:32 2003
Return-Path: <bsw71@mail.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 9354637B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 29 Jul 2003 20:31:32 -0700 (PDT)
Received: from bbms.chelyabinsk.menatepspb.com (bbms.chelyabinsk.menatepspb.com [212.113.102.73])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 27B8B43F85
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 29 Jul 2003 20:31:31 -0700 (PDT)
	(envelope-from bsw71@mail.ru)
Received: from mail.ru (chl-013.chelyabinsk.menatepspb.com [10.24.1.190])
	by bbms-1.chelyabinsk.menatepspb.com (8.12.6/8.11.3) with ESMTP id h6TBiVjx030538
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 29 Jul 2003 17:44:31 +0600 (YEKST)
Message-Id: <3F265E1E.2000202@mail.ru>
Date: Tue, 29 Jul 2003 17:44:30 +0600
From: BSW <bsw71@mail.ru>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Bug report

>Number:         55031
>Category:       kern
>Synopsis:       [libc] getgrent() failure with large groups
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 29 20:40:17 PDT 2003
>Closed-Date:    Thu Jun 01 16:03:25 GMT 2006
>Last-Modified:  Thu Jun 01 16:03:25 GMT 2006
>Originator:     BSW
>Release:        FreeBSD 5.1-RELEASE i386
>Organization:
>Environment:
 System: FreeBSD fbsd-51.mydomain.ru 5.1-RELEASE FreeBSD 5.1-RELEASE #0: 
 Thu Jun 5 02:55:42 GMT 2003 
 root@wv1u.btc.adaptec.com:/usr/obj/usr/src/sys/GENERIC i386
 
>Description:

 getgrent() incorrectly process group[s] which contain too many users. I 
 have long (>1k chars) record in /etc/group. This line "not process".
 See /usr/src/lib/libc/gen/getgrent.c, function getgr(). If first call to 
 fn() return ERANGE (current record too big to fit to grp_storage), then 
 try allocate more memory for grp_storage, but second call to fn() will 
 process _next_ record in group database. Current group-data lost.
 
 
>How-To-Repeat:

 Make long group record (>1k), put any user to this group, try `id user`.
 
>Fix:

 I insert "fgetpos()" before "fgetln()" and "if (rv == NS_RETURN) 
 fsetpos()" at the end of files_group() function in file 
 lib/libc/gen/getgrent.c.
 This helpful with files-database, but patching every NSS-modules is not 
 good idea... :-(
 
 
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: ceri 
Responsible-Changed-When: Sun Aug 10 09:53:36 PDT 2003 
Responsible-Changed-Why:  
Reassign misfiled PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=55031 
State-Changed-From-To: open->closed 
State-Changed-By: maxim 
State-Changed-When: Thu Jun 1 16:03:06 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=55031 
>Unformatted:
