Dmitry V. Levin | 1da7c95 | 2014-12-13 18:24:13 +0000 | [diff] [blame^] | 1 | #ifdef HAVE_CONFIG_H |
| 2 | # include "config.h" |
| 3 | #endif |
| 4 | #include <assert.h> |
| 5 | #include <unistd.h> |
| 6 | #include <sys/syscall.h> |
| 7 | |
| 8 | int |
| 9 | main(void) |
| 10 | { |
| 11 | #if defined(__NR_getuid) \ |
| 12 | && defined(__NR_setuid) \ |
| 13 | && defined(__NR_getresuid) \ |
| 14 | && defined(__NR_setreuid) \ |
| 15 | && defined(__NR_setresuid) \ |
| 16 | && defined(__NR_chown) |
| 17 | uid_t r, e, s; |
| 18 | |
| 19 | e = syscall(__NR_getuid); |
| 20 | assert(syscall(__NR_setuid, e) == 0); |
| 21 | assert(syscall(__NR_getresuid, &r, &e, &s) == 0); |
| 22 | assert(syscall(__NR_setreuid, -1, -1L) == 0); |
| 23 | assert(syscall(__NR_setresuid, -1, e, -1L) == 0); |
| 24 | assert(syscall(__NR_chown, ".", -1, -1L) == 0); |
| 25 | return 0; |
| 26 | #else |
| 27 | return 77; |
| 28 | #endif |
| 29 | } |