bin/117751: Make pw(8) support "-d" argument
Ivan Voras
ivoras at FreeBSD.org
Thu Nov 1 17:30:03 PDT 2007
>Number: 117751
>Category: bin
>Synopsis: Make pw(8) support "-d" argument
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Fri Nov 02 00:30:02 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator: Ivan Voras
>Release: RELENG_7
>Organization:
-
>Environment:
FreeBSD finstall.cosmos 7.0-BETA1 FreeBSD 7.0-BETA1 #0: Thu Nov 1 00:22:43 CET 2007 root at finstall.cosmos:/usr/obj/usr/src/sys/GENERIC i386
>Description:
pw(8) is a command line utility for managing the local password database. Among its possible arguments is a "-d" argument which sets the base directory for the password database (e.g. makes pw operate on a jailed directory tree). Unfortunately this argument is nonuniformly supported - some modes of operation of pw don't support it. This patch adds support for -d argument when -m (create user's directory) is also used while creating a user account.
This patch is used/required by finstall.
>How-To-Repeat:
Run pw useradd -d /jail -m ...
>Fix:
A patch to pw_user.c is attached.
Patch attached with submission follows:
--- 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);
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list