Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Oct 1998 13:15:54 -0800 (PST)
From:      rich@math.missouri.edu
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   misc/8467: '#' comments in /etc/group mishandled
Message-ID:  <199810272115.NAA24806@hub.freebsd.org>

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

>Number:         8467
>Category:       misc
>Synopsis:       '#' comments in /etc/group mishandled
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 27 13:20:00 PST 1998
>Last-Modified:
>Originator:     Richard Winkel
>Organization:
Univ. of MO
>Release:        2.2.7-STABLE
>Environment:
FreeBSD roadster.math.missouri.edu 2.2.7-STABLE FreeBSD 2.2.7-STABLE #0:
Thu Oct 15 21:17:36 CDT 1998
root@roadster.math.missouri.edu:/usr/src/sys/compile/g6_sd0  i386

>Description:
grscan() in /usr/src/lib/libc/gen/getgrent.c has no special
handling for comment lines, so, for instance, the line:
#       $Id: group,v 1.13.2.4 1998/09/13 23:10:08 brian Exp $
is treated as an entry for group with gid=10, 
gname="#       $Id: group,v 1.13.2.4 1998/09/13 23" .
Although there's nothing in the group(5) man page about comments,
such handling would be in keeping with the passwd(5) convention
as well as most every other unix config file.

>How-To-Repeat:
With above comment line in /etc/group:
touch /tmp/whatever
chown root.10 /tmp/whatever
ls -l /tmp/whatever
-rw-r--r--  1 root  #          0 Oct 27 14:50 whatever

>Fix:
In /usr/src/lib/libc/gen/getgrent.c, around line 231:

                /* skip lines that are too big */
                if (!index(line, '\n')) {
                        int ch; 
                                        
                        while ((ch = getc(_gr_fp)) != '\n' && ch != EOF)
                                ;
                        continue;               
                }
+               if (*bp=='#') continue; /* skip comment lines */
                if ((_gr_group.gr_name = strsep(&bp, ":\n")) == NULL) {

>Audit-Trail:
>Unformatted:

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?199810272115.NAA24806>