Added a preliminary implementation of Net::LDAP#bind_as.

This commit is contained in:
blackhedd 2006-08-12 14:54:25 +00:00
parent ad24ad979d
commit e2bf4dc172

View file

@ -692,9 +692,9 @@ module Net
# on it. Otherwise, connect, bind, and disconnect. # on it. Otherwise, connect, bind, and disconnect.
# The latter operation is obviously useful only as an auth check. # The latter operation is obviously useful only as an auth check.
# #
def bind def bind auth=@auth
if @open_connection if @open_connection
@result = @open_connection.bind @auth @result = @open_connection.bind auth
else else
conn = Connection.new( :host => @host, :port => @port , :encryption => @encryption) conn = Connection.new( :host => @host, :port => @port , :encryption => @encryption)
@result = conn.bind @auth @result = conn.bind @auth
@ -715,7 +715,15 @@ module Net
# #
# <i>This method is currently an unimplemented stub.</i> # <i>This method is currently an unimplemented stub.</i>
# #
def bind_as def bind_as args={}
result = false
open {|me|
rs = search args
if rs and rs.first and dn = rs.first.dn
result = bind :method => :simple, :username => dn, :password => args[:password]
end
}
result
end end
# Adds a new entry to the remote LDAP server. # Adds a new entry to the remote LDAP server.