Date: Thu, 27 Jun 2002 20:03:30 +1000 (EST) From: Sean Winn <sean@gothic.net.au> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/39919: chpass no longer edits existing entries Message-ID: <20020627100330.C6CBAA6A01@visi.gothic.net.au>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020627100330.C6CBAA6A01>
