aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>1997-03-29 20:29:12 +0000
committerBill Paul <wpaul@FreeBSD.org>1997-03-29 20:29:12 +0000
commite49249921c0d050a1732ae379ac40f8434c39ae2 (patch)
treeb5bbe57830fd7bd990f4a51b990b8408dc9f0e40 /usr.bin
parent4153d3591919b35d164e0906ed2cb7110b5fe608 (diff)
downloadsrc-e49249921c0d050a1732ae379ac40f8434c39ae2.tar.gz
src-e49249921c0d050a1732ae379ac40f8434c39ae2.zip
Fix for PR #3141: check for NULL before strdup()ing pw->pw_class.
(I'm not sure why this happens, though I suspect it may be because the server is configured with only passwd maps instead of both passwd and master.passwd maps. This is allowed, but I think in this case pw_class is left NULL, hence the problem.) Also applied similar patch to chpass/pw_yp.c just for paranoia's sake.
Notes
Notes: svn path=/head/; revision=24394
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/chpass/pw_yp.c5
-rw-r--r--usr.bin/passwd/yp_passwd.c3
2 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/chpass/pw_yp.c b/usr.bin/chpass/pw_yp.c
index 514bf7ce4bff..0080e85c2976 100644
--- a/usr.bin/chpass/pw_yp.c
+++ b/usr.bin/chpass/pw_yp.c
@@ -35,7 +35,7 @@
* Center for Telecommunications Research
* Columbia University, New York City
*
- * $Id$
+ * $Id: pw_yp.c,v 1.9 1997/02/22 19:54:26 peter Exp $
*/
#ifdef YP
@@ -441,7 +441,8 @@ void yp_submit(pw)
master_yppasswd.newpw.pw_gecos = strdup(pw->pw_gecos);
master_yppasswd.newpw.pw_dir = strdup(pw->pw_dir);
master_yppasswd.newpw.pw_shell = strdup(pw->pw_shell);
- master_yppasswd.newpw.pw_class = strdup(pw->pw_class);
+ master_yppasswd.newpw.pw_class = pw->pw_class != NULL ?
+ strdup(pw->pw_class) : "";
master_yppasswd.oldpass = ""; /* not really needed */
master_yppasswd.domain = yp_domain;
} else {
diff --git a/usr.bin/passwd/yp_passwd.c b/usr.bin/passwd/yp_passwd.c
index d5c05ffa78bb..3eab43a763b4 100644
--- a/usr.bin/passwd/yp_passwd.c
+++ b/usr.bin/passwd/yp_passwd.c
@@ -101,7 +101,8 @@ for other users");
master_yppasswd.newpw.pw_gecos = strdup(pw->pw_gecos);
master_yppasswd.newpw.pw_dir = strdup(pw->pw_dir);
master_yppasswd.newpw.pw_shell = strdup(pw->pw_shell);
- master_yppasswd.newpw.pw_class = strdup(pw->pw_class);
+ master_yppasswd.newpw.pw_class = pw->pw_class != NULL ?
+ strdup(pw->pw_class) : "";
master_yppasswd.oldpass = "";
master_yppasswd.domain = yp_domain;
} else {