Skip to content

Commit 8935eed

Browse files
authored
Merge pull request #334 from vroldanbet/ldap-open-connection-bug
Net::LDAP#open does not cache bind result
2 parents 585ec7a + c7d7d15 commit 8935eed

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

lib/net/ldap.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ def open
712712
begin
713713
@open_connection = new_connection
714714
payload[:connection] = @open_connection
715-
payload[:bind] = @open_connection.bind(@auth)
715+
payload[:bind] = @result = @open_connection.bind(@auth)
716716
yield self
717717
ensure
718718
@open_connection.close if @open_connection

lib/net/ldap/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Net
22
class LDAP
3-
VERSION = "0.16.1"
3+
VERSION = "0.16.2"
44
end
55
end

test/integration/test_return_codes.rb

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
# See: section 12.12 http://www.openldap.org/doc/admin24/overlays.html
55

66
class TestReturnCodeIntegration < LDAPIntegrationTestCase
7+
def test_open_error
8+
@ldap.authenticate "cn=fake", "creds"
9+
@ldap.open do
10+
result = @ldap.get_operation_result
11+
assert_equal Net::LDAP::ResultCodeInvalidCredentials, result.code
12+
end
13+
end
14+
715
def test_operations_error
816
refute @ldap.search(filter: "cn=operationsError", base: "ou=Retcodes,dc=example,dc=org")
917
assert result = @ldap.get_operation_result

0 commit comments

Comments
 (0)