9 if conf
.CHECK_BUNDLED_SYSTEM('uid_wrapper', minversion
=VERSION
, set_target
=False):
10 conf
.DEFINE('USING_SYSTEM_UID_WRAPPER', 1)
11 libuid_wrapper_so_path
= 'libuid_wrapper.so'
13 # check HAVE_GCC_ATOMIC_BUILTINS
19 __atomic_load(p_x, &x, __ATOMIC_RELAXED);
22 'HAVE_GCC_ATOMIC_BUILTINS',
24 msg
='Checking for atomic builtins')
26 # check HAVE_GCC_THREAD_LOCAL_STORAGE
34 'HAVE_GCC_THREAD_LOCAL_STORAGE',
36 msg
='Checking for thread local storage')
38 if Options
.options
.address_sanitizer
:
39 # check HAVE_ADDRESS_SANITIZER_ATTRIBUTE
41 void test_address_sanitizer_attribute(void) __attribute__((no_sanitize_address));
43 void test_address_sanitizer_attribute(void)
52 'HAVE_ADDRESS_SANITIZER_ATTRIBUTE',
54 cflags
='-Wall -Wextra -Werror',
55 msg
='Checking for address sanitizer attribute')
57 # check HAVE_FUNCTION_ATTRIBUTE_FORMAT
59 void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
65 'HAVE_FUNCTION_ATTRIBUTE_FORMAT',
67 msg
='Checking for printf format validation support')
69 conf
.CHECK_C_PROTOTYPE('setgroups',
70 'int setgroups(int ngroups, const gid_t *grouplist)',
71 define
='HAVE_SETGROUPS_INT', headers
='unistd.h sys/types.h')
72 conf
.CHECK_C_PROTOTYPE('syscall',
73 'int syscall(int number, ...)',
74 define
='HAVE_SYSCALL_INT', headers
='unistd.h sys/syscall.h')
76 if (sys
.platform
.rfind('linux') > -1):
78 #if defined(HAVE_UNISTD_H)
83 #include <sys/types.h>
86 #ifdef HAVE_SYS_PRIV_H
93 #if defined(HAVE_SYSCALL_H)
97 #if defined(HAVE_SYS_SYSCALL_H)
98 #include <sys/syscall.h>
101 syscall(SYS_setresuid32, -1, -1, -1);
102 syscall(SYS_setresgid32, -1, -1, -1);
103 syscall(SYS_setreuid32, -1, -1);
104 syscall(SYS_setregid32, -1, -1);
105 syscall(SYS_setuid32, -1);
106 syscall(SYS_setgid32, -1);
107 syscall(SYS_setgroups32, 0, NULL);
109 'HAVE_LINUX_32BIT_SYSCALLS',
110 msg
="Checking whether Linux has 32-bit credential calls");
112 conf
.CHECK_FUNCS('getresuid getresgid')
114 # Create full path to uid_wrapper
115 blddir
= os
.path
.realpath(conf
.blddir
)
116 libuid_wrapper_so_path
= blddir
+ '/default/lib/uid_wrapper/libuid-wrapper.so'
118 conf
.DEFINE('LIBUID_WRAPPER_SO_PATH', libuid_wrapper_so_path
)
119 conf
.DEFINE('UID_WRAPPER', 1)
122 if not bld
.CONFIG_SET("USING_SYSTEM_UID_WRAPPER"):
123 # We need to do it this way or the library wont work.
124 # Using private_library=True will add symbol version which
126 bld
.SAMBA_LIBRARY('uid_wrapper',
127 source
='uid_wrapper.c',
130 realname
='libuid-wrapper.so')