FR 2.1.6 doesnt build under RHEL3

Alan Buxey A.L.M.Buxey at lboro.ac.uk
Mon Aug 24 15:18:26 CEST 2009


hi,

okay - looking further into this...

LDAP headers etc changed a while back for some new functionality


RHEL3 

/usr/include/ldap.h

LDAP_F( int )
ldap_set_rebind_proc LDAP_P((
        LDAP *ld,
        LDAP_REBIND_PROC *ldap_proc));


random other box (but newer distro :) )


LDAP_F( int )
ldap_set_rebind_proc LDAP_P((
        LDAP *ld,
        LDAP_REBIND_PROC *rebind_proc,
        void *params ));


the FR code has been updated to use the new rebind argument....but this
will fail on older systems.

now, theres some autoconfig magic available to check for this...eg


checking for ldap_set_rebind_proc... no
checking whether ldap_set_rebind_proc takes 3 arguments... 3


looking at eg samba/pam_ldap and various other tools that use LDAP, this seems to
be the required autoconf magic

        AC_CHECK_FUNCS(ldap_set_rebind_proc)
        AC_CACHE_CHECK(whether ldap_set_rebind_proc takes 3 arguments, $ac_cv_ldap_set_rebind_proc, [
        AC_TRY_COMPILE([
        #include <lber.h>
        #include <ldap.h>], [ldap_set_rebind_proc(0, 0, 0);], [$ac_cv_ldap_set_rebind_proc=3], [$ac_cv_ldap_set_rebind_proc=2]) ])
        AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $ac_cv_ldap_set_rebind_proc)


I'm afraid at this point I can go no further than this...because my autoconf foo isnt that
good at all....and when i tried putting this stuff into the rlm_ldap/configure.in I found
that that file seems to be horrible broken in many other places (autoconf just breaks!)
and my foo really is weak (and I cannot test all the ldap requirements either).

anyway......I've fixed the code to compile on RHEL3 by making my own local wrapper code
because autoconfigure doesnt (right now :-) )

nasty...but appears to work:


--- freeradius-server/src/modules/rlm_ldap/rlm_ldap.c   2009-08-24 11:32:29.000000000 +0100
+++ freeradius-server-edit/src/modules/rlm_ldap/rlm_ldap.c      2009-08-24 14:13:19.000000000 +0100
@@ -98,6 +98,11 @@
 #define REQUEST_REJECTED   2
 #define MAX_CHALLENGE_LEN  128

+#define LDAP_SET_REBIND_PROC_ARGS 2
+/* for new LDAP libraries, we want this one instead */
+/* #define LDAP_SET_REBIND_PROC_ARGS 3 */
+
+
 int radLdapXtnNMASAuth( LDAP *, char *, char *, char *, char *, size_t *, char *, int * );

 #endif
@@ -2218,11 +2223,19 @@
                if (inst->chase_referrals) {
                        rc=ldap_set_option(ld, LDAP_OPT_REFERRALS,
                                           LDAP_OPT_ON);
-
+
+#if LDAP_SET_REBIND_PROC_ARGS == 3
                        if (inst->rebind == 1) {
                                ldap_set_rebind_proc(ld, ldap_rebind,
                                                     inst);
                        }
+#elif LDAP_SET_REBIND_PROC_ARGS == 2
+                        if (inst->rebind == 1) {
+                                ldap_set_rebind_proc(ld,
+                                                     inst);
+                        }
+#endif
+
                } else {
                        rc=ldap_set_option(ld, LDAP_OPT_REFERRALS,
                                           LDAP_OPT_OFF);


alan



More information about the Freeradius-Devel mailing list