summaryrefslogtreecommitdiffstats
path: root/chpass/chpass.c
diff options
context:
space:
mode:
authorJoerg Wunsch <joerg@FreeBSD.org>1996-01-06 15:03:02 +0000
committerJoerg Wunsch <joerg@FreeBSD.org>1996-01-06 15:03:02 +0000
commit3872ef202a1c20f3e4c6321569e6a35ff5dad3e8 (patch)
tree644078cacdaa989be52ea5e8c1712c543843fcf4 /chpass/chpass.c
parenteb69a9ba255593987206b7c9d1310f15136aba03 (diff)
downloadpw-darwin-3872ef202a1c20f3e4c6321569e6a35ff5dad3e8.tar.gz
pw-darwin-3872ef202a1c20f3e4c6321569e6a35ff5dad3e8.tar.zst
pw-darwin-3872ef202a1c20f3e4c6321569e6a35ff5dad3e8.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
Diffstat (limited to 'chpass/chpass.c')
-rw-r--r--chpass/chpass.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/chpass/chpass.c b/chpass/chpass.c
index ea4a558..2bfdd10 100644
--- a/chpass/chpass.c
+++ b/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