From owner-freebsd-bugs Tue Oct 27 13:20:05 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA25145 for freebsd-bugs-outgoing; Tue, 27 Oct 1998 13:20:05 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA25136 for ; Tue, 27 Oct 1998 13:20:04 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id NAA12008; Tue, 27 Oct 1998 13:20:00 -0800 (PST) Received: (from nobody@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA24806; Tue, 27 Oct 1998 13:15:54 -0800 (PST) (envelope-from nobody) Message-Id: <199810272115.NAA24806@hub.freebsd.org> Date: Tue, 27 Oct 1998 13:15:54 -0800 (PST) From: rich@math.missouri.edu To: freebsd-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: www-1.0 Subject: misc/8467: '#' comments in /etc/group mishandled Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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