Fix incorrect return value from search when :return_result => true and and search fails

This commit is contained in:
Daniel Abrahamsson 2011-09-22 15:55:40 +02:00
parent 42bdeb93d8
commit a4819e525f

View file

@ -619,7 +619,7 @@ class Net::LDAP
end end
args[:base] ||= @base args[:base] ||= @base
result_set = (args and args[:return_result] == false) ? nil : [] result_set = args[:return_result] == false ? nil : []
if @open_connection if @open_connection
@result = @open_connection.search(args) { |entry| @result = @open_connection.search(args) { |entry|
@ -642,7 +642,11 @@ class Net::LDAP
end end
end end
result_set || @result == 0 if args[:return_result]
@result == 0 ? result_set : nil
else
@result == 0
end
end end
# #bind connects to an LDAP server and requests authentication based on # #bind connects to an LDAP server and requests authentication based on