Date: Wed, 22 Aug 2007 04:17:01 +0200 From: Ivan Voras <ivoras@fer.hr> To: freebsd-hackers@freebsd.org Subject: pw not creating home directories with -V +patch Message-ID: <faibq7$2li$1@sea.gmane.org>
next in thread | raw e-mail | index | archive | help
Hi, I've just found out that pw(8) isn't creating home directories when -V (alternate /etc directory) is specified. I realize this was probably made to avoid foot-shooting but I also think there should be a way to enable this feature. I've created the following patch: --- pw_user.c.old 2007-08-22 04:00:24.000000000 +0200 +++ pw_user.c 2007-08-22 04:10:30.000000000 +0200 @@ -775,7 +775,7 @@ * that this also `works' for editing users if -m is used, but * existing files will *not* be overwritten. */ - if (!PWALTDIR() && getarg(args, 'm') != NULL && pwd->pw_dir && *pwd->pw_dir == '/' && pwd->pw_dir[1]) { + if ((!PWALTDIR() | (PWALTDIR() && getarg(args, 'd') != NULL)) && getarg(args, 'm') != NULL && pwd->pw_dir && *pwd->pw_dir == '/' && pwd->pw_dir[1]) { copymkdir(pwd->pw_dir, cnf->dotdir, cnf->homemode, pwd->pw_uid, pwd->pw_gid); pw_log(cnf, mode, W_USER, "%s(%ld) home %s made", pwd->pw_name, (long) pwd->pw_uid, pwd->pw_dir); This will enable pw to create user's home directory only if the directory name was explicitly specified on the command line (the -d switch), which I think is in the spirit of the -V switch. If someone's available, I'd like this to get committed as soon as possible. (If you need an example of why this behavior is useful, think of creating users for a jail from outside the jail, installers, etc.)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?faibq7$2li$1>