BUG 3196: patch from Alex Deiter <tiamat@komi.mts.ru> to compile against the Sun...
authorjerry <jerry@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Tue, 22 Nov 2005 17:15:28 +0000 (17:15 +0000)
committerjerry <jerry@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Tue, 22 Nov 2005 17:15:28 +0000 (17:15 +0000)
git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_3_0@11863 0c0555d6-39d7-0310-84fc-f1cc0bd64818

source/configure.in
source/include/includes.h
source/libads/ldap.c
source/passdb/pdb_nds.c

index f31f26f07b57a206a85f5f1ca0189aa33583ea3f..296673e4b533ba145e8f30c6dea44969e81a516a 100644 (file)
@@ -2796,8 +2796,6 @@ if test x"$with_ldap_support" != x"no"; then
   # now see if we can find the ldap libs in standard paths
   AC_CHECK_LIB_EXT(ldap, LDAP_LIBS, ldap_init)
 
-  AC_CHECK_FUNC_EXT(ldap_domain2hostlist,$LDAP_LIBS)
-  
   ########################################################
   # If we have LDAP, does it's rebind procedure take 2 or 3 arguments?
   # Check found in pam_ldap 145.
@@ -2816,9 +2814,7 @@ if test x"$with_ldap_support" != x"no"; then
   
   AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $smb_ldap_cv_ldap_set_rebind_proc, [Number of arguments to ldap_set_rebind_proc])
 
-  AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS)        
-  
-  if test x"$ac_cv_lib_ext_ldap_ldap_init" = x"yes" -a x"$ac_cv_func_ext_ldap_domain2hostlist" = x"yes"; then
+  if test x"$ac_cv_lib_ext_ldap_ldap_init" = x"yes"; then
     AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available])
     CPPFLAGS="$CPPFLAGS -DLDAP_DEPRECATED"
     default_static_modules="$default_static_modules pdb_ldap idmap_ldap";
@@ -2870,6 +2866,36 @@ if test x"$with_ldap_support" != x"yes"; then
     with_ads_support=no
 fi
 
+AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS)
+
+if test x"$ac_cv_func_ext_ldap_initialize" != x"yes"; then
+    if test x"$with_ads_support" = x"yes"; then
+        AC_MSG_ERROR(Active Directory Support requires ldap_initialize)
+    fi
+    AC_MSG_WARN(Active Directory Support requires ldap_initialize)
+    with_ads_support=no
+fi
+
+AC_CHECK_FUNC_EXT(ldap_domain2hostlist,$LDAP_LIBS)
+
+if test x"$ac_cv_func_ext_ldap_domain2hostlist" != x"yes"; then
+    if test x"$with_ads_support" = x"yes"; then
+        AC_MSG_ERROR(Active Directory Support requires ldap_domain2hostlist)
+    fi
+    AC_MSG_WARN(Active Directory Support requires ldap_domain2hostlist)
+    with_ads_support=no
+fi
+
+AC_CHECK_FUNC_EXT(ldap_add_result_entry,$LDAP_LIBS)
+
+if test x"$ac_cv_func_ext_ldap_add_result_entry" != x"yes"; then
+    if test x"$with_ads_support" = x"yes"; then
+        AC_MSG_ERROR(Active Directory Support requires ldap_add_result_entry)
+    fi
+    AC_MSG_WARN(Active Directory Support requires ldap_add_result_entry)
+    with_ads_support=no
+fi
+
 if test x"$with_ads_support" != x"no"; then
 
   # Do no harm to the values of CFLAGS and LIBS while testing for
index 626124523e5bf68330a982e1c41e2f448d249243..cde199eed8bd6677b11e7b16a9d73f02434ac8e8 100644 (file)
 
 #if HAVE_LBER_H
 #include <lber.h>
+#ifndef LBER_USE_DER
+#define LBER_USE_DER 0x01
+#endif
 #endif
 
 #if HAVE_LDAP_H
 #include <ldap.h>
+#ifndef LDAP_CONST
+#define LDAP_CONST const
+#endif
+#ifndef LDAP_OPT_SUCCESS
+#define LDAP_OPT_SUCCESS 0
+#endif
 #else
 #undef HAVE_LDAP
 #endif
index bf402b3499e27dafc3d74948579eb141e1bf5b07..6d1ca24537823804d026e6aff74fbfbc689de9a9 100644 (file)
@@ -577,8 +577,10 @@ ADS_STATUS ads_do_search_all(ADS_STRUCT *ads, const char *bind_path,
        status = ads_do_paged_search(ads, bind_path, scope, expr, attrs, res,
                                     &count, &cookie);
 
-       if (!ADS_ERR_OK(status)) return status;
+       if (!ADS_ERR_OK(status)) 
+               return status;
 
+#ifdef HAVE_LDAP_ADD_RESULT_ENTRY
        while (cookie) {
                void *res2 = NULL;
                ADS_STATUS status2;
@@ -598,6 +600,10 @@ ADS_STATUS ads_do_search_all(ADS_STRUCT *ads, const char *bind_path,
                /* note that we do not free res2, as the memory is now
                    part of the main returned list */
        }
+#else
+       DEBUG(0, ("no ldap_add_result_entry() support in LDAP libs!\n"));
+       status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
+#endif
 
        return status;
 }
index 5de80a827fa0f7f99c92214757d4067e9f0dae3b..138558308670e6c2a094d321acdfd4fe1a3ae93e 100644 (file)
@@ -846,12 +846,17 @@ static NTSTATUS pdb_nds_update_login_attempts(struct pdb_methods *methods,
 
                        /* Turn on ssl if required */
                        if(strequal(protocol, "ldaps")) {
+#ifdef LDAP_OPT_X_TLS
                                int tls = LDAP_OPT_X_TLS_HARD;
                                if (ldap_set_option (ld, LDAP_OPT_X_TLS, &tls) != LDAP_SUCCESS) {
                                        DEBUG(1, ("pdb_nds_update_login_attempts: Failed to setup a TLS session\n"));
                                } else {
                                        DEBUG(4, ("pdb_nds_update_login_attempts: Activated TLS on session\n"));
                                }
+#else
+                               DEBUG(0,("pdb_nds_update_login_attempts: Secure connection not supported by LDAP client libraries!\n"));
+                               return NT_STATUS_INVALID_PARAMETER;
+#endif
                        }
                }