summaryrefslogtreecommitdiffstats
path: root/usr.bin/passwd/local_passwd.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1995-09-02 04:02:28 +0000
committerwpaul <wpaul@FreeBSD.org>1995-09-02 04:02:28 +0000
commit7ec855ea34c4df9137a3a8bb27d4cc4fa428610b (patch)
tree39e5a587ae6ef5c5f9f35fb1866e15fe4b1858c6 /usr.bin/passwd/local_passwd.c
parent625b98becbce4bcaf57da39042e6307b750eaf2c (diff)
downloadFreeBSD-src-7ec855ea34c4df9137a3a8bb27d4cc4fa428610b.zip
FreeBSD-src-7ec855ea34c4df9137a3a8bb27d4cc4fa428610b.tar.gz
Bug fix: use the use_yp() function in the chpass(1) code to determine
correctly whether a user is local or NIS (or both, or neither). If you have a user that exists locally but not in NIS, passwd(1) could get confused and try to submit the password change to NIS. (Fortunately, yppasswdd is smart enough to spot the error and reject the change.) Bug reported by: Charles Owens <owensc@enc.edu>
Diffstat (limited to 'usr.bin/passwd/local_passwd.c')
-rw-r--r--usr.bin/passwd/local_passwd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/usr.bin/passwd/local_passwd.c b/usr.bin/passwd/local_passwd.c
index 44c8ffe..a8700ea 100644
--- a/usr.bin/passwd/local_passwd.c
+++ b/usr.bin/passwd/local_passwd.c
@@ -50,6 +50,9 @@ static char sccsid[] = "@(#)local_passwd.c 8.3 (Berkeley) 4/2/94";
#include <pw_copy.h>
#include <pw_util.h>
+#ifdef YP
+#include <pw_yp.h>
+#endif
#include "extern.h"
@@ -139,6 +142,10 @@ local_passwd(uname)
if (!(pw = getpwnam(uname)))
errx(1, "unknown user %s", uname);
+#ifdef YP
+ /* Use the right password information. */
+ pw = (struct passwd *)&local_password;
+#endif
uid = getuid();
if (uid && uid != pw->pw_uid)
errx(1, "%s", strerror(EACCES));
OpenPOWER on IntegriCloud