Skip to content

Commit faed957

Browse files
author
blackhedd
committed
Changed version to 4.
Changed Net::LDAP#bind_as returns a result set now.
1 parent e2bf4dc commit faed957

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/net/ldap.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ class LDAP
263263

264264
class LdapError < Exception; end
265265

266-
VERSION = "0.0.3"
266+
VERSION = "0.0.4"
267267

268268

269269
SearchScope_BaseObject = 0
@@ -720,12 +720,15 @@ def bind_as args={}
720720
open {|me|
721721
rs = search args
722722
if rs and rs.first and dn = rs.first.dn
723-
result = bind :method => :simple, :username => dn, :password => args[:password]
723+
password = args[:password]
724+
password = password.call if password.respond_to?(:call)
725+
result = rs if bind :method => :simple, :username => dn, :password => password
724726
end
725727
}
726728
result
727729
end
728730

731+
729732
# Adds a new entry to the remote LDAP server.
730733
# Supported arguments:
731734
# :dn :: Full DN of the new entry
@@ -1086,6 +1089,7 @@ def bind auth
10861089
#
10871090
def search args = {}
10881091
search_filter = (args && args[:filter]) || Filter.eq( "objectclass", "*" )
1092+
#search_filter = Filter.construct(search_filter) if search_filter.is_a?(String)
10891093
search_base = (args && args[:base]) || "dc=example,dc=com"
10901094
search_attributes = ((args && args[:attributes]) || []).map {|attr| attr.to_s.to_ber}
10911095
return_referrals = args && args[:return_referrals] == true

0 commit comments

Comments
 (0)