waf: Check for Linux has 32-bit credential calls
authorAndreas Schneider <asn@samba.org>
Fri, 14 Aug 2015 08:59:05 +0000 (10:59 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 14 Aug 2015 16:04:53 +0000 (18:04 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Aug 14 18:04:53 CEST 2015 on sn-devel-104

lib/uid_wrapper/wscript

index 3b3d5bff98aa55871127f12cad10b87f7bd3bd13..b5b1f7a57d39c1dc266b2306c5afff19247a68e7 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 import Options
-import os
+import os, sys
 
 VERSION="1.1.0"
 
@@ -107,6 +107,42 @@ def configure(conf):
                        'int syscall(int number, ...)',
                        define='HAVE_SYSCALL_INT', headers='unistd.h sys/syscall.h')
 
+        if (sys.platform.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);
+''',
+                'HAVE_LINUX_32BIT_SYSCALLS',
+                msg="Checking whether Linux has 32-bit credential calls");
+
         conf.CHECK_FUNCS('getresuid getresgid')
 
         # Create full path to uid_wrapper