Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/usr.sbin/rpc.yppasswdd



Module Name:    src
Committed By:   wennmach
Date:           Wed May 12 08:25:53 UTC 2004

Modified Files:
        src/usr.sbin/rpc.yppasswdd: yppasswdd_mkpw.c

Log Message:
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>.


To generate a diff of this commit:
cvs rdiff -r1.11 -r1.12 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.




Home | Main Index | Thread Index | Old Index