Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jun 2019 16:51:07 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r348547 - head/usr.sbin/rpc.yppasswdd
Message-ID:  <201906031651.x53Gp7FD019209@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Mon Jun  3 16:51:07 2019
New Revision: 348547
URL: https://svnweb.freebsd.org/changeset/base/348547

Log:
  rpc.yppasswdd: Fix dirname(3) usage after r305952.
  
  PR:		234972
  Submitted by:	Edward Fuhr <edward.fuhr@us.fujitsu.com> (original)
  MFC after:	3 days

Modified:
  head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c

Modified: head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
==============================================================================
--- head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c	Mon Jun  3 16:47:51 2019	(r348546)
+++ head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c	Mon Jun  3 16:51:07 2019	(r348547)
@@ -468,7 +468,9 @@ yppasswdproc_update_1_svc(yppasswd *argp, struct svc_r
 	char *cryptpw;
 	char *oldshell = NULL;
 	char *oldgecos = NULL;
+	char *passdir;
 	char *passfile_hold;
+	char passdir_buf[MAXPATHLEN + 2];
 	char passfile_buf[MAXPATHLEN + 2];
 	char passfile_hold_buf[MAXPATHLEN + 2];
 	char *domain = yppasswd_domain;
@@ -602,11 +604,14 @@ yppasswdproc_update_1_svc(yppasswd *argp, struct svc_r
 	snprintf(passfile_hold_buf, sizeof(passfile_hold_buf),
 	    "%s.hold", passfile);
 	passfile_hold = (char *)&passfile_hold_buf;
-	
 
+
 	/* Step 5: make a new password file with the updated info. */
 
-	if (pw_init(dirname(passfile), passfile)) {
+	snprintf(passdir_buf, sizeof(passdir_buf), "%s", passfile);
+	passdir = dirname(passdir_buf);
+
+	if (pw_init(passdir, passfile)) {
 		yp_error("pw_init() failed");
 		return &result;
 	}
@@ -726,7 +731,9 @@ yppasswdproc_update_master_1_svc(master_yppasswd *argp
 	uid_t uid;
 	int rval = 0;
 	DBT key, data;
+	char *passdir;
 	char *passfile_hold;
+	char passdir_buf[MAXPATHLEN + 2];
 	char passfile_buf[MAXPATHLEN + 2];
 	char passfile_hold_buf[MAXPATHLEN + 2];
 	struct sockaddr_in *rqhost;
@@ -829,7 +836,10 @@ allow additions to be made to the password database");
 	    "%s.hold", passfile);
 	passfile_hold = (char *)&passfile_hold_buf;
 
-	if (pw_init(dirname(passfile), passfile)) {
+	snprintf(passdir_buf, sizeof(passdir_buf), "%s", passfile);
+	passdir = dirname(passdir_buf);
+
+	if (pw_init(passdir, passfile)) {
 		yp_error("pw_init() failed");
 		return &result;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906031651.x53Gp7FD019209>