From a4819e525f29d83357a298065df06acf5903b1af Mon Sep 17 00:00:00 2001 From: Daniel Abrahamsson Date: Thu, 22 Sep 2011 15:55:40 +0200 Subject: [PATCH] Fix incorrect return value from search when :return_result => true and and search fails --- lib/net/ldap.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/net/ldap.rb b/lib/net/ldap.rb index b0105fc..4d9f047 100644 --- a/lib/net/ldap.rb +++ b/lib/net/ldap.rb @@ -619,7 +619,7 @@ class Net::LDAP end args[:base] ||= @base - result_set = (args and args[:return_result] == false) ? nil : [] + result_set = args[:return_result] == false ? nil : [] if @open_connection @result = @open_connection.search(args) { |entry| @@ -642,7 +642,11 @@ class Net::LDAP end end - result_set || @result == 0 + if args[:return_result] + @result == 0 ? result_set : nil + else + @result == 0 + end end # #bind connects to an LDAP server and requests authentication based on