41a6c3
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ldap/util_ldap.c?r1=1517388&r2=1517387&pathrev=1517388&view=patch
41a6c3
41a6c3
--- trunk/modules/ldap/util_ldap.c	2013/08/25 21:46:27	1517387
41a6c3
+++ trunk/modules/ldap/util_ldap.c	2013/08/25 22:42:29	1517388
41a6c3
@@ -60,6 +60,7 @@
41a6c3
 #endif
41a6c3
 
41a6c3
 #define AP_LDAP_HOPLIMIT_UNSET -1
41a6c3
+#define AP_LDAP_CHASEREFERRALS_SDKDEFAULT -1
41a6c3
 #define AP_LDAP_CHASEREFERRALS_OFF 0
41a6c3
 #define AP_LDAP_CHASEREFERRALS_ON 1
41a6c3
 
41a6c3
@@ -371,7 +372,7 @@
41a6c3
     ldap_option = ldc->deref;
41a6c3
     ldap_set_option(ldc->ldap, LDAP_OPT_DEREF, &ldap_option);
41a6c3
 
41a6c3
-    if (ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) {
41a6c3
+    if (ldc->ChaseReferrals != AP_LDAP_CHASEREFERRALS_SDKDEFAULT) {
41a6c3
         /* Set options for rebind and referrals. */
41a6c3
         ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, APLOGNO(01278)
41a6c3
                 "LDAP: Setting referrals to %s.",
41a6c3
@@ -391,7 +392,9 @@
41a6c3
             uldap_connection_unbind(ldc);
41a6c3
             return(result->rc);
41a6c3
         }
41a6c3
+    }
41a6c3
 
41a6c3
+    if (ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) {
41a6c3
         if ((ldc->ReferralHopLimit != AP_LDAP_HOPLIMIT_UNSET) && ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) {
41a6c3
             /* Referral hop limit - only if referrals are enabled and a hop limit is explicitly requested */
41a6c3
             ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, APLOGNO(01280)
41a6c3
@@ -2584,15 +2587,25 @@
41a6c3
 
41a6c3
 static const char *util_ldap_set_chase_referrals(cmd_parms *cmd,
41a6c3
                                                  void *config,
41a6c3
-                                                 int mode)
41a6c3
+                                                 const char *arg)
41a6c3
 {
41a6c3
     util_ldap_config_t *dc =  config;
41a6c3
 
41a6c3
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, cmd->server, APLOGNO(01311)
41a6c3
-                      "LDAP: Setting referral chasing %s",
41a6c3
-                      (mode == AP_LDAP_CHASEREFERRALS_ON) ? "ON" : "OFF");
41a6c3
+                      "LDAP: Setting referral chasing %s", arg);
41a6c3
 
41a6c3
-    dc->ChaseReferrals = mode;
41a6c3
+    if (0 == strcasecmp(arg, "on")) {
41a6c3
+        dc->ChaseReferrals = AP_LDAP_CHASEREFERRALS_ON;
41a6c3
+    }
41a6c3
+    else if (0 == strcasecmp(arg, "off")) {
41a6c3
+        dc->ChaseReferrals = AP_LDAP_CHASEREFERRALS_OFF;
41a6c3
+    }
41a6c3
+    else if (0 == strcasecmp(arg, "default")) {
41a6c3
+        dc->ChaseReferrals = AP_LDAP_CHASEREFERRALS_SDKDEFAULT;
41a6c3
+    }
41a6c3
+    else {
41a6c3
+        return "LDAPReferrals must be 'on', 'off', or 'default'";
41a6c3
+    }
41a6c3
 
41a6c3
     return(NULL);
41a6c3
 }
41a6c3
@@ -3116,9 +3129,9 @@
41a6c3
                   "Specify the LDAP socket connection timeout in seconds "
41a6c3
                   "(default: 10)"),
41a6c3
 
41a6c3
-    AP_INIT_FLAG("LDAPReferrals", util_ldap_set_chase_referrals,
41a6c3
+    AP_INIT_TAKE1("LDAPReferrals", util_ldap_set_chase_referrals,
41a6c3
                   NULL, OR_AUTHCFG,
41a6c3
-                  "Choose whether referrals are chased ['ON'|'OFF'].  Default 'ON'"),
41a6c3
+                  "Choose whether referrals are chased ['ON'|'OFF'|'DEFAULT'].  Default 'ON'"),
41a6c3
 
41a6c3
     AP_INIT_TAKE1("LDAPReferralHopLimit", util_ldap_set_referral_hop_limit,
41a6c3
                   NULL, OR_AUTHCFG,