# File lib/active_ldap/connection.rb, line 241 def connection conn = @connection return conn if conn have_dn = !@dn.nil? if !have_dn and attribute_name_resolvable_without_connection? begin have_dn = !get_attribute_before_type_cast(dn_attribute)[1].nil? rescue DistinguishedNameInvalid end end conn = self.class.active_connections[dn] || retrieve_connection if have_dn conn || self.class.connection end