From e2bf4dc172a52263a0eda3f38985fea941548582 Mon Sep 17 00:00:00 2001 From: blackhedd Date: Sat, 12 Aug 2006 14:54:25 +0000 Subject: [PATCH] Added a preliminary implementation of Net::LDAP#bind_as. --- lib/net/ldap.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/net/ldap.rb b/lib/net/ldap.rb index e0214a3..b052821 100644 --- a/lib/net/ldap.rb +++ b/lib/net/ldap.rb @@ -692,9 +692,9 @@ module Net # on it. Otherwise, connect, bind, and disconnect. # The latter operation is obviously useful only as an auth check. # - def bind + def bind auth=@auth if @open_connection - @result = @open_connection.bind @auth + @result = @open_connection.bind auth else conn = Connection.new( :host => @host, :port => @port , :encryption => @encryption) @result = conn.bind @auth @@ -715,7 +715,15 @@ module Net # # This method is currently an unimplemented stub. # - 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 # Adds a new entry to the remote LDAP server.