From owner-freebsd-bugs Thu Jun 27 3:10:16 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 0B5A137B407 for ; Thu, 27 Jun 2002 03:10:03 -0700 (PDT) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g5RAA2JU093193 for ; Thu, 27 Jun 2002 03:10:02 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g5RAA2og093191; Thu, 27 Jun 2002 03:10:02 -0700 (PDT) Received: from visi.gothic.net.au (visi.gothic.net.au [202.182.69.51]) by hub.freebsd.org (Postfix) with ESMTP id B49D637B406 for ; Thu, 27 Jun 2002 03:03:37 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by visi.gothic.net.au (Postfix) with ESMTP id DAAF9A6A81 for ; Thu, 27 Jun 2002 20:03:35 +1000 (EST) Received: by visi.gothic.net.au (Postfix, from userid 0) id C6CBAA6A01; Thu, 27 Jun 2002 20:03:30 +1000 (EST) Message-Id: <20020627100330.C6CBAA6A01@visi.gothic.net.au> Date: Thu, 27 Jun 2002 20:03:30 +1000 (EST) From: Sean Winn Reply-To: Sean Winn To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/39919: chpass no longer edits existing entries Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 39919 >Category: bin >Synopsis: chpass no longer edits existing entries >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jun 27 03:10:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Sean Winn >Release: FreeBSD 4.6-STABLE i386 >Organization: >Environment: System: FreeBSD visi.gothic.net.au 4.6-STABLE FreeBSD 4.6-STABLE #0: Tue Jun 25 01:04:00 EST 2002 sean@visi.gothic.net.au:/usr/obj/usr/src/sys/VISI i386 >Description: chpass has the ability to replace entire password file entries as the super user, which is great for scripts - they grab the existing password file entry, change as needed, then hand off to chpass to do the ugly copy/update/pwd_mkdb work. This worked fine for 4.5, but fails under 4.6R In change 1.9.2.2 of usr.bin/chpass/pw_copy.c, internal consistency checks were added to the copy loop; this relies on old_pw being set correctly in chpass.c; however, chpass.c does not initialise old_pw in all circumstances - the 'a' case specifically ('a' is considered LOADENTRY, and LOADENTRY doen't need to load an old entry - we're replacing unconditionally). This doesn't stop pw_copy being called with an uninitialised old_pw though, and the consistency checks fail. >How-To-Repeat: 19:44 root@visi [~] grep mysql /etc/master.passwd mysql:*:88:88::0:0:MySQL Daemon:/var/db/mysql:/sbin/nologin 19:44 root@visi [~] chpass -a 'mysql:*:88:88::0:0:MySQL Daemon:/var/db/mysql:/sbin/nologin' chpass: /etc/master.passwd: entry inconsistent chpass: /etc/master.passwd: unchanged >Fix: --- usr.bin/chpass/chpass.c.orig Thu Jun 27 19:58:35 2002 +++ usr.bin/chpass/chpass.c Thu Jun 27 20:00:05 2002 @@ -268,7 +268,7 @@ } else { #endif /* YP */ pfd = pw_lock(); - pw_copy(pfd, tfd, pw, &old_pw); + pw_copy(pfd, tfd, pw, (op == LOADENTRY)? NULL : &old_pw ); if (!pw_mkdb(username)) pw_error((char *)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