From owner-freebsd-bugs Thu Jun 15 01:10:27 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id BAA29499 for bugs-outgoing; Thu, 15 Jun 1995 01:10:27 -0700 Received: (from gnats@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id BAA29481 ; Thu, 15 Jun 1995 01:10:17 -0700 Date: Thu, 15 Jun 1995 01:10:17 -0700 Message-Id: <199506150810.BAA29481@freefall.cdrom.com> From: tim@sarc.city.ac.uk Reply-To: tim@sarc.city.ac.uk To: freebsd-bugs Subject: bin/517: Bad group change with 'install' In-Reply-To: Your message of Thu, 15 Jun 1995 09:03:13 +0100 <199506150803.JAA11210@cripplecock.sarc.city.ac.uk> Sender: bugs-owner@FreeBSD.org Precedence: bulk >Number: 517 >Category: bin >Synopsis: Bad group change with 'install' >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs (FreeBSD bugs mailing list) >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jun 15 01:10:01 1995 >Originator: Tim Wilkinson >Organization: Systems Architecture Research Centre, City Uni. UK. >Release: FreeBSD 2.0.5-RELEASE i386 >Environment: >Description: When using 'install' to install software, the '-g' option does not change the group correctly if the owner is also being set and the /etc/group file is being checked because of "+groupname" entries in the /etc/passwd file. Essentially, the information returned by 'getgrnam' is being overwritten by the subsequent call to 'getpwnam' (which inturn calls 'getgrnam'). >How-To-Repeat: Add an entry at then end of the password file such as "+operator:*:0:0:::" then use "install -o root -g kmem" to install a program. The installed program will not get the correct group set. >Fix: The patch below just avoids the problem by changing the order ot the calls to getgrnam and getpwnam so the group information isn't overwritten. This is not so much a fix as a hastily applied bit of sticky tape. *** xinstall.c.orig Thu Jun 15 08:19:11 1995 --- xinstall.c Thu Jun 15 08:19:15 1995 *************** *** 123,132 **** usage(); /* get group and owner id's */ - if (group && !(gp = getgrnam(group))) - err("unknown group %s", group); if (owner && !(pp = getpwnam(owner))) err("unknown user %s", owner); no_target = stat(to_name = argv[argc - 1], &to_sb); if (!no_target && (to_sb.st_mode & S_IFMT) == S_IFDIR) { --- 123,132 ---- usage(); /* get group and owner id's */ if (owner && !(pp = getpwnam(owner))) err("unknown user %s", owner); + if (group && !(gp = getgrnam(group))) + err("unknown group %s", group); no_target = stat(to_name = argv[argc - 1], &to_sb); if (!no_target && (to_sb.st_mode & S_IFMT) == S_IFDIR) { >Audit-Trail: >Unformatted: