Skip to content

Commit

Permalink
Merge pull request #334 from vroldanbet/ldap-open-connection-bug
Browse files Browse the repository at this point in the history
Net::LDAP#open does not cache bind result
  • Loading branch information
mtodd authored Nov 18, 2019
2 parents 585ec7a + c7d7d15 commit 8935eed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
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

0 comments on commit 8935eed

Please sign in to comment.