From owner-freebsd-bugs Mon Jul 26 19:50: 7 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id C2C47150E9 for ; Mon, 26 Jul 1999 19:50:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id TAA56417; Mon, 26 Jul 1999 19:50:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from smtp.teleway.ne.jp (smtp.teleway.ne.jp [203.140.129.13]) by hub.freebsd.org (Postfix) with ESMTP id 9AA16150D9 for ; Mon, 26 Jul 1999 19:44:02 -0700 (PDT) (envelope-from yasuf@big.or.jp) Received: from post1a.po.teleway.ne.jp (post1a.teleway.ne.jp [203.140.129.22]) by smtp.teleway.ne.jp (8.9.3+3.2W/3.7W) with ESMTP id LAA01276 for ; Tue, 27 Jul 1999 11:44:01 +0900 (JST) (envelope-from yasuf@big.or.jp) Received: from localhost ([210.234.51.51]) by post1a.po.teleway.ne.jp (Post.Office MTA v3.0 release "turbo_2" ID# 110-55583U50000L50000S0V35) with ESMTP id AAA8951 for ; Tue, 27 Jul 1999 11:43:58 +0900 Message-Id: <19990727114358W.yasuf@big.or.jp> Date: Tue, 27 Jul 1999 11:43:58 +0900 From: yasuf@big.or.jp Reply-To: yasuf@big.or.jp To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/12828: passwd(1) doesn't recognize comments Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 12828 >Category: bin >Synopsis: passwd(1) doesn't recognize comments >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 Jul 26 19:50:00 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Yasuhiro Fukuma >Release: FreeBSD 4.0-CURRENT i386 >Organization: >Environment: FreeBSD smoove.ouchi-net.jp 4.0-CURRENT FreeBSD 4.0-CURRENT #10: Sun Jul 4 13:44:45 JST 1999 yasuf@smoove.ouchi-net.jp:/usr/src/sys/compile/ARMADILLO i386 >Description: Passwd(5) manpage says: | Lines whose first non-whitespace character is a pound-sign (#) are com- | ments, and are ignored. Blank lines which consist only of spaces, tabs | or newlines are also ignored. but passwd(1) (, chpass(1), etc.) seems not to support these features correctly. >How-To-Repeat: # tail -3 /etc/master.passwd user1:*:9999:9999::0:0:some user:/home/user1: # comment user2:*:9998:9998::0:0:other user:/home/user2: # passwd user1 Changing local password for user1. New password: Retype new password: passwd: updating the database... passwd: done # passwd user2 Changing local password for user2. New password: Retype new password: passwd: /etc/master.passwd: corrupted entry passwd: /etc/master.passwd: unchanged >Fix: Index: usr.bin/chpass/pw_copy.c =================================================================== RCS file: /home/ncvs/src/usr.bin/chpass/pw_copy.c,v retrieving revision 1.7 diff -u -r1.7 pw_copy.c --- pw_copy.c 1999/04/25 22:37:56 1.7 +++ pw_copy.c 1999/07/23 04:56:26 @@ -85,6 +85,15 @@ goto err; continue; } + for (p = buf; *p != '\n'; p++) + if (*p != ' ' && *p != '\t') + break; + if (*p == '#' || *p == '\n') { + (void)fprintf(to, "%s", buf); + if (ferror(to)) + goto err; + continue; + } if (!(p = strchr(buf, ':'))) { warnx("%s: corrupted entry", _PATH_MASTERPASSWD); pw_error(NULL, 0, 1); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message