]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - pw/pw_user.c
Really restore the old behaviour for pw usermod -m
[pw-darwin.git] / pw / pw_user.c
index 67186c3dc0338b533c4dc170dcd528aba9c94f0d..8cffac98b558bf27bbfc4ce942d77841420785fc 100644 (file)
@@ -1315,7 +1315,7 @@ pw_user_add(int argc, char **argv, char *arg1)
 
        mix_config(cmdcnf, cnf);
        if (default_passwd)
-               cmdcnf->default_password = boolean_val(default_passwd,
+               cmdcnf->default_password = passwd_val(default_passwd,
                    cnf->default_password);
        if (genconf) {
                if (name != NULL)
@@ -1493,7 +1493,7 @@ pw_user_mod(int argc, char **argv, char *arg1)
        intmax_t id = -1;
        int ch, fd = -1;
        size_t i, j;
-       bool quiet, createhome, pretty, dryrun, nis, edited, docreatehome;
+       bool quiet, createhome, pretty, dryrun, nis, edited;
        bool precrypted;
        mode_t homemode = 0;
        time_t expire_days, password_days, now;
@@ -1503,7 +1503,7 @@ pw_user_mod(int argc, char **argv, char *arg1)
        passwd = NULL;
        class = nispasswd = NULL;
        quiet = createhome = pretty = dryrun = nis = precrypted = false;
-       edited = docreatehome = false;
+       edited = false;
 
        if (arg1 != NULL) {
                if (arg1[strspn(arg1, "0123456789")] == '\0')
@@ -1704,8 +1704,6 @@ pw_user_mod(int argc, char **argv, char *arg1)
                        if (!createhome)
                                warnx("WARNING: home `%s' does not exist",
                                    pwd->pw_dir);
-                       else
-                               docreatehome = true;
                } else if (!S_ISDIR(st.st_mode)) {
                        warnx("WARNING: home `%s' is not a directory",
                            pwd->pw_dir);
@@ -1717,7 +1715,7 @@ pw_user_mod(int argc, char **argv, char *arg1)
                if (lc == NULL || login_setcryptfmt(lc, "sha512", NULL) == NULL)
                        warn("setting crypt(3) format");
                login_close(lc);
-               cnf->default_password = boolean_val(passwd,
+               cnf->default_password = passwd_val(passwd,
                    cnf->default_password);
                pwd->pw_passwd = pw_password(cnf, pwd->pw_name, dryrun);
                edited = true;
@@ -1797,7 +1795,7 @@ pw_user_mod(int argc, char **argv, char *arg1)
         * that this also `works' for editing users if -m is used, but
         * existing files will *not* be overwritten.
         */
-       if (PWALTDIR() != PWF_ALT && docreatehome && pwd->pw_dir &&
+       if (PWALTDIR() != PWF_ALT && createhome && pwd->pw_dir &&
            *pwd->pw_dir == '/' && pwd->pw_dir[1]) {
                if (!skel)
                        skel = cnf->dotdir;