From 94246e65e20b5390d53858447526b231ef1afd67 Mon Sep 17 00:00:00 2001 From: "Anthony G. Basile" Date: Mon, 18 Aug 2014 07:56:08 -0400 Subject: libc: add issetugid() issetugid() returns 1 if the process environment or memory address space is considered tainted, and returns 0 otherwise. This happens, for example, when a process's privileges are elevated by the setuid or setgid flags on an executable belonging to root. This function first appeard in OpenBSD 2.0 and is needed for the LibreSSL. This patch follows the same logic as the equivalent musl commit. For more information see the commit message at http://git.musl-libc.org/cgit/musl/commit/?id=ddddec106fd17c3aca3287005d21e92f742aa9d4 Signed-off-by: Anthony G. Basile Signed-off-by: Bernhard Reutner-Fischer --- include/unistd.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include') diff --git a/include/unistd.h b/include/unistd.h index 540062a42..967e058a3 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -1168,6 +1168,20 @@ extern long int syscall (long int __sysno, ...) __THROW; #endif /* Use misc. */ +/* Are we in a secure process environment or are we dealing with setuid + * stuff? This value is returned by issetugid(). + */ +extern int _pe_secure; +libc_hidden_proto(_pe_secure) + +#ifdef __USE_BSD +/* issetugid() returns 1 if the process environment or memory address space + is considered tainted, and returns 0 otherwise. This happens, for example, + when a process's privileges are elevated by the setuid or setgid flags on + an executable belonging to root. +*/ +extern int issetugid(void); +#endif #if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) && !defined F_LOCK /* NOTE: These declarations also appear in ; be sure to keep both -- cgit v1.2.3