NetBSD/usr.sbin/rpc.yppasswdd
wennmach 0269a1249b 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
in ptmp.

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>.
2004-05-12 08:25:53 +00:00
..
Makefile
extern.h
rpc.yppasswdd.8
rpc.yppasswdd.c
yppasswdd_mkpw.c Problem: rpc.yppasswdd didn't work if invoked with the "-noshell" option. 2004-05-12 08:25:53 +00:00
yppasswdd_xdr.c