aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/rpc.yppasswdd
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2019-06-03 16:51:07 +0000
committerMark Johnston <markj@FreeBSD.org>2019-06-03 16:51:07 +0000
commit9afd2811871cdd41c617e8104f41f6dc2a627cf9 (patch)
tree5bc455bb423236606dd43ab82f1e1a04ee436a8e /usr.sbin/rpc.yppasswdd
parent8e7299c08b8b1552d68424375aa1845fb0af8816 (diff)
downloadsrc-9afd2811871cdd41c617e8104f41f6dc2a627cf9.tar.gz
src-9afd2811871cdd41c617e8104f41f6dc2a627cf9.zip
Notes
Diffstat (limited to 'usr.sbin/rpc.yppasswdd')
-rw-r--r--usr.sbin/rpc.yppasswdd/yppasswdd_server.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/rpc.yppasswdd/yppasswdd_server.c b/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
index 8845d0d10f9b..2e0b52d3e0d4 100644
--- a/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
+++ b/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
@@ -468,7 +468,9 @@ yppasswdproc_update_1_svc(yppasswd *argp, struct svc_req *rqstp)
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_req *rqstp)
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;
}