Date: Tue, 14 Jul 1998 12:06:05 +0200 From: Ollivier Robert <roberto@keltia.freenix.fr> To: hackers@FreeBSD.ORG Subject: Re: How do you tell (within the kernel) if we started setuid? Message-ID: <19980714120605.A5227@keltia.freenix.fr> In-Reply-To: <199807140237.KAA10232@ariadne.tensor.pgs.com>; from Stephen Hocking-Senior Programmer PGS Tensor Perth on Tue, Jul 14, 1998 at 10:37:46AM %2B0800 References: <199807140237.KAA10232@ariadne.tensor.pgs.com>
next in thread | previous in thread | raw e-mail | index | archive | help
According to Stephen Hocking-Senior Programmer PGS Tensor Perth:
> If you're executing a program that was started setuid root but has
> subsequently given up its privileges, is there anyway to tell if it was
> originally set uid?
There is a system call about this. It looks for a special flag in the
process entry.
NAME
issetugid - is current process tainted by uid or gid changes
int
issetugid(p, uap)
register struct proc *p;
struct issetugid_args *uap;
{
/*
* Note: OpenBSD sets a P_SUGIDEXEC flag set at execve() time,
* we use P_SUGID because we consider changing the owners as
* "tainting" as well.
* This is significant for procs that start as root and "become"
* a user without an exec - programs cannot know *everything*
* that libc *might* have put in their data segment.
*/
if (p->p_flag & P_SUGID)
return (1);
return (0);
}
--
Ollivier ROBERT -=- FreeBSD: The Power to Serve! -=- roberto@keltia.freenix.fr
FreeBSD keltia.freenix.fr 3.0-CURRENT #61: Sun Jul 12 14:38:23 CEST 1998
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980714120605.A5227>
