Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jun 1995 01:10:17 -0700
From:      tim@sarc.city.ac.uk
To:        freebsd-bugs
Subject:   bin/517: Bad group change with 'install'
Message-ID:  <199506150810.BAA29481@freefall.cdrom.com>
In-Reply-To: Your message of Thu, 15 Jun 1995 09:03:13 %2B0100 <199506150803.JAA11210@cripplecock.sarc.city.ac.uk>

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

>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:





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