Commit Graph

12 Commits

Author SHA1 Message Date
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
grant cacf2d0f45 s/netbsd.org/NetBSD.org/i 2003-11-12 13:31:07 +00:00
bouyer 27b46820fc As discussed on tech-userlevel on Jun, 10 2002, make changes to not use
getpwnam() to get the user's passwd entry but read it from the passwd file
yppasswdd will later update. This allows a NetBSD machine to be master NIS
server without requiring the NIS accounts to exist (via /etc/master.passwd,
nis or other ways) on the local machine.
2002-07-31 14:41:56 +00:00
ad 1e8e78ed07 Update for pw_mkdb() change: restrict updates to one user's records and/or
the secure database where appropriate.
2001-08-18 19:35:32 +00:00
tron 7ebe3b4a17 Add a new "-d" option which allows to define the directory of the
password file as the "-d" options of "pwd_mkdb" and "vipw".
2000-12-08 22:23:14 +00:00
ad 308c65aabe KNF. 2000-08-03 08:22:33 +00:00
itojun bbef2fbaac errx?/warnx? audit. do not pass variable alone, use %s. idea from openbsd 2000-07-07 15:10:32 +00:00
matt 3ab02a8704 More #include <stdlib.h> string, etc. cleanup 2000-07-04 20:27:35 +00:00
is f12b956e84 Allow changing of formerly empty passwords. 1998-11-06 13:07:18 +00:00
phil ffdae81455 Add parameter to call of pw_copy, don't use it, just pass NULL. 1997-07-24 08:54:56 +00:00
thorpej a5e58d3dda Fix compiler warnings. 1997-07-18 07:47:26 +00:00
thorpej d3e1a3664e An rpc.yppasswdd implmentation by Mats O Jansson, with some minor
cleanup and a race condition fix by me.
1996-08-09 10:19:48 +00:00