Date: Fri, 2 Nov 2007 00:25:37 GMT From: Ivan Voras <ivoras@FreeBSD.org> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/117751: Make pw(8) support "-d" argument Message-ID: <200711020025.lA20PbRG026423@www.freebsd.org> Resent-Message-ID: <200711020030.lA20U2EX047936@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711020025.lA20PbRG026423>