From owner-freebsd-bugs Wed Nov 18 17:00:01 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA14386 for freebsd-bugs-outgoing; Wed, 18 Nov 1998 17:00:01 -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 QAA14349 for ; Wed, 18 Nov 1998 16:59:57 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id RAA23937; Wed, 18 Nov 1998 17:00:01 -0800 (PST) Received: from genius.cirx.org (r00t.m1.ntu.edu.tw [140.112.240.59]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA12957 for ; Wed, 18 Nov 1998 16:47:57 -0800 (PST) (envelope-from clkao@genius.cirx.org) Received: (from root@localhost) by genius.cirx.org (8.9.1/8.8.8) id CAA27802; Thu, 19 Nov 1998 02:24:08 +0800 (CST) (envelope-from clkao) Message-Id: <199811181824.CAA27802@genius.cirx.org> Date: Thu, 19 Nov 1998 02:24:08 +0800 (CST) From: clkao@CirX.ORG Reply-To: clkao@CirX.ORG To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/8753: pwd_mkdb problem when having comments in passwd file Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 8753 >Category: bin >Synopsis: pwd_mkdb problem when having comments in passwd file >Confidential: yes >Severity: critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Nov 18 17:00:00 PST 1998 >Last-Modified: >Originator: Chia-liang Kao >Organization: CirX >Release: FreeBSD 3.0-CURRENT i386 >Environment: FreeBSD genius.cirx.org 3.0-CURRENT FreeBSD 3.0-CURRENT #9: Fri Oct 23 01:36:18 CST 1998 clkao@genius.cirx.org:/usr/src/sys/compile/GENIUS i386 >Description: getpwent in libc access the db file with a incresing key number; where the key pwd_mkdb used is still increasing even if the line is a comment. Thus, getpwent will fail to retreive the data with the missing key, returning NULL and the applications will think it is the end of the world. >How-To-Repeat: and an empty line or a comment in your master.passwd file and re-pwd_mkdb it. >Fix: apply the following patch: Index: pwd_mkdb.c =================================================================== RCS file: /usr/local/ncvs//src/usr.sbin/pwd_mkdb/pwd_mkdb.c,v retrieving revision 1.27 diff -u -r1.27 pwd_mkdb.c --- pwd_mkdb.c 1998/09/29 20:01:21 1.27 +++ pwd_mkdb.c 1998/11/18 18:16:25 @@ -287,6 +287,10 @@ (pwd.pw_name[0] == '+' || pwd.pw_name[0] == '-')) yp_enabled = 1; #define COMPACT(e) t = e; while ((*p++ = *t++)); +#ifdef PASSWD_IGNORE_COMMENTS + if(is_comment) + --cnt; +#endif if (!is_comment && (!username || (strcmp(username, pwd.pw_name) == 0))) { /* Create insecure data. */ >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message