Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Aug 1997 17:49:09 -0700 (PDT)
From:      "Andrew L. Moore" <alm@mclink.com>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Cc:        alm@mclink.com
Subject:   bin/4365: patch for: pw(8) - non-blank `defaultgroup' not accepted
Message-ID:  <199708240049.RAA06333@mclink.com>
Resent-Message-ID: <199708240050.RAA25156@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         4365
>Category:       bin
>Synopsis:       patch for: pw(8) - non-blank `defaultgroup' not accepted
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 23 17:50:01 PDT 1997
>Last-Modified:
>Originator:     Andrew L. Moore
>Organization:
	
>Release:        FreeBSD 2.2-STABLE i386
>Environment:
	all versions of pw(8) through -current (3.0)
System: FreeBSD ns.mclink.com 2.2-STABLE FreeBSD 2.2-STABLE #1: Wed May 28 02:06:16 PDT 1997 alm@ns.mclink.com:/u2/home/freebsd/src-2.2/sys/compile/NS i386


>Description:
	If /etc/pw.conf is set with a valid non-blank `defaultgroup', the
	command `pw user add foo' still creates a new group per user.
        Cause: pw_conf.c calls getgrnam(3) with a quoted arg.
>How-To-Repeat:
	# echo "user1:*:100:" >>/etc/group
	# sed 's/^\(defaultgroup\).*/\1 = "user1"/' /etc/pw.conf >/tmp/foo &&
	> mv /tmp/foo /etc/pw.conf
	# pw user add foo -N
>Fix:
	unquote(arg) i.e.:

diff -u -r1.1.1.1.2.1 pw_conf.c
--- pw_conf.c	1996/12/11 00:14:15	1.1.1.1.2.1
+++ pw_conf.c	1997/08/23 23:40:03
@@ -287,7 +287,7 @@
 							? (char *) bourne_shell : newstr(q);
 						break;
 					case _UC_DEFAULTGROUP:
-						config.default_group = (q == NULL || !boolean_val(q, 1) || getgrnam(q) == NULL)
+						config.default_group = ((q = unquote(q)) == NULL || !boolean_val(q, 1) || getgrnam(q) == NULL)
 							? NULL : newstr(q);
 						break;
 					case _UC_EXTRAGROUPS:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708240049.RAA06333>