Fixed bug #1088: Changed LDAP entry check to support Novell eDirectory.
This commit is contained in:
parent
79a4f2972a
commit
c5d3052e39
1 changed files with 6 additions and 6 deletions
12
lib/ldap.rb
12
lib/ldap.rb
|
@ -75,8 +75,6 @@ class Ldap
|
|||
attributes: attributes,
|
||||
return_result: false, # improves performance
|
||||
) do |entry|
|
||||
# needed for the #entries? method -> returns nil on break
|
||||
break if !block_given?
|
||||
yield entry
|
||||
end
|
||||
end
|
||||
|
@ -91,10 +89,12 @@ class Ldap
|
|||
#
|
||||
# @return [Boolean] Returns true if entries are present false if not.
|
||||
def entries?(*args)
|
||||
# since #search returns nil if entries are found (due to the break in the yield block)
|
||||
# and returns true otherwise we have to invert the result which matches the
|
||||
# expected result of a ...? method and suites our needs since it checks one entry max.
|
||||
!search(*args)
|
||||
found = false
|
||||
search(*args) do |_entry|
|
||||
found = true
|
||||
break
|
||||
end
|
||||
found
|
||||
end
|
||||
|
||||
# Counts the entries for the given search criteria.
|
||||
|
|
Loading…
Reference in a new issue