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