Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Net::LDAP#open does not cache bind result #334

Merged
merged 7 commits into from
Nov 18, 2019
Merged
2 changes: 1 addition & 1 deletion lib/net/ldap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ def open
begin
@open_connection = new_connection
payload[:connection] = @open_connection
payload[:bind] = @open_connection.bind(@auth)
payload[:bind] = @result = @open_connection.bind(@auth)
yield self
ensure
@open_connection.close if @open_connection
Expand Down
2 changes: 1 addition & 1 deletion lib/net/ldap/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Net
class LDAP
VERSION = "0.16.1"
VERSION = "0.16.2"
end
end
8 changes: 8 additions & 0 deletions test/integration/test_return_codes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
# See: section 12.12 http://www.openldap.org/doc/admin24/overlays.html

class TestReturnCodeIntegration < LDAPIntegrationTestCase
def test_open_error
@ldap.authenticate "cn=fake", "creds"
@ldap.open do
result = @ldap.get_operation_result
assert_equal Net::LDAP::ResultCodeInvalidCredentials, result.code
end
end

def test_operations_error
refute @ldap.search(filter: "cn=operationsError", base: "ou=Retcodes,dc=example,dc=org")
assert result = @ldap.get_operation_result
Expand Down