Dmitry V. Levin
68804b3267
Newer architectures have no chown syscall, so use fchown* syscalls for testing printuid. * tests/uid.test: Use fchown instead of chown. * tests/uid.c: Test __NR_fchown instead of __NR_chown. (main): Use __NR_fchown instead of __NR_chown. * tests/uid32.c: Test __NR_fchown32 instead of __NR_chown32. (main): Use __NR_fchown32 instead of __NR_chown32. * tests/uid16.c: Test __NR_fchown and __NR_fchown32 instead of __NR_chown and __NR_chown32. (main): Use __NR_fchown instead of __NR_chown. * tests/uid.awk: Update regexp.
37 lines
883 B
C
37 lines
883 B
C
#ifdef HAVE_CONFIG_H
|
|
# include "config.h"
|
|
#endif
|
|
#include <assert.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <sys/syscall.h>
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
#if defined(__NR_getuid32) \
|
|
&& defined(__NR_setuid32) \
|
|
&& defined(__NR_getresuid32) \
|
|
&& defined(__NR_setreuid32) \
|
|
&& defined(__NR_setresuid32) \
|
|
&& defined(__NR_fchown32) \
|
|
&& defined(__NR_getgroups32)
|
|
int r, e, s;
|
|
int size;
|
|
int *list = 0;
|
|
|
|
r = syscall(__NR_getuid32);
|
|
assert(syscall(__NR_setuid32, r) == 0);
|
|
assert(syscall(__NR_getresuid32, &r, &e, &s) == 0);
|
|
assert(syscall(__NR_setreuid32, -1, -1L) == 0);
|
|
assert(syscall(__NR_setresuid32, r, -1, -1L) == 0);
|
|
assert(syscall(__NR_fchown32, 1, -1, -1L) == 0);
|
|
assert((size = syscall(__NR_getgroups32, 0, list)) >= 0);
|
|
assert(list = calloc(size + 1, sizeof(*list)));
|
|
assert(syscall(__NR_getgroups32, size, list) == size);
|
|
return 0;
|
|
#else
|
|
return 77;
|
|
#endif
|
|
}
|