# File lib/activeldap/base.rb, line 400
    def Base.search(config={})
      Base.reconnect if Base.connection.nil? and Base.can_reconnect?

      config[:filter] = 'objectClass=*' unless config.has_key? :filter
      config[:attrs] = [] unless config.has_key? :attrs
      config[:scope] = LDAP::LDAP_SCOPE_SUBTREE unless config.has_key? :scope
      config[:base] = base() unless config.has_key? :base

      values = []
      config[:attrs] = config[:attrs].to_a # just in case

      result = Base.connection() do |conn|
        conn.search(config[:base], config[:scope], config[:filter], config[:attrs])  do |m|
          res = {}
          res['dn'] = [m.dn.dup] # For consistency with the below
          m.attrs.each do |attr|
            if config[:attrs].member? attr or config[:attrs].empty?
              res[attr] = m.vals(attr).dup
            end
          end
          values.push(res)
        end
      end
      if result.nil?
        # Do nothing on failure
        @@logger.debug "No matches for #{config[:filter]} and attrs #{config[:attrs]}"
      end
      return values
    end