]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - pw/pw_group.c
style(9) (verified no object changes)
[pw-darwin.git] / pw / pw_group.c
index c9af998da2a211a8a79814d13afbcb70e8b8bbb1..10e8675aace5e25930c15abf25a85c0231d83967 100644 (file)
@@ -158,11 +158,13 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args)
         * software.
         */
 
-       if ((arg = getarg(args, 'h')) != NULL) {
+       if ((arg = getarg(args, 'h')) != NULL ||
+           (arg = getarg(args, 'H')) != NULL) {
                if (strcmp(arg->val, "-") == 0)
                        grp->gr_passwd = "*";   /* No access */
                else {
                        int             fd = atoi(arg->val);
+                       int             precrypt = (arg->ch == 'H');
                        int             b;
                        int             istty = isatty(fd);
                        struct termios  t;
@@ -196,7 +198,12 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args)
                                *p = '\0';
                        if (!*line)
                                errx(EX_DATAERR, "empty password read on file descriptor %d", fd);
-                       grp->gr_passwd = pw_pwcrypt(line);
+                       if (precrypt) {
+                               if (strchr(line, ':') != NULL)
+                                       return EX_DATAERR;
+                               grp->gr_passwd = line;
+                       } else
+                               grp->gr_passwd = pw_pwcrypt(line);
                }
        }
 
@@ -211,9 +218,8 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args)
                        int     k = 0;
 
                        while (grp->gr_mem[k] != NULL) {
-                               if (extendarray(&members, &grmembers, i + 2) != -1) {
+                               if (extendarray(&members, &grmembers, i + 2) != -1)
                                        members[i++] = grp->gr_mem[k];
-                               }
                                k++;
                        }
                }