diff options
author | Joerg Wunsch <joerg@FreeBSD.org> | 1996-01-06 15:03:02 +0000 |
---|---|---|
committer | Joerg Wunsch <joerg@FreeBSD.org> | 1996-01-06 15:03:02 +0000 |
commit | 049ceb634f0f2f30f8325939e08b3e04710cd57d (patch) | |
tree | 0ceca8063c6698493269516a311dbf64e85e9ef2 /usr.bin | |
parent | 5f7351637ae07a9489b5d8549e3eb29025fd23a3 (diff) | |
download | src-049ceb634f0f2f30f8325939e08b3e04710cd57d.tar.gz src-049ceb634f0f2f30f8325939e08b3e04710cd57d.zip |
Move the YP initialization earlier, so it's done before the evaluation
of -p/-s/-a related cruft.
Closes PR # misc/933 "chpass -s <shell>" does not work
Notes
Notes:
svn path=/head/; revision=13274
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/chpass/chpass.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/usr.bin/chpass/chpass.c b/usr.bin/chpass/chpass.c index ea4a55879c08..2bfdd101938b 100644 --- a/usr.bin/chpass/chpass.c +++ b/usr.bin/chpass/chpass.c @@ -40,7 +40,7 @@ static char copyright[] = #ifndef lint static char sccsid[] = "From: @(#)chpass.c 8.4 (Berkeley) 4/2/94"; static char rcsid[] = - "$Id: chpass.c,v 1.4 1995/08/13 16:12:24 wpaul Exp $"; + "$Id: chpass.c,v 1.5 1995/09/02 03:56:17 wpaul Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -141,31 +141,6 @@ main(argc, argv) default: usage(); } - if (op == NEWSH) { - /* protect p_shell -- it thinks NULL is /bin/sh */ - if (!arg[0]) - usage(); - if (p_shell(arg, pw, (ENTRY *)NULL)) - pw_error((char *)NULL, 0, 1); - } - - if (op == LOADENTRY) { - if (uid) - baduser(); - pw = &lpw; - if (!pw_scan(arg, pw)) - exit(1); - } - - if (op == NEWPW) { - if (uid) - baduser(); - - if(strchr(arg, ':')) { - errx(1, "invalid format for password"); - } - pw->pw_passwd = arg; - } #ifdef YP pw->pw_name = strdup(pw->pw_name); @@ -193,6 +168,32 @@ main(argc, argv) } #endif /* YP */ + if (op == NEWSH) { + /* protect p_shell -- it thinks NULL is /bin/sh */ + if (!arg[0]) + usage(); + if (p_shell(arg, pw, (ENTRY *)NULL)) + pw_error((char *)NULL, 0, 1); + } + + if (op == LOADENTRY) { + if (uid) + baduser(); + pw = &lpw; + if (!pw_scan(arg, pw)) + exit(1); + } + + if (op == NEWPW) { + if (uid) + baduser(); + + if(strchr(arg, ':')) { + errx(1, "invalid format for password"); + } + pw->pw_passwd = arg; + } + /* * The temporary file/file descriptor usage is a little tricky here. * 1: We start off with two fd's, one for the master password |