summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAlexandre Anriot <aanriot@cvs.openbsd.org>2007-08-14 13:30:46 +0000
committerAlexandre Anriot <aanriot@cvs.openbsd.org>2007-08-14 13:30:46 +0000
commitc82fe7ef0f3a69b48380f5fac7ac1d09c2f2328e (patch)
treec8c8c627234e68ec598b584440ac8d21080a1f21 /usr.bin
parent5f623672c4d648cf41c53ea3267bd7794e7f9d2a (diff)
error out, instead of producing a warning and displaying that the YP
password has changed, when the rpc.yppasswdd daemon is unreachable. ok deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/passwd/yp_passwd.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/usr.bin/passwd/yp_passwd.c b/usr.bin/passwd/yp_passwd.c
index f75f0376643..62f869a0a8c 100644
--- a/usr.bin/passwd/yp_passwd.c
+++ b/usr.bin/passwd/yp_passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: yp_passwd.c,v 1.29 2006/03/30 21:06:29 deraadt Exp $ */
+/* $OpenBSD: yp_passwd.c,v 1.30 2007/08/14 13:30:45 aanriot Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
@@ -30,7 +30,7 @@
*/
#ifndef lint
/*static const char sccsid[] = "from: @(#)yp_passwd.c 1.0 2/2/93";*/
-static const char rcsid[] = "$OpenBSD: yp_passwd.c,v 1.29 2006/03/30 21:06:29 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: yp_passwd.c,v 1.30 2007/08/14 13:30:45 aanriot Exp $";
#endif /* not lint */
#ifdef YP
@@ -172,17 +172,20 @@ yp_passwd(char *username)
tv.tv_usec = 0;
r = clnt_call(client, YPPASSWDPROC_UPDATE,
xdr_yppasswd, &yppasswd, xdr_int, &status, tv);
- if (r)
- warnx("rpc to yppasswdd failed.");
- else if (status) {
+ if (r) {
+ printf("rpc to yppasswdd failed.\n");
+ free(yppasswd.newpw.pw_passwd);
+ return (1);
+ } else if (status) {
printf("Couldn't change YP password.\n");
free(yppasswd.newpw.pw_passwd);
return (1);
+ } else {
+ printf("The YP password has been changed on %s, "
+ "the master YP passwd server.\n", master);
+ free(yppasswd.newpw.pw_passwd);
+ return (0);
}
- printf("The YP password has been changed on %s, "
- "the master YP passwd server.\n", master);
- free(yppasswd.newpw.pw_passwd);
- return (0);
}
char *