always=LDAP_DEREF_ALWAYS
} deref_options;
+#define AP_LDAP_DEFAULT_HOPLIMIT 5 /* make sure these two stay */
+#define AP_LDAP_DEFAULT_HOPLIMIT_STR "5" /* in synch with each other! */
+#define AP_LDAP_CHASEREFERRALS_OFF 0
+#define AP_LDAP_CHASEREFERRALS_ON 1
+
/* Structure representing an LDAP connection */
typedef struct util_ldap_connection_t {
LDAP *ldap;
apr_array_header_t *client_certs; /* Client certificates on this connection */
const char *reason; /* Reason for an error failure */
- int ChaseReferrals; /* [on|off] (on=1, off=0, default = On)*/
- int ReferralHopLimit; /* # of referral hops to follow (default = 5) */
struct util_ldap_connection_t *next;
struct util_ldap_state_t *st; /* The LDAP vhost config this connection belongs to */
int keep; /* Will this connection be kept when it's unlocked */
+
+ int ChaseReferrals; /* [on|off] (default = AP_LDAP_CHASEREFERRALS_ON)*/
+ int ReferralHopLimit; /* # of referral hops to follow (default = AP_LDAP_DEFAULT_HOPLIMIT) */
} util_ldap_connection_t;
typedef struct util_ldap_config_t {
/* Set options for rebind and referrals. */
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"LDAP: Setting referrals to %s.",
- (ldc->ChaseReferrals ? "On" : "Off"));
+ ((ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) ? "On" : "Off"));
apr_ldap_set_option(r->pool, ldc->ldap,
APR_LDAP_OPT_REFERRALS,
- (void *)(ldc->ChaseReferrals ? LDAP_OPT_ON : LDAP_OPT_OFF),
+ (void *)((ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) ?
+ LDAP_OPT_ON : LDAP_OPT_OFF),
&(result));
if (result->rc != LDAP_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"Unable to set LDAP_OPT_REFERRALS option to %s: %d.",
- (ldc->ChaseReferrals ? "On" : "Off"),
+ ((ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) ? "On" : "Off"),
result->rc);
result->reason = "Unable to set LDAP_OPT_REFERRALS.";
uldap_connection_unbind(ldc);
return(result->rc);
}
- if (ldc->ChaseReferrals) {
+ if (ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) {
/* Referral hop limit - only if referrals are enabled */
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"Setting referral hop limit to %d.",
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, cmd->server,
"LDAP: Setting refferal chasing %s",
- mode?"ON":"OFF");
+ (mode == AP_LDAP_CHASEREFERRALS_ON) ? "ON" : "OFF");
dc->ChaseReferrals = mode;
util_ldap_config_t *dc =
(util_ldap_config_t *) apr_pcalloc(p,sizeof(util_ldap_config_t));
- dc->ChaseReferrals = 1; /* default is to turn referral chasing on. */
- dc->ReferralHopLimit = 5; /* default is to chase a max of 5 hops. */
+ /* defaults are AP_LDAP_CHASEREFERRALS_ON and AP_LDAP_DEFAULT_HOPLIMIT */
+ dc->ChaseReferrals = AP_LDAP_CHASEREFERRALS_ON;
+ dc->ReferralHopLimit = AP_LDAP_DEFAULT_HOPLIMIT;
return dc;
}
AP_INIT_TAKE1("LDAPReferralHopLimit", util_ldap_set_referral_hop_limit,
NULL, OR_AUTHCFG,
"Limit the number of referral hops that LDAP can follow. "
- "(Integer value, default=5)"),
+ "(Integer value, default=" AP_LDAP_DEFAULT_HOPLIMIT_STR ")"),
{NULL}
};