Bug 149641

Summary: /bin/touch drops setgid privileges for no apparent reason
Product: [openSUSE] SUSE LINUX 10.0 Reporter: James Faulkner <james.faulkner>
Component: BasesystemAssignee: Andreas Schwab <schwab>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: suse-beta
Version: Final   
Target Milestone: SUSE Linux 10.1   
Hardware: i686   
OS: SuSE Linux 10.0   
Whiteboard:
Found By: Customer Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description James Faulkner 2006-02-09 18:09:44 UTC
On Suse Linux 10.0 (and Suse Linux 9.3), /bin/touch will drop its privileges if it is executed setgid.  This causes problems when /bin/touch is executed by a setgid script, since it executes with the wrong privileges.

Here's a simplified example on a fresh install of Suse Linux 10.0:

gari:~ # cp /bin/touch /bin/cat /usr/local/bin/
gari:~ # echo hello > /tmp/testing
gari:~ # chmod 660 /tmp/testing
gari:~ # chgrp postfix /tmp/testing
gari:~ # chgrp postfix /usr/local/bin/touch /usr/local/bin/cat
gari:~ # chmod g+s /usr/local/bin/touch /usr/local/bin/cat
gari:~ # su - tomcat
tomcat@gari:~> /usr/local/bin/cat /tmp/testing
hello
tomcat@gari:~> /usr/local/bin/touch /tmp/testing
/usr/local/bin/touch: setting times of `/tmp/testing': Permission denied
tomcat@gari:~>

As you can see, "touch" is mysteriously dropping its setgid privileges, even though "cat", from the same package, keeps its setgid privileges as it should.

On both Gentoo Linux and Red Hat Enterprise Linux, touch will correctly keep its privileges when executing setgid.  I've only had this problem on Suse Linux.
Comment 1 Andreas Schwab 2006-02-13 16:58:43 UTC
Fixed.