diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2008-01-27 11:22:30 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2008-01-27 11:22:30 +0100 |
commit | 6ded4e5bdf476a93654ebe6c79263bfb99e178bf (patch) | |
tree | fd6e08ae0dc81ad7aeecf4c31a59a7fb5e7d33e9 | |
parent | 3b9a570bc809eba1e9ce6af60454dbc53fe64328 (diff) |
work around some LDAP libraries not having all options
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@573 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | nslcd/myldap.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/nslcd/myldap.c b/nslcd/myldap.c index 8544bb8..aa91fe7 100644 --- a/nslcd/myldap.c +++ b/nslcd/myldap.c @@ -72,6 +72,11 @@ #include "compat/ldap.h" #include "common/dict.h" +/* compatibility */ +#ifndef LDAP_CONST +#define LDAP_CONST constructor +#endif /* not LDAP_CONST */ + /* the maximum number of searches per session */ #define MAX_SEARCHES_IN_SESSION 4 @@ -396,13 +401,17 @@ static int do_set_options(MYLDAP_SESSION *session) /* turn on debugging */ if (nslcd_cfg->ldc_debug) { +#ifdef LBER_OPT_DEBUG_LEVEL rc=ber_set_option(NULL,LBER_OPT_DEBUG_LEVEL,&nslcd_cfg->ldc_debug); if (rc!=LDAP_SUCCESS) { log_log(LOG_ERR,"ber_set_option(LBER_OPT_DEBUG_LEVEL) failed: %s",ldap_err2string(rc)); return rc; } +#endif /* LBER_OPT_DEBUG_LEVEL */ +#ifdef LDAP_OPT_DEBUG_LEVEL LDAP_SET_OPTION(NULL,LDAP_OPT_DEBUG_LEVEL,&nslcd_cfg->ldc_debug); +#endif /* LDAP_OPT_DEBUG_LEVEL */ } /* the rebind function that is called when chasing referrals, see http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/apis/ldap_set_rebind_proc.htm @@ -421,8 +430,12 @@ static int do_set_options(MYLDAP_SESSION *session) LDAP_SET_OPTION(session->ld,LDAP_OPT_TIMELIMIT,&nslcd_cfg->ldc_timelimit); tv.tv_sec=nslcd_cfg->ldc_bind_timelimit; tv.tv_usec=0; +#ifdef LDAP_OPT_TIMEOUT LDAP_SET_OPTION(session->ld,LDAP_OPT_TIMEOUT,&tv); +#endif /* LDAP_OPT_TIMEOUT */ +#ifdef LDAP_OPT_NETWORK_TIMEOUT LDAP_SET_OPTION(session->ld,LDAP_OPT_NETWORK_TIMEOUT,&tv); +#endif /* LDAP_OPT_NETWORK_TIMEOUT */ LDAP_SET_OPTION(session->ld,LDAP_OPT_REFERRALS,nslcd_cfg->ldc_referrals?LDAP_OPT_ON:LDAP_OPT_OFF); LDAP_SET_OPTION(session->ld,LDAP_OPT_RESTART,nslcd_cfg->ldc_restart?LDAP_OPT_ON:LDAP_OPT_OFF); /* if SSL is desired, then enable it */ |