Subject: CVS commit: [netbsd-2-0] src/usr.sbin/rpc.yppasswdd
To: None <source-changes@NetBSD.org>
From: Matthias Scheler <firstname.lastname@example.org>
Date: 05/20/2004 09:43:00
Module Name: src
Committed By: tron
Date: Thu May 20 09:43:00 UTC 2004
src/usr.sbin/rpc.yppasswdd [netbsd-2-0]: yppasswdd_mkpw.c
Pull up revision 1.12 (requested by wennmach in ticket #350):
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.
Reviewed by <tron>.
To generate a diff of this commit:
cvs rdiff -r1.11 -r126.96.36.199 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.