altarch-user / rpms / httpd

Forked from rpms/httpd 2 years ago
Clone

Blame SOURCES/httpd-2.4.6-ldaprefer.patch

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