From: Todd C. Miller Date: Fri, 14 May 2010 20:43:55 +0000 (-0400) Subject: Emulate seteuid using setreuid() or setresuid() as needed. X-Git-Tag: SUDO_1_8_0~630 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=553361aca02fc2f26718838f7c40b815303e696b;p=sudo Emulate seteuid using setreuid() or setresuid() as needed. There are still a few places that call seteuid() directly. --- diff --git a/include/compat.h b/include/compat.h index 1872728aa..3b5c65059 100644 --- a/include/compat.h +++ b/include/compat.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1998-2005, 2008 + * Copyright (c) 1996, 1998-2005, 2008, 2010 * Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any @@ -299,4 +299,16 @@ void setprogname(const char *); # endif #endif +#ifndef HAVE_SETEUID +# if defined(HAVE_SETRESUID) +# define seteuid(u) setresuid(-1, (u), -1) +# define setegid(g) setresgid(-1, (g), -1) +# HAVE_SETEUID 1 +# elif defined(HAVE_SETREUID) +# define seteuid(u) setreuid(-1, (u)) +# define setegid(g) setregid(-1, (g)) +# HAVE_SETEUID 1 +# endif +#endif /* HAVE_SETEUID */ + #endif /* _SUDO_COMPAT_H */