altarch-user / rpms / httpd

Forked from rpms/httpd 2 years ago
Clone

Blame SOURCES/httpd-2.4.6-ldaprefer.patch

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