lib/active_ldap/adapter/base.rb in activeldap-3.2.3 vs lib/active_ldap/adapter/base.rb in activeldap-4.0.0

- old
+ new

@@ -334,11 +334,11 @@ end def sasl_bind(bind_dn, options={}) # Get all SASL mechanisms mechanisms = operation(options) do - root_dse_values("supportedSASLMechanisms") + root_dse_values("supportedSASLMechanisms", options) end if options.has_key?(:sasl_quiet) sasl_quiet = options[:sasl_quiet] else @@ -577,13 +577,14 @@ # Reset the attempts if this was forced. options[:reconnect_attempts] = 0 if force options[:reconnect_attempts] += 1 if retry_limit >= 0 begin + options[:try_reconnect] = false connect(options) break - rescue AuthenticationError + rescue AuthenticationError, Timeout::Error raise rescue => detail @logger.error do _("Reconnect to server failed: %s\n" \ "Reconnect to server failed backtrace:\n" \ @@ -631,13 +632,20 @@ [] end def root_dse(attrs, options={}) found_attributes = nil + if options.has_key?(:try_reconnect) + try_reconnect = options[:try_reconnect] + else + try_reconnect = true + end + search(:base => "", :scope => :base, :attributes => attrs, - :limit => 1) do |dn, attributes| + :limit => 1, + :try_reconnect => try_reconnect) do |dn, attributes| found_attributes = attributes end found_attributes end