pw not creating home directories with -V +patch



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"



Relevant Pages

  • fast-user-applet not working in edgy
    ... There seems to be something wrong with fast-user-switch in edgy. ... thing happens when I try to switch by using CTRL-ALT-F7 to switch back ... users, deleted their home directories, changed umask to 022, adduser ... I'm also using 915resolution to fix the resolution on my ...
    (Ubuntu)
  • Re: copy all /home direcories to new drive?
    ... I don't need the -r switch to be recursive as the home directories do have public_html directories in them? ... Death rays don't kill people, ...
    (alt.os.linux)