Subject: Re: Addition to force open to open only regular files
To: matthew green <mrg@eterna.com.au>
From: Jaromír Dolecek <dolecek@ibis.cz>
List: tech-kern
Date: 11/13/2000 08:27:10
matthew green wrote:
> the problem is that the *library* has no idea what the program has done,
> therefore can not know what uid is the right one to use for the operation
> at hand...

The "right" uid to use is real uid (one returned by getuid()), isn't it ?
Can it get screwed somehow ? Of course, we need to restore euid
to same value as it was before, so do:

	uid_t euid_before = geteuid();
	seteuid(getuid());
	process $HOSTALIAS file
	seteuid(euid_before);

or can this cause problems under any scenario ? (besides beeing
inherently thread-unsafe, of course)

Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolecek/
@@@@  Wanna a real operating system ? Go and get NetBSD, damn!  @@@@