diff --git a/.gitignore b/.gitignore index 9c2842d9..281f0b89 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ publish/ Gemfile.lock .bundle bin/ +.idea diff --git a/lib/net/ldap.rb b/lib/net/ldap.rb index f7a98ef5..9c13a97d 100644 --- a/lib/net/ldap.rb +++ b/lib/net/ldap.rb @@ -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 diff --git a/script/install-openldap b/script/install-openldap index 3e391d87..47aa4bfe 100755 --- a/script/install-openldap +++ b/script/install-openldap @@ -15,7 +15,7 @@ TMPDIR=$(mktemp -d) cd $TMPDIR # Delete data and reconfigure. -cp -v /var/lib/ldap/DB_CONFIG ./DB_CONFIG +cp -v /usr/share/slapd/DB_CONFIG ./DB_CONFIG rm -rf /etc/ldap/slapd.d/* rm -rf /var/lib/ldap/* cp -v ./DB_CONFIG /var/lib/ldap/DB_CONFIG diff --git a/test/integration/test_return_codes.rb b/test/integration/test_return_codes.rb index 0e381a0a..eccd260e 100644 --- a/test/integration/test_return_codes.rb +++ b/test/integration/test_return_codes.rb @@ -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=rubyldap,dc=com") assert result = @ldap.get_operation_result