You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bo...@apache.org on 2008/06/16 23:34:50 UTC

svn commit: r668323 - in /apr/apr-util/branches/1.3.x: build/apu-conf.m4 ldap/apr_ldap_rebind.c

Author: bojan
Date: Mon Jun 16 14:34:50 2008
New Revision: 668323

URL: http://svn.apache.org/viewvc?rev=668323&view=rev
Log:
Backport r668322 from the trunk.
Older OpenLDAP implementations may have ldap_set_rebind_proc() with two args.
Patch by rpluem.

Modified:
    apr/apr-util/branches/1.3.x/build/apu-conf.m4
    apr/apr-util/branches/1.3.x/ldap/apr_ldap_rebind.c

Modified: apr/apr-util/branches/1.3.x/build/apu-conf.m4
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.3.x/build/apu-conf.m4?rev=668323&r1=668322&r2=668323&view=diff
==============================================================================
--- apr/apr-util/branches/1.3.x/build/apu-conf.m4 (original)
+++ apr/apr-util/branches/1.3.x/build/apu-conf.m4 Mon Jun 16 14:34:50 2008
@@ -356,6 +356,26 @@
     LIBS=$save_libs
   ])
 
+if test "$apu_has_ldap_openldap" = "1"; then
+    AC_CACHE_CHECK([style of ldap_set_rebind_proc routine], ac_cv_ldap_set_rebind_proc_style,
+    APR_TRY_COMPILE_NO_WARNING([
+    #ifdef HAVE_LBER_H
+    #include <lber.h>
+    #endif
+    #ifdef HAVE_LDAP_H
+    #include <ldap.h>
+    #endif
+    ], [
+    int tmp = ldap_set_rebind_proc((LDAP *)0, (LDAP_REBIND_PROC *)0, (void *)0);
+    /* use tmp to suppress the warning */
+    tmp=0;
+    ], ac_cv_ldap_set_rebind_proc_style=three, ac_cv_ldap_set_rebind_proc_style=two))
+
+    if test "$ac_cv_ldap_set_rebind_proc_style" = "three"; then
+        AC_DEFINE(LDAP_SET_REBIND_PROC_THREE, 1, [Define if ldap_set_rebind_proc takes three arguments])
+    fi
+fi
+
 AC_SUBST(ldap_h)
 AC_SUBST(lber_h)
 AC_SUBST(ldap_ssl_h)

Modified: apr/apr-util/branches/1.3.x/ldap/apr_ldap_rebind.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.3.x/ldap/apr_ldap_rebind.c?rev=668323&r1=668322&r2=668323&view=diff
==============================================================================
--- apr/apr-util/branches/1.3.x/ldap/apr_ldap_rebind.c (original)
+++ apr/apr-util/branches/1.3.x/ldap/apr_ldap_rebind.c Mon Jun 16 14:34:50 2008
@@ -267,8 +267,21 @@
  *     request  Unused in this routine
  *     msgid    Unused in this routine
  *     params   Unused in this routine
+ *
+ *     or
+ *
+ *     ld       Pointer to an LDAP control structure. (input only)
+ *     url      Unused in this routine
+ *     request  Unused in this routine
+ *     msgid    Unused in this routine
  */
-static int LDAP_rebindproc(LDAP *ld, LDAP_CONST char *url, ber_tag_t request, ber_int_t msgid, void *params)
+#if defined(LDAP_SET_REBIND_PROC_THREE)
+static int LDAP_rebindproc(LDAP *ld, LDAP_CONST char *url, ber_tag_t request,
+                           ber_int_t msgid, void *params)
+#else
+static int LDAP_rebindproc(LDAP *ld, LDAP_CONST char *url, int request,
+                           ber_int_t msgid)
+#endif
 {
     apr_ldap_rebind_entry_t *my_conn;
     const char *bindDN = NULL;
@@ -286,7 +299,11 @@
 
 static int apr_ldap_rebind_set_callback(LDAP *ld)
 {
+#if defined(LDAP_SET_REBIND_PROC_THREE)
     ldap_set_rebind_proc(ld, LDAP_rebindproc, NULL);
+#else
+    ldap_set_rebind_proc(ld, LDAP_rebindproc);
+#endif
     return APR_SUCCESS;
 }