CVE-2016-2118: s3:rpc_server/{samr,lsa,netlogon}: reject DCERPC_AUTH_LEVEL_CONNECT...
[Samba.git] / lib / uid_wrapper / wscript
blob3b3d5bff98aa55871127f12cad10b87f7bd3bd13
1 #!/usr/bin/env python
3 import Options
4 import os
6 VERSION="1.1.0"
8 def configure(conf):
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'
12 else:
13 # check HAVE_GCC_ATOMIC_BUILTINS
14 conf.CHECK_CODE('''
15 #include <stdbool.h>
16 int main(void) {
17 bool x;
18 bool *p_x = &x;
19 __atomic_load(p_x, &x, __ATOMIC_RELAXED);
20 return 0;
21 ''',
22 'HAVE_GCC_ATOMIC_BUILTINS',
23 addmain=False,
24 msg='Checking for atomic builtins')
26 # check HAVE_GCC_THREAD_LOCAL_STORAGE
27 conf.CHECK_CODE('''
28 __thread int tls;
30 int main(void) {
31 return 0;
33 ''',
34 'HAVE_GCC_THREAD_LOCAL_STORAGE',
35 addmain=False,
36 msg='Checking for thread local storage')
38 # check HAVE_CONSTRUCTOR_ATTRIBUTE
39 conf.CHECK_CODE('''
40 void test_constructor_attribute(void) __attribute__ ((constructor));
42 void test_constructor_attribute(void)
44 return;
47 int main(void) {
48 return 0;
50 ''',
51 'HAVE_CONSTRUCTOR_ATTRIBUTE',
52 addmain=False,
53 msg='Checking for library constructor support')
55 # check HAVE_DESTRUCTOR_ATTRIBUTE
56 conf.CHECK_CODE('''
57 void test_destructor_attribute(void) __attribute__ ((destructor));
59 void test_destructor_attribute(void)
61 return;
64 int main(void) {
65 return 0;
67 ''',
68 'HAVE_DESTRUCTOR_ATTRIBUTE',
69 addmain=False,
70 msg='Checking for library destructor support')
72 if Options.options.address_sanitizer:
73 # check HAVE_ADDRESS_SANITIZER_ATTRIBUTE
74 conf.CHECK_CODE('''
75 void test_address_sanitizer_attribute(void) __attribute__((no_sanitize_address));
77 void test_address_sanitizer_attribute(void)
79 return;
82 int main(void) {
83 return 0;
85 ''',
86 'HAVE_ADDRESS_SANITIZER_ATTRIBUTE',
87 addmain=False,
88 cflags='-Wall -Wextra -Werror',
89 msg='Checking for address sanitizer attribute')
91 # check HAVE_FUNCTION_ATTRIBUTE_FORMAT
92 conf.CHECK_CODE('''
93 void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
95 int main(void) {
96 return 0;
98 ''',
99 'HAVE_FUNCTION_ATTRIBUTE_FORMAT',
100 addmain=False,
101 msg='Checking for printf format validation support')
102 # Prototype checks
103 conf.CHECK_C_PROTOTYPE('setgroups',
104 'int setgroups(int ngroups, const gid_t *grouplist)',
105 define='HAVE_SETGROUPS_INT', headers='unistd.h sys/types.h')
106 conf.CHECK_C_PROTOTYPE('syscall',
107 'int syscall(int number, ...)',
108 define='HAVE_SYSCALL_INT', headers='unistd.h sys/syscall.h')
110 conf.CHECK_FUNCS('getresuid getresgid')
112 # Create full path to uid_wrapper
113 srcdir = os.path.realpath(conf.srcdir)
114 libuid_wrapper_so_path = srcdir + '/bin/default/lib/uid_wrapper/libuid-wrapper.so'
116 conf.DEFINE('LIBUID_WRAPPER_SO_PATH', libuid_wrapper_so_path)
117 conf.DEFINE('UID_WRAPPER', 1)
119 def build(bld):
120 if not bld.CONFIG_SET("USING_SYSTEM_UID_WRAPPER"):
121 # We need to do it this way or the library wont work.
122 # Using private_library=True will add symbol version which
123 # breaks preloading!
124 bld.SAMBA_LIBRARY('uid_wrapper',
125 source='uid_wrapper.c',
126 cflags='-DNDEBUG',
127 deps='dl',
128 install=False,
129 realname='libuid-wrapper.so')