]> git.cameronkatri.com Git - pw-darwin.git/commitdiff
Move the YP initialization earlier, so it's done before the evaluation
authorJoerg Wunsch <joerg@FreeBSD.org>
Sat, 6 Jan 1996 15:03:02 +0000 (15:03 +0000)
committerJoerg Wunsch <joerg@FreeBSD.org>
Sat, 6 Jan 1996 15:03:02 +0000 (15:03 +0000)
of -p/-s/-a related cruft.

Closes PR # misc/933 "chpass -s <shell>" does not work

chpass/chpass.c

index ea4a55879c084ef1825bdf56786bad8ab668217b..2bfdd101938b457419ff609d6828f5cdcec56f21 100644 (file)
@@ -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