Changed version to 4.

Changed Net::LDAP#bind_as returns a result set now.
This commit is contained in:
blackhedd 2006-08-15 08:33:18 +00:00
parent e2bf4dc172
commit faed957164

View file

@ -263,7 +263,7 @@ module Net
class LdapError < Exception; end class LdapError < Exception; end
VERSION = "0.0.3" VERSION = "0.0.4"
SearchScope_BaseObject = 0 SearchScope_BaseObject = 0
@ -720,12 +720,15 @@ module Net
open {|me| open {|me|
rs = search args rs = search args
if rs and rs.first and dn = rs.first.dn if rs and rs.first and dn = rs.first.dn
result = bind :method => :simple, :username => dn, :password => args[:password] password = args[:password]
password = password.call if password.respond_to?(:call)
result = rs if bind :method => :simple, :username => dn, :password => password
end end
} }
result result
end end
# Adds a new entry to the remote LDAP server. # Adds a new entry to the remote LDAP server.
# Supported arguments: # Supported arguments:
# :dn :: Full DN of the new entry # :dn :: Full DN of the new entry
@ -1086,6 +1089,7 @@ module Net
# #
def search args = {} def search args = {}
search_filter = (args && args[:filter]) || Filter.eq( "objectclass", "*" ) search_filter = (args && args[:filter]) || Filter.eq( "objectclass", "*" )
#search_filter = Filter.construct(search_filter) if search_filter.is_a?(String)
search_base = (args && args[:base]) || "dc=example,dc=com" search_base = (args && args[:base]) || "dc=example,dc=com"
search_attributes = ((args && args[:attributes]) || []).map {|attr| attr.to_s.to_ber} search_attributes = ((args && args[:attributes]) || []).map {|attr| attr.to_s.to_ber}
return_referrals = args && args[:return_referrals] == true return_referrals = args && args[:return_referrals] == true