Subject: CVS commit: [netbsd-1-6] src/usr.sbin/rpc.yppasswdd
To: None <source-changes@NetBSD.org>
From: James Chacon <firstname.lastname@example.org>
Date: 05/20/2004 03:43:18
Module Name: src
Committed By: jmc
Date: Thu May 20 03:43:18 UTC 2004
src/usr.sbin/rpc.yppasswdd [netbsd-1-6]: yppasswdd_mkpw.c
Pullup rev 1.12 (requested by 1694 in ticket #wennmach)
Problem: rpc.yppasswdd didn't work if invoked with the -noshell option.
Reason: In routine make_passwd() in yppasswdd_mkpw.c, fgets() is used
to read master.passwd line-by-line. The lines are then parsed using
pw_scan(), without removing the trailing \n from the line. pw_scan()
fills in the shell name into pw.pw_shell, including the trailing \n.
Subsequently, rpc.yppasswdd calls pw_copy(), which copies master.passwd
to ptmp, updating the entry for pw.pw_name. pw_copy() terminates the
updated entry with an additonal \n, so that there is now an empty line
Finally, rpc.yppasswdd calls pw_mkdb(3), which exec's /usr/sbin/pwd_mkdb
to install ptmp to master.passwd (and to create the pwd.db and spwd.db
data bases). pwd_mkdb chokes on the empty ptmp line.
Fix: remove the trailing \n from the buffer fgets() returns. As a side
effect, this gets us some additional error checking.
To generate a diff of this commit:
cvs rdiff -r184.108.40.206 -r220.127.116.11 src/usr.sbin/rpc.yppasswdd/yppasswdd_mkpw.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.