# File lib/net/ldap.rb, line 567 def open # First we make a connection and then a binding, but we don't do # anything with the bind results. We then pass self to the caller's # block, where he will execute his LDAP operations. Of course they will # all generate auth failures if the bind was unsuccessful. raise Net::LDAP::LdapError, "Open already in progress" if @open_connection begin @open_connection = Net::LDAP::Connection.new(:host => @host, :port => @port, :encryption => @encryption) @open_connection.bind(@auth) yield self ensure @open_connection.close if @open_connection @open_connection = nil end end