2 * SPDX-License-Identifier: BSD-4-Clause
4 * Copyright (c) 1995, 1996
5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Bill Paul.
18 * 4. Neither the name of the author nor the names of any co-contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 #include <sys/cdefs.h>
36 #include <sys/param.h>
37 #include <sys/fcntl.h>
38 #include <sys/socket.h>
42 #include <arpa/inet.h>
43 #include <netinet/in.h>
61 #include <rpcsvc/yp.h>
63 #include <rpcsvc/ypclnt.h>
64 #include "yppasswdd_extern.h"
66 #include "yppasswd_private.h"
67 #include "ypxfr_extern.h"
68 #include "yp_extern.h"
70 static struct passwd yp_password;
73 xlate_passwd(struct x_master_passwd *xpwd, struct passwd *pwd)
75 pwd->pw_name = xpwd->pw_name;
76 pwd->pw_passwd = xpwd->pw_passwd;
77 pwd->pw_uid = xpwd->pw_uid;
78 pwd->pw_gid = xpwd->pw_gid;
79 pwd->pw_change = xpwd->pw_change;
80 pwd->pw_class = xpwd->pw_class;
81 pwd->pw_gecos = xpwd->pw_gecos;
82 pwd->pw_dir = xpwd->pw_dir;
83 pwd->pw_shell = xpwd->pw_shell;
84 pwd->pw_expire = xpwd->pw_expire;
85 pwd->pw_fields = xpwd->pw_fields;
89 copy_yp_pass(char *p, int x, int m)
94 yp_password.pw_fields = 0;
96 buf = realloc(buf, m + 10);
99 /* Turn all colons into NULLs */
100 while (strchr(s, ':')) {
101 s = (strchr(s, ':') + 1);
106 #define EXPAND(e) do { \
108 while ((*t++ = *p++)); \
110 EXPAND(yp_password.pw_name);
111 yp_password.pw_fields |= _PWF_NAME;
112 EXPAND(yp_password.pw_passwd);
113 yp_password.pw_fields |= _PWF_PASSWD;
114 yp_password.pw_uid = atoi(p);
115 p += (strlen(p) + 1);
116 yp_password.pw_fields |= _PWF_UID;
117 yp_password.pw_gid = atoi(p);
118 p += (strlen(p) + 1);
119 yp_password.pw_fields |= _PWF_GID;
121 EXPAND(yp_password.pw_class);
122 yp_password.pw_fields |= _PWF_CLASS;
123 yp_password.pw_change = atol(p);
124 p += (strlen(p) + 1);
125 yp_password.pw_fields |= _PWF_CHANGE;
126 yp_password.pw_expire = atol(p);
127 p += (strlen(p) + 1);
128 yp_password.pw_fields |= _PWF_EXPIRE;
130 EXPAND(yp_password.pw_gecos);
131 yp_password.pw_fields |= _PWF_GECOS;
132 EXPAND(yp_password.pw_dir);
133 yp_password.pw_fields |= _PWF_DIR;
134 EXPAND(yp_password.pw_shell);
135 yp_password.pw_fields |= _PWF_SHELL;
139 validchars(char *arg)
143 for (i = 0; i < strlen(arg); i++) {
144 if (iscntrl(arg[i])) {
145 yp_error("string contains a control character");
149 yp_error("string contains a colon");
152 /* Be evil: truncate strings with \n in them silently. */
153 if (arg[i] == '\n') {
162 validate_master(struct passwd *opw __unused, struct x_master_passwd *npw)
165 if (npw->pw_name[0] == '+' || npw->pw_name[0] == '-') {
166 yp_error("client tried to modify an NIS entry");
170 if (validchars(npw->pw_shell)) {
171 yp_error("specified shell contains invalid characters");
175 if (validchars(npw->pw_gecos)) {
176 yp_error("specified gecos field contains invalid characters");
180 if (validchars(npw->pw_passwd)) {
181 yp_error("specified password contains invalid characters");
188 validate(struct passwd *opw, struct x_passwd *npw)
191 if (npw->pw_name[0] == '+' || npw->pw_name[0] == '-') {
192 yp_error("client tried to modify an NIS entry");
196 if ((uid_t)npw->pw_uid != opw->pw_uid) {
197 yp_error("UID mismatch: client says user %s has UID %d",
198 npw->pw_name, npw->pw_uid);
199 yp_error("database says user %s has UID %d", opw->pw_name,
204 if ((gid_t)npw->pw_gid != opw->pw_gid) {
205 yp_error("GID mismatch: client says user %s has GID %d",
206 npw->pw_name, npw->pw_gid);
207 yp_error("database says user %s has GID %d", opw->pw_name,
213 * Don't allow the user to shoot himself in the foot,
216 if (!no_chsh && !ok_shell(npw->pw_shell)) {
217 yp_error("%s is not a valid shell", npw->pw_shell);
221 if (!no_chsh && validchars(npw->pw_shell)) {
222 yp_error("specified shell contains invalid characters");
226 if (validchars(npw->pw_gecos)) {
227 yp_error("specified gecos field contains invalid characters");
231 if (validchars(npw->pw_passwd)) {
232 yp_error("specified password contains invalid characters");
240 * In order to have one rpc.yppasswdd support multiple domains,
241 * we have to cheat: we search each directory under /var/yp
242 * and try to match the user in each master.passwd.byname
243 * map that we find. If the user matches (username, uid and gid
244 * all agree), then we use that domain. If we match the user in
245 * more than one database, we must abort.
248 find_domain(struct x_passwd *pw)
253 char yp_mapdir[MAXPATHLEN + 2];
254 static char domain[YPMAXDOMAIN];
259 yp_error("performing multidomain lookup");
261 if ((dird = opendir(yp_dir)) == NULL) {
262 yp_error("opendir(%s) failed: %s", yp_dir, strerror(errno));
266 while ((dirp = readdir(dird)) != NULL) {
267 snprintf(yp_mapdir, sizeof yp_mapdir, "%s/%s",
268 yp_dir, dirp->d_name);
269 if (stat(yp_mapdir, &statbuf) < 0) {
270 yp_error("stat(%s) failed: %s", yp_mapdir,
275 if (S_ISDIR(statbuf.st_mode)) {
276 tmp = (char *)dirp->d_name;
277 key.data = pw->pw_name;
278 key.size = strlen(pw->pw_name);
280 if (yp_get_record(tmp,"master.passwd.byname",
281 &key, &data, 0) != YP_TRUE) {
284 *((char *)data.data + data.size) = '\0';
285 copy_yp_pass(data.data, 1, data.size);
286 if (yp_password.pw_uid == (uid_t)pw->pw_uid &&
287 yp_password.pw_gid == (gid_t)pw->pw_gid) {
289 snprintf(domain, YPMAXDOMAIN, "%s", tmp);
296 yp_error("found same user in two different domains");
299 return((char *)&domain);
302 static const char *maps[] = {
303 "master.passwd.byname",
304 "master.passwd.byuid",
309 static const char *formats[] = {
310 "%s:%s:%d:%d:%s:%ld:%ld:%s:%s:%s",
311 "%s:%s:%d:%d:%s:%ld:%ld:%s:%s:%s",
312 "%s:%s:%d:%d:%s:%s:%s",
313 "%s:%s:%d:%d:%s:%s:%s"
317 update_inplace(struct passwd *pw, char *domain)
320 DBT key = { NULL, 0 };
321 DBT data = { NULL, 0 };
326 static char yp_last[] = "YP_LAST_MODIFIED";
329 snprintf(yplastbuf, sizeof yplastbuf, "%llu",
330 (unsigned long long)time(NULL));
333 for (i = 0; i < 4; i++) {
336 snprintf(keybuf, sizeof keybuf,
337 "%llu", (unsigned long long)pw->pw_uid);
339 key.size = strlen(keybuf);
341 key.data = pw->pw_name;
342 key.size = strlen(pw->pw_name);
346 * XXX The passwd.byname and passwd.byuid maps come in
347 * two flavors: secure and insecure. The secure version
348 * has a '*' in the password field whereas the insecure one
349 * has a real crypted password. The maps will be insecure
350 * if they were built with 'unsecure = TRUE' enabled in
351 * /var/yp/Makefile, but we'd have no way of knowing if
352 * this has been done unless we were to try parsing the
353 * Makefile, which is a disgusting thought. Instead, we
354 * read the records from the maps, skip to the first ':'
355 * in them, and then look at the character immediately
356 * following it. If it's an '*' then the map is 'secure'
357 * and we must not insert a real password into the pw_passwd
358 * field. If it's not an '*', then we put the real crypted
361 if (yp_get_record(domain,maps[i],&key,&data,1) != YP_TRUE) {
362 yp_error("couldn't read %s/%s: %s", domain,
363 maps[i], strerror(errno));
367 if ((ptr = strchr(data.data, ':')) == NULL) {
368 yp_error("no colon in passwd record?!");
373 * XXX Supposing we have more than one user with the same
374 * UID? (Or more than one user with the same name?) We could
375 * end up modifying the wrong record if were not careful.
378 if (strncmp(data.data, pw->pw_name,
379 strlen(pw->pw_name))) {
380 yp_error("warning: found entry for UID %d \
381 in map %s@%s with wrong name (%.*s)", pw->pw_uid, maps[i], domain,
382 (int)(ptr - (char *)data.data),
384 yp_error("there may be more than one user \
385 with the same UID - continuing");
390 * We're really being ultra-paranoid here.
391 * This is generally a 'can't happen' condition.
394 asprintf(&pwbuf, ":%d:%d:", pw->pw_uid, pw->pw_gid);
396 yp_error("no memory");
399 if (!strstr(data.data, pwbuf)) {
400 yp_error("warning: found entry for user %s \
401 in map %s@%s with wrong UID", pw->pw_name, maps[i], domain);
402 yp_error("there may be more than one user \
403 with the same name - continuing");
410 asprintf(&pwbuf, formats[i],
411 pw->pw_name, pw->pw_passwd, pw->pw_uid,
412 pw->pw_gid, pw->pw_class, pw->pw_change,
413 pw->pw_expire, pw->pw_gecos, pw->pw_dir,
417 asprintf(&pwbuf, formats[i],
418 pw->pw_name, *(ptr+1) == '*' ? "*" : pw->pw_passwd,
419 pw->pw_uid, pw->pw_gid, pw->pw_gecos, pw->pw_dir,
423 yp_error("no memory");
427 #define FLAGS O_RDWR|O_CREAT
429 if ((dbp = yp_open_db_rw(domain, maps[i], FLAGS)) == NULL) {
430 yp_error("couldn't open %s/%s r/w: %s",domain,
431 maps[i],strerror(errno));
436 data.size = strlen(pwbuf);
438 if (yp_put_record(dbp, &key, &data, 1) != YP_TRUE) {
439 yp_error("failed to update record in %s/%s", domain,
441 (void)(dbp->close)(dbp);
446 key.size = strlen(yp_last);
447 data.data = (char *)&yplastbuf;
448 data.size = strlen(yplastbuf);
450 if (yp_put_record(dbp, &key, &data, 1) != YP_TRUE) {
451 yp_error("failed to update timestamp in %s/%s", domain,
453 (void)(dbp->close)(dbp);
457 (void)(dbp->close)(dbp);
468 yppasswdproc_update_1_svc(yppasswd *argp, struct svc_req *rqstp)
471 struct sockaddr_in *rqhost;
476 int passwd_changed = 0;
477 int shell_changed = 0;
478 int gecos_changed = 0;
480 char *oldshell = NULL;
481 char *oldgecos = NULL;
484 char passdir_buf[MAXPATHLEN + 2];
485 char passfile_buf[MAXPATHLEN + 2];
486 char passfile_hold_buf[MAXPATHLEN + 2];
487 char *domain = yppasswd_domain;
488 static struct sockaddr_in clntaddr;
489 static struct timeval t_saved, t_test;
492 * Normal user updates always use the 'default' master.passwd file.
495 passfile = passfile_default;
498 rqhost = svc_getcaller(rqstp->rq_xprt);
500 gettimeofday(&t_test, NULL);
501 if (!bcmp(rqhost, &clntaddr, sizeof *rqhost) &&
502 t_test.tv_sec > t_saved.tv_sec &&
503 t_test.tv_sec - t_saved.tv_sec < 300) {
505 bzero(&clntaddr, sizeof clntaddr);
506 bzero(&t_saved, sizeof t_saved);
510 bcopy(rqhost, &clntaddr, sizeof clntaddr);
511 gettimeofday(&t_saved, NULL);
513 if (yp_access(resvport ? "master.passwd.byname" : NULL, rqstp)) {
514 yp_error("rejected update request from unauthorized host");
515 svcerr_auth(rqstp->rq_xprt, AUTH_BADCRED);
520 * Step one: find the user. (It's kinda pointless to
521 * proceed if the user doesn't exist.) We look for the
522 * user in the master.passwd.byname database, _NOT_ by
523 * using getpwent() and friends! We can't use getpwent()
524 * since the NIS master server is not guaranteed to be
525 * configured as an NIS client.
529 if ((domain = find_domain(&argp->newpw)) == NULL) {
530 yp_error("multidomain lookup failed - aborting update");
533 yp_error("updating user %s in domain %s",
534 argp->newpw.pw_name, domain);
537 key.data = argp->newpw.pw_name;
538 key.size = strlen(argp->newpw.pw_name);
540 if ((rval = yp_get_record(domain,"master.passwd.byname",
541 &key, &data, 0)) != YP_TRUE) {
542 if (rval == YP_NOKEY) {
543 yp_error("user %s not found in passwd database",
544 argp->newpw.pw_name);
546 yp_error("database access error: %s",
552 /* Nul terminate, please. */
553 *((char *)data.data + data.size) = '\0';
555 copy_yp_pass(data.data, 1, data.size);
557 /* Step 2: check that the supplied oldpass is valid. */
559 cryptpw = crypt(argp->oldpass, yp_password.pw_passwd);
560 if (cryptpw == NULL || strcmp(cryptpw, yp_password.pw_passwd)) {
561 yp_error("rejected change attempt -- bad password");
562 yp_error("client address: %s username: %s",
563 inet_ntoa(rqhost->sin_addr),
564 argp->newpw.pw_name);
568 /* Step 3: validate the arguments passed to us by the client. */
570 if (validate(&yp_password, &argp->newpw)) {
571 yp_error("rejecting change attempt: bad arguments");
572 yp_error("client address: %s username: %s",
573 inet_ntoa(rqhost->sin_addr),
574 argp->newpw.pw_name);
575 svcerr_decode(rqstp->rq_xprt);
579 /* Step 4: update the user's passwd structure. */
581 if (!no_chsh && strcmp(argp->newpw.pw_shell, yp_password.pw_shell)) {
582 oldshell = yp_password.pw_shell;
583 yp_password.pw_shell = argp->newpw.pw_shell;
588 if (!no_chfn && strcmp(argp->newpw.pw_gecos, yp_password.pw_gecos)) {
589 oldgecos = yp_password.pw_gecos;
590 yp_password.pw_gecos = argp->newpw.pw_gecos;
594 if (strcmp(argp->newpw.pw_passwd, yp_password.pw_passwd)) {
595 yp_password.pw_passwd = argp->newpw.pw_passwd;
596 yp_password.pw_change = 0;
601 * If the caller specified a domain other than our 'default'
602 * domain, change the path to master.passwd accordingly.
605 if (strcmp(domain, yppasswd_domain)) {
606 snprintf(passfile_buf, sizeof(passfile_buf),
607 "%s/%s/master.passwd", yp_dir, domain);
608 passfile = (char *)&passfile_buf;
612 * Create a filename to hold the original master.passwd
613 * so if our call to yppwupdate fails we can roll back
615 snprintf(passfile_hold_buf, sizeof(passfile_hold_buf),
616 "%s.hold", passfile);
617 passfile_hold = (char *)&passfile_hold_buf;
620 /* Step 5: make a new password file with the updated info. */
622 snprintf(passdir_buf, sizeof(passdir_buf), "%s", passfile);
623 passdir = dirname(passdir_buf);
625 if (pw_init(passdir, passfile)) {
626 yp_error("pw_init() failed");
629 if ((pfd = pw_lock()) == -1) {
631 yp_error("pw_lock() failed");
634 if ((tfd = pw_tmp(-1)) == -1) {
636 yp_error("pw_tmp() failed");
639 if (pw_copy(pfd, tfd, &yp_password, NULL) == -1) {
641 yp_error("pw_copy() failed");
644 if (rename(passfile, passfile_hold) == -1) {
646 yp_error("rename of %s to %s failed", passfile,
651 if (strcmp(passfile, _PATH_MASTERPASSWD) == 0) {
653 * NIS server is exporting the system's master.passwd.
654 * Call pw_mkdb to rebuild passwd and the .db files
656 if (pw_mkdb(yp_password.pw_name) == -1) {
658 yp_error("pw_mkdb() failed");
659 rename(passfile_hold, passfile);
664 * NIS server is exporting a private master.passwd.
665 * Rename tempfile into final location
667 if (rename(pw_tempname(), passfile) == -1) {
669 yp_error("rename of %s to %s failed",
670 pw_tempname(), passfile);
671 rename(passfile_hold, passfile);
679 if ((rval = update_inplace(&yp_password, domain))) {
680 yp_error("inplace update failed -- rebuilding maps");
684 switch ((pid = fork())) {
686 if (inplace && !rval) {
687 execlp(MAP_UPDATE_PATH, MAP_UPDATE, passfile,
688 yppasswd_domain, "pushpw", (char *)NULL);
690 execlp(MAP_UPDATE_PATH, MAP_UPDATE, passfile,
691 yppasswd_domain, (char *)NULL);
693 yp_error("couldn't exec map update process: %s",
696 rename(passfile_hold, passfile);
700 yp_error("fork() failed: %s", strerror(errno));
702 rename(passfile_hold, passfile);
706 unlink(passfile_hold);
711 yp_error("update completed for user %s (uid %d) in %s:",
712 argp->newpw.pw_name, argp->newpw.pw_uid, passfile);
715 yp_error("password changed");
718 yp_error("gecos changed ('%s' -> '%s')",
719 oldgecos, argp->newpw.pw_gecos);
722 yp_error("shell changed ('%s' -> '%s')",
723 oldshell, argp->newpw.pw_shell);
731 * Note that this function performs a little less sanity checking
732 * than the last one. Since only the superuser is allowed to use it,
733 * it is assumed that the caller knows what he's doing.
736 yppasswdproc_update_master_1_svc(master_yppasswd *argp,
737 struct svc_req *rqstp)
747 char passdir_buf[MAXPATHLEN + 2];
748 char passfile_buf[MAXPATHLEN + 2];
749 char passfile_hold_buf[MAXPATHLEN + 2];
750 struct sockaddr_in *rqhost;
752 struct passwd newpasswd;
755 transp = rqstp->rq_xprt;
758 * NO AF_INET CONNETCIONS ALLOWED!
760 rqhost = svc_getcaller(transp);
761 if (rqhost->sin_family != AF_UNIX) {
762 yp_error("Alert! %s/%d attempted to use superuser-only \
763 procedure!\n", inet_ntoa(rqhost->sin_addr), rqhost->sin_port);
764 svcerr_auth(transp, AUTH_BADCRED);
768 if (rqstp->rq_cred.oa_flavor != AUTH_SYS) {
769 yp_error("caller didn't send proper credentials");
770 svcerr_auth(transp, AUTH_BADCRED);
774 if (__rpc_get_local_uid(transp, &uid) < 0) {
775 yp_error("caller didn't send proper credentials");
776 svcerr_auth(transp, AUTH_BADCRED);
781 yp_error("caller euid is %d, expecting 0 -- rejecting request",
783 svcerr_auth(rqstp->rq_xprt, AUTH_BADCRED);
787 passfile = passfile_default;
789 key.data = argp->newpw.pw_name;
790 key.size = strlen(argp->newpw.pw_name);
793 * The superuser may add entries to the passwd maps if
794 * rpc.yppasswdd is started with the -a flag. Paranoia
795 * prevents me from allowing additions by default.
797 if ((rval = yp_get_record(argp->domain, "master.passwd.byname",
798 &key, &data, 0)) != YP_TRUE) {
799 if (rval == YP_NOKEY) {
800 yp_error("user %s not found in passwd database",
801 argp->newpw.pw_name);
803 yp_error("notice: adding user %s to \
804 master.passwd database for domain %s", argp->newpw.pw_name, argp->domain);
806 yp_error("restart rpc.yppasswdd with the -a flag to \
807 allow additions to be made to the password database");
809 yp_error("database access error: %s",
812 if (!allow_additions)
816 /* Nul terminate, please. */
817 *((char *)data.data + data.size) = '\0';
819 copy_yp_pass(data.data, 1, data.size);
823 * Perform a small bit of sanity checking.
825 if (validate_master(rval == YP_TRUE ? &yp_password:NULL,&argp->newpw)){
826 yp_error("rejecting update attempt for %s: bad arguments",
827 argp->newpw.pw_name);
832 * If the caller specified a domain other than our 'default'
833 * domain, change the path to master.passwd accordingly.
836 if (strcmp(argp->domain, yppasswd_domain)) {
837 snprintf(passfile_buf, sizeof(passfile_buf),
838 "%s/%s/master.passwd", yp_dir, argp->domain);
839 passfile = (char *)&passfile_buf;
843 * Create a filename to hold the original master.passwd
844 * so if our call to yppwupdate fails we can roll back
846 snprintf(passfile_hold_buf, sizeof(passfile_hold_buf),
847 "%s.hold", passfile);
848 passfile_hold = (char *)&passfile_hold_buf;
850 snprintf(passdir_buf, sizeof(passdir_buf), "%s", passfile);
851 passdir = dirname(passdir_buf);
853 if (pw_init(passdir, passfile)) {
854 yp_error("pw_init() failed");
857 if ((pfd = pw_lock()) == -1) {
859 yp_error("pw_lock() failed");
862 if ((tfd = pw_tmp(-1)) == -1) {
864 yp_error("pw_tmp() failed");
867 xlate_passwd(&argp->newpw, &newpasswd);
868 if (pw_copy(pfd, tfd, &newpasswd, NULL) == -1) {
870 yp_error("pw_copy() failed");
873 if (rename(passfile, passfile_hold) == -1) {
875 yp_error("rename of %s to %s failed", passfile,
879 if (strcmp(passfile, _PATH_MASTERPASSWD) == 0) {
881 * NIS server is exporting the system's master.passwd.
882 * Call pw_mkdb to rebuild passwd and the .db files
884 if (pw_mkdb(argp->newpw.pw_name) == -1) {
886 yp_error("pw_mkdb() failed");
887 rename(passfile_hold, passfile);
892 * NIS server is exporting a private master.passwd.
893 * Rename tempfile into final location
895 if (rename(pw_tempname(), passfile) == -1) {
897 yp_error("rename of %s to %s failed",
898 pw_tempname(), passfile);
899 rename(passfile_hold, passfile);
906 xlate_passwd(&argp->newpw, &newpasswd);
907 if ((rval = update_inplace(&newpasswd, argp->domain))) {
908 yp_error("inplace update failed -- rebuilding maps");
912 switch ((pid = fork())) {
914 if (inplace && !rval) {
915 execlp(MAP_UPDATE_PATH, MAP_UPDATE, passfile,
916 argp->domain, "pushpw", (char *)NULL);
918 execlp(MAP_UPDATE_PATH, MAP_UPDATE, passfile,
919 argp->domain, (char *)NULL);
921 yp_error("couldn't exec map update process: %s",
924 rename(passfile_hold, passfile);
928 yp_error("fork() failed: %s", strerror(errno));
930 rename(passfile_hold, passfile);
934 unlink(passfile_hold);
938 yp_error("performed update of user %s (uid %d) domain %s",