From e8373f3b92ae2d1d40750a80881f3ef581c32952 Mon Sep 17 00:00:00 2001 From: deraadt Date: Thu, 13 Feb 1997 17:28:39 +0000 Subject: [PATCH] fix YP and non-YP cases to exit/warn nicely --- usr.bin/chpass/chpass.c | 17 +++++++++-------- usr.bin/chpass/pw_yp.c | 12 ++++++------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/usr.bin/chpass/chpass.c b/usr.bin/chpass/chpass.c index d2701075dee..44544e79d5d 100644 --- a/usr.bin/chpass/chpass.c +++ b/usr.bin/chpass/chpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: chpass.c,v 1.7 1997/01/15 23:42:18 millert Exp $ */ +/* $OpenBSD: chpass.c,v 1.8 1997/02/13 17:28:39 deraadt Exp $ */ /* $NetBSD: chpass.c,v 1.8 1996/05/15 21:50:43 jtc Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)chpass.c 8.4 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: chpass.c,v 1.7 1997/01/15 23:42:18 millert Exp $"; +static char rcsid[] = "$OpenBSD: chpass.c,v 1.8 1997/02/13 17:28:39 deraadt Exp $"; #endif #endif /* not lint */ @@ -210,13 +210,14 @@ main(argc, argv) } } else #endif /* YP */ + { + /* Copy the passwd file to the lock file, updating pw. */ + pw_copy(pfd, tfd, pw); - /* Copy the passwd file to the lock file, updating pw. */ - pw_copy(pfd, tfd, pw); - - /* Now finish the passwd file update. */ - if (pw_mkdb() < 0) - pw_error((char *)NULL, 0, 1); + /* Now finish the passwd file update. */ + if (pw_mkdb() < 0) + pw_error((char *)NULL, 0, 1); + } exit(0); } diff --git a/usr.bin/chpass/pw_yp.c b/usr.bin/chpass/pw_yp.c index c77c82502e7..298c2413574 100644 --- a/usr.bin/chpass/pw_yp.c +++ b/usr.bin/chpass/pw_yp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pw_yp.c,v 1.5 1996/08/31 13:50:19 deraadt Exp $ */ +/* $OpenBSD: pw_yp.c,v 1.6 1997/02/13 17:28:40 deraadt Exp $ */ /* $NetBSD: pw_yp.c,v 1.5 1995/03/26 04:55:33 glass Exp $ */ /* @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)pw_yp.c 1.0 2/2/93"; #else -static char rcsid[] = "$OpenBSD: pw_yp.c,v 1.5 1996/08/31 13:50:19 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: pw_yp.c,v 1.6 1997/02/13 17:28:40 deraadt Exp $"; #endif #endif /* not lint */ @@ -149,7 +149,7 @@ pw_yp(pw, uid) if (client==NULL) { fprintf(stderr, "can't contact yppasswdd on %s: Reason: %s\n", master, yperr_string(YPERR_YPBIND)); - return(0); + return(1); } client->cl_auth = authunix_create_default(); tv.tv_sec = 5; @@ -159,16 +159,16 @@ pw_yp(pw, uid) if (r) { fprintf(stderr, "%s: rpc to yppasswdd failed. %d\n", progname, r); clnt_destroy(client); - return(0); + return(1); } else if (status) { printf("Couldn't change YP password information.\n"); clnt_destroy(client); - return(0); + return(1); } printf("The YP password information has been changed on %s, the master YP passwd server.\n", master); clnt_destroy(client); - return(1); + return(0); } static char * -- 2.20.1