Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84 exptools; site whuxl.UUCP
Path: utzoo!watmath!clyde!cbosgd!ihnp4!houxm!whuxl!mike
From: mike@whuxl.UUCP (BALDWIN)
Newsgroups: net.unix-wizards
Subject: Re: Re: what are the implications of shell doing setuid(getuid())?
Message-ID: <711@whuxl.UUCP>
Date: Wed, 18-Sep-85 10:07:30 EDT
Article-I.D.: whuxl.711
Posted: Wed Sep 18 10:07:30 1985
Date-Received: Thu, 19-Sep-85 06:44:45 EDT
References: <2581@pegasus.UUCP> <429@ttrdc.UUCP>
Organization: AT&T Bell Laboratories, Whippany
Lines: 14

[ what would break if /bin/sh did setuid(getuid()), setgid(getgid())? ]

> Well, shell scripts invoked by someone who was su'ed to someone else could
> fail, couldn't they, in this situation?  (The resulting spawned shells would
> not have the proper uid and gid.)

Nope, because su(1) sets both the effective *and* the real [ug]id.  The only
way to run the shell with real != effective is to exec it from a set[ug]id
C program (e.g., system(3C) or popen(3S)) or use #!/bin/sh in BSD (but it's
*real* easy to break set[ug]id #!/bin/sh files).
-- 
						Michael Baldwin
						AT&T Bell Labs
						{at&t}!whuxl!mike