diff options
author | Peter Stromberg <wilfried@cvs.openbsd.org> | 2004-05-10 20:05:49 +0000 |
---|---|---|
committer | Peter Stromberg <wilfried@cvs.openbsd.org> | 2004-05-10 20:05:49 +0000 |
commit | d8673e05cc6bf28c802101fd765950433175cd5e (patch) | |
tree | 4420301cbef3cb521be2cdddf64bcf9e07d9b107 | |
parent | ae8d0af1c8f672050a41b54dd7ce6df477545507 (diff) |
unbreak chsh, ok millert
-rw-r--r-- | usr.bin/chpass/chpass.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/usr.bin/chpass/chpass.c b/usr.bin/chpass/chpass.c index 905579ebad6..42035d2b3f3 100644 --- a/usr.bin/chpass/chpass.c +++ b/usr.bin/chpass/chpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: chpass.c,v 1.30 2004/04/20 23:21:23 millert Exp $ */ +/* $OpenBSD: chpass.c,v 1.31 2004/05/10 20:05:48 wilfried Exp $ */ /* $NetBSD: chpass.c,v 1.8 1996/05/15 21:50:43 jtc Exp $ */ /*- @@ -40,7 +40,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.30 2004/04/20 23:21:23 millert Exp $"; +static char rcsid[] = "$OpenBSD: chpass.c,v 1.31 2004/05/10 20:05:48 wilfried Exp $"; #endif #endif /* not lint */ @@ -155,14 +155,6 @@ main(int argc, char *argv[]) usage(); } - if (op == NEWSH) { - /* protect p_shell -- it thinks NULL is /bin/sh */ - if (!arg[0]) - usage(); - if (p_shell(arg, pw, NULL)) - pw_error(NULL, 0, 1); - } - if (op == LOADENTRY) { if (uid) baduser(); @@ -201,6 +193,14 @@ main(int argc, char *argv[]) } } + if (op == NEWSH) { + /* protect p_shell -- it thinks NULL is /bin/sh */ + if (!arg[0]) + usage(); + if (p_shell(arg, pw, NULL)) + pw_error(NULL, 0, 1); + } + /* Drop user's real uid and block all signals to avoid a DoS. */ setuid(0); sigfillset(&fullset); |