diff options
Diffstat (limited to 'crypto/compat/issetugid_linux.c')
-rw-r--r-- | crypto/compat/issetugid_linux.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/crypto/compat/issetugid_linux.c b/crypto/compat/issetugid_linux.c deleted file mode 100644 index 669edce..0000000 --- a/crypto/compat/issetugid_linux.c +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | /* | ||
2 | * issetugid implementation for Linux | ||
3 | * Public domain | ||
4 | */ | ||
5 | |||
6 | #include <errno.h> | ||
7 | #include <gnu/libc-version.h> | ||
8 | #include <string.h> | ||
9 | #include <sys/types.h> | ||
10 | #include <unistd.h> | ||
11 | |||
12 | /* | ||
13 | * Linux-specific glibc 2.16+ interface for determining if a process was | ||
14 | * launched setuid/setgid or with additional capabilities. | ||
15 | */ | ||
16 | #ifdef HAVE_GETAUXVAL | ||
17 | #include <sys/auxv.h> | ||
18 | #endif | ||
19 | |||
20 | int issetugid(void) | ||
21 | { | ||
22 | #ifdef HAVE_GETAUXVAL | ||
23 | /* | ||
24 | * The API for glibc < 2.19 does not indicate if there is an error with | ||
25 | * getauxval. While it should not be the case that any 2.6 or greater | ||
26 | * kernel ever does not supply AT_SECURE, an emulated software environment | ||
27 | * might rewrite the aux vector. | ||
28 | * | ||
29 | * See https://sourceware.org/bugzilla/show_bug.cgi?id=15846 | ||
30 | * | ||
31 | * Perhaps this code should just read the aux vector itself, so we have | ||
32 | * backward-compatibility and error handling in older glibc versions. | ||
33 | * info: http://lwn.net/Articles/519085/ | ||
34 | * | ||
35 | */ | ||
36 | const char *glcv = gnu_get_libc_version(); | ||
37 | if (strverscmp(glcv, "2.19") >= 0) { | ||
38 | errno = 0; | ||
39 | if (getauxval(AT_SECURE) == 0) { | ||
40 | if (errno != ENOENT) { | ||
41 | return 0; | ||
42 | } | ||
43 | } | ||
44 | } | ||
45 | #endif | ||
46 | return 1; | ||
47 | } | ||