summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw/pw_user.c
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2017-01-28 17:40:37 +0000
committerbapt <bapt@FreeBSD.org>2017-01-28 17:40:37 +0000
commit3206c510a7c09ada5305d89f3613454f341f8864 (patch)
tree00757de34e3127f8ad6ea239c42c9e289a1f404b /usr.sbin/pw/pw_user.c
parente98f2965168b94625c3f81a98692f2b6ab8d6d2d (diff)
downloadFreeBSD-src-3206c510a7c09ada5305d89f3613454f341f8864.zip
FreeBSD-src-3206c510a7c09ada5305d89f3613454f341f8864.tar.gz
MFC r312644, r312650
r312644: Readd a feature lost in pw(8) refactoring pw usermod foo -m It used to be able to (re)create the home directory if it didn't exists PR: 216224 Reported by: ae MFC after: 3 days r312650: Really restore the old behaviour for pw usermod -m It again reinstall missing skel files without overwriting changed one Add a regression test about it Reported by: ae MFC after: 3 days
Diffstat (limited to 'usr.sbin/pw/pw_user.c')
-rw-r--r--usr.sbin/pw/pw_user.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c
index 75e7fb6..8cffac9 100644
--- a/usr.sbin/pw/pw_user.c
+++ b/usr.sbin/pw/pw_user.c
@@ -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);
@@ -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;
OpenPOWER on IntegriCloud