summaryrefslogtreecommitdiffstats
path: root/chpass
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
commit293e929cf55475ad17ed58281f786522f8d2495a (patch)
treecbb1f40667301203f66251e20a5857a4d8856dde /chpass
parent07815d1ab6e165b660f9813e1e31f32249634219 (diff)
downloadpw-darwin-293e929cf55475ad17ed58281f786522f8d2495a.tar.gz
pw-darwin-293e929cf55475ad17ed58281f786522f8d2495a.tar.zst
pw-darwin-293e929cf55475ad17ed58281f786522f8d2495a.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.
Diffstat (limited to 'chpass')
-rw-r--r--chpass/pw_yp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/chpass/pw_yp.c b/chpass/pw_yp.c
index 514bf7c..0080e85 100644
--- a/chpass/pw_yp.c
+++ b/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 {