pw not creating home directories with -V +patch
- From: Ivan Voras <ivoras@xxxxxx>
- Date: Wed, 22 Aug 2007 04:17:01 +0200
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.)
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- Prev by Date: Relocatable intel 'em' driver patch(intel v6.4.1)
- Next by Date: Re: modify syscall nr on-the-fly
- Previous by thread: Relocatable intel 'em' driver patch(intel v6.4.1)
- Next by thread: freeBSD
- Index(es):
Relevant Pages
|
|