system(3) behaviour under Esix rev. D

Walter Mecky walter at mecky.UUCP
Mon Feb 25 03:07:35 AEST 1991


In article <1991Feb17.214252.27336 at metro.ucc.su.OZ.AU> glenn at suphys.physics.su.OZ.AU (Glenn Geers) writes:
< 	I've got a program that is setuid root that runs a system command
< via the system(3) library routine. The problem is that I need the effective
< uid of the calling program to be inherited by the process run by system(3).
< Esix does not seem to do this. If I use my own fork/exec sequence I have no
< problems. The question is: Should system(3) really set the uid of the process
< it runs to the effective uid of the invoking program or to its real uid?
< I have RTFM'd and the former case seems correct but the latter is occuring.

I suppose the bad guy is not system(3) but sh(1). system(3) is calling
/bin/sh and I think in the mentioned fork/exec approach Glenn execed the
program directly not throuh /bin/sh.

I can not speak for ESIX, but in my system (SCO UNIX) this is a
(not documented) fact:

	sh resets the effective uid back to the real 
	uid if they are different and the EUID != 0.

I noticed this in ISC 2.02 too.

Ugly, very ugly, I think, not only because it's undocumented but it
annoys the responsible programmers as Ken (and me) for the sake of 
some careless ones.
-- 
Walter Mecky	[ walter at mecky.uucp	or  ...uunet!unido!mecky!walter ]



More information about the Comp.unix.sysv386 mailing list