diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-02-13 17:28:41 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-02-13 17:28:41 +0000 |
commit | 20ebc0f1a23e4373c9178bda3644e71a0d299fb2 (patch) | |
tree | 77c96e98978146a096cbfae8b03329ca354ef0f4 /usr.bin/chpass | |
parent | 06017b979a8948ac097785616113d4c98df5df13 (diff) |
fix YP and non-YP cases to exit/warn nicely
Diffstat (limited to 'usr.bin/chpass')
-rw-r--r-- | usr.bin/chpass/chpass.c | 17 | ||||
-rw-r--r-- | 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 * |