summaryrefslogtreecommitdiff
path: root/source3/wscript
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-07-02 14:08:41 -0700
committerJeremy Allison <jra@samba.org>2012-07-03 05:32:21 +0200
commit3fe2c54a5b122acc1d96c0e01d802b4f4a4c84b4 (patch)
tree06b9da7937e5a8b1132756c99ce9809f8937f8b9 /source3/wscript
parentec9aae6251e7d6d1a073924b6e58908454001625 (diff)
downloadsamba-3fe2c54a5b122acc1d96c0e01d802b4f4a4c84b4.tar.gz
samba-3fe2c54a5b122acc1d96c0e01d802b4f4a4c84b4.tar.bz2
samba-3fe2c54a5b122acc1d96c0e01d802b4f4a4c84b4.zip
Fix the waf/autoconf builds to detect correctly the 32-bit or 64-bit syscall ABI on Linux.
Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Jul 3 05:32:21 CEST 2012 on sn-devel-104
Diffstat (limited to 'source3/wscript')
-rwxr-xr-xsource3/wscript77
1 files changed, 63 insertions, 14 deletions
diff --git a/source3/wscript b/source3/wscript
index e372fcc5ae..5fcf86ea18 100755
--- a/source3/wscript
+++ b/source3/wscript
@@ -728,22 +728,71 @@ int i; i = PAM_RADIO_TYPE;
conf.DEFINE('WITH_PAM', 1)
conf.DEFINE('WITH_PAM_MODULES', 1)
- seteuid = False
#
-# Disable for now until Linux-64 and Linux-32 specific versions
-# are separated out.
+# Ensure we select the correct set of system calls on Linux.
#
-# if not seteuid:
-# seteuid = conf.CHECK_CODE('''
-# #define AUTOCONF_TEST 1
-# #define USE_LINUX_THREAD_CREDENTIALS 1
-# #include "../lib/util/setid.c"
-# #include "./lib/util_sec.c"
-# ''',
-# 'USE_LINUX_THREAD_CREDENTIALS',
-# addmain=False,
-# execute=True,
-# msg="Checking whether we can use Linux thread-specific credentials")
+ if (host_os.rfind('linux') > -1):
+ conf.CHECK_CODE('''
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <errno.h>
+
+#ifdef HAVE_SYS_PRIV_H
+#include <sys/priv.h>
+#endif
+#ifdef HAVE_SYS_ID_H
+#include <sys/id.h>
+#endif
+
+#if defined(HAVE_SYSCALL_H)
+#include <syscall.h>
+#endif
+
+#if defined(HAVE_SYS_SYSCALL_H)
+#include <sys/syscall.h>
+#endif
+
+syscall(SYS_setresuid32, -1, -1, -1);
+syscall(SYS_setresgid32, -1, -1, -1);
+syscall(SYS_setreuid32, -1, -1);
+syscall(SYS_setregid32, -1, -1);
+syscall(SYS_setuid32, -1);
+syscall(SYS_setgid32, -1);
+syscall(SYS_setgroups32, 0, NULL);
+''',
+ 'USE_LINUX_32BIT_SYSCALLS',
+ msg="Checking whether Linux should use 32-bit credential calls");
+
+ seteuid = False
+
+ if not seteuid:
+ if (conf.CONFIG_SET('USE_LINUX_32BIT_SYSCALLS')):
+ seteuid = conf.CHECK_CODE('''
+ #define AUTOCONF_TEST 1
+ #define USE_LINUX_THREAD_CREDENTIALS 1
+ #define USE_LINUX_32BIT_SYSCALLS 1
+ #include "../lib/util/setid.c"
+ #include "./lib/util_sec.c"
+ ''',
+ 'USE_LINUX_THREAD_CREDENTIALS',
+ addmain=False,
+ execute=True,
+ msg="Checking whether we can use Linux thread-specific credentials with 32-bit system calls")
+ else:
+ seteuid = conf.CHECK_CODE('''
+ #define AUTOCONF_TEST 1
+ #define USE_LINUX_THREAD_CREDENTIALS 1
+ #include "../lib/util/setid.c"
+ #include "./lib/util_sec.c"
+ ''',
+ 'USE_LINUX_THREAD_CREDENTIALS',
+ addmain=False,
+ execute=True,
+ msg="Checking whether we can use Linux thread-specific credentials")
if not seteuid:
seteuid = conf.CHECK_CODE('''
#define AUTOCONF_TEST 1