Avoid a race condition in glibc between AIO and setresuid().
[samba.git] / source3 / configure.in
index c7698590a92395f6be02d02796cca7371c8794e3..9436fed1fff196f5ede3faa6fdccd9b6921da50a 100644 (file)
@@ -2627,30 +2627,32 @@ AC_CHECK_FUNCS(getpagesize)
 ################################################
 # look for a method of setting the effective uid
 seteuid=no;
+
 if test $seteuid = no; then
-AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
+AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
 AC_TRY_RUN([
 #define AUTOCONF_TEST 1
-#define USE_SETRESUID 1
+#define USE_SETREUID 1
 #include "confdefs.h"
 #include "${srcdir-.}/lib/util_sec.c"],
-           samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
-if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
-    seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available])
+           samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
+if test x"$samba_cv_USE_SETREUID" = x"yes"; then
+    seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available])
 fi
 fi
 
-
+# we check for setresuid second as it conflicts with AIO on Linux. 
+# see http://samba.org/~tridge/junkcode/aio_uid.c
 if test $seteuid = no; then
-AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
+AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
 AC_TRY_RUN([
 #define AUTOCONF_TEST 1
-#define USE_SETREUID 1
+#define USE_SETRESUID 1
 #include "confdefs.h"
 #include "${srcdir-.}/lib/util_sec.c"],
-           samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
-if test x"$samba_cv_USE_SETREUID" = x"yes"; then
-    seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available])
+           samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
+if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
+    seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available])
 fi
 fi
 
@@ -4048,7 +4050,7 @@ INSTALL_CIFSUPCALL=""
 UNINSTALL_CIFSUPCALL=""
 AC_MSG_CHECKING(whether to build cifs.upcall)
 AC_ARG_WITH(cifsupcall,
-[AS_HELP_STRING([--with-cifsupcall], [Include cifs.upcall (Linux only) support (default=no)])],
+[AS_HELP_STRING([--with-cifsupcall], [Include cifs.upcall (Linux only) support (default=yes)])],
 [ case "$withval" in
   no)
        AC_MSG_RESULT(no)
@@ -4074,9 +4076,24 @@ AC_ARG_WITH(cifsupcall,
        esac
     ;;
   esac ],
-[
-  AC_MSG_RESULT(no)
-  ]
+[ case "$host_os" in
+  *linux*)
+       if test x"$use_ads" != x"yes"; then
+               AC_MSG_WARN(ADS support should be enabled for building cifs.upcall)
+       elif test x"$HAVE_KEYUTILS_H" != "x1"; then
+               AC_MSG_WARN(keyutils package is required for cifs.upcall)
+       else
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(WITH_CIFSUPCALL,1,[whether to build cifs.upcall])
+               CIFSUPCALL_PROGS="bin/cifs.upcall"
+               INSTALL_CIFSUPCALL="installcifsupcall"
+               UNINSTALL_CIFSUPCALL="uninstallcifsupcall"
+       fi
+       ;;
+  *)
+       AC_MSG_RESULT(no)
+       ;;
+  esac ]
 )
 
 
@@ -6149,6 +6166,7 @@ AC_OUTPUT(Makefile
          pkgconfig/wbclient.pc
          pkgconfig/netapi.pc
          pkgconfig/smbsharemodes.pc
+         ../examples/libsmbclient/Makefile.internal
          )
 
 #################################################