On 06/16/2008 02:17 AM, Bojan Smojver wrote:
On Mon, 2008-06-16 at 10:07 +1000, Bojan Smojver wrote:
Nah, forget it - wrong and incomplete. Let me do a better one...
OK, for real this time :-)
PS. I don't have RHEL3 platform handy, so please compile and let me
know.
I checked it on Red Hat AS 3 and it basicly works, but the 'two argument'
function prototype is wrong. I adjusted your patch accordingly and now
it compiles fine without any warning on Solaris 8, 9, 10 (SPARC, 32BIT)
and RHEL3 32 Bit and RHEL4 64 Bit.
So I guess committing this patch and backporting it should close this issue.
Regards
RĂ¼diger
diff -ru apr-util-1.3.1.orig/build/apu-conf.m4 apr-util-1.3.1/build/apu-conf.m4
--- apr-util-1.3.1.orig/build/apu-conf.m4 2008-05-28 18:27:01.000000000 +0200
+++ apr-util-1.3.1/build/apu-conf.m4 2008-06-16 12:52:08.000000000 +0200
@@ -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)
--- apr-util-1.3.1.orig/include/private/apu_config.h.in 2008-06-15 04:28:50.000000000 +0200
+++ apr-util-1.3.1/include/private/apu_config.h.in 2008-06-16 13:12:02.000000000 +0200
@@ -114,6 +114,9 @@
/* Define if xml/xmlparse.h is available */
#undef HAVE_XML_XMLPARSE_H
+/* Define if ldap_set_rebind_proc takes three arguments */
+#undef LDAP_SET_REBIND_PROC_THREE
+
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
diff -ru apr-util-1.3.1.orig/ldap/apr_ldap_rebind.c apr-util-1.3.1/ldap/apr_ldap_rebind.c
--- apr-util-1.3.1.orig/ldap/apr_ldap_rebind.c 2008-06-11 22:00:10.000000000 +0200
+++ apr-util-1.3.1/ldap/apr_ldap_rebind.c 2008-06-16 13:44:42.000000000 +0200
@@ -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;
}