Skip to content

Commit af00993

Browse files
committed
Merge branch 'master' into instrument-messages
2 parents e4ea64c + cf39451 commit af00993

File tree

5 files changed

+123
-3
lines changed

5 files changed

+123
-3
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ rvm:
33
- 1.9.3
44
- 2.0.0
55
- 2.1.2
6+
# optional
67
- jruby-19mode
78
- rbx-19mode
8-
# - rbx-2
9+
- rbx-2
910

1011
env:
1112
- INTEGRATION=openldap
@@ -19,6 +20,8 @@ script: bundle exec rake
1920
matrix:
2021
allow_failures:
2122
- rvm: jruby-19mode
23+
- rvm: rbx-19mode
24+
- rvm: rbx-2
2225
fast_finish: true
2326

2427
notifications:

script/install-openldap

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ set -x
55
BASE_PATH="$( cd `dirname $0`/../test/fixtures/openldap && pwd )"
66
SEED_PATH="$( cd `dirname $0`/../test/fixtures && pwd )"
77

8-
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y --force-yes slapd time ldap-utils
8+
dpkg -s slapd time ldap-utils ||\
9+
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y --force-yes slapd time ldap-utils
910

1011
sudo /etc/init.d/slapd stop
1112

@@ -20,6 +21,8 @@ sudo cp -v ./DB_CONFIG /var/lib/ldap/DB_CONFIG
2021
sudo slapadd -F /etc/ldap/slapd.d -b "cn=config" -l $BASE_PATH/slapd.conf.ldif
2122
# Load memberof and ref-int overlays and configure them.
2223
sudo slapadd -F /etc/ldap/slapd.d -b "cn=config" -l $BASE_PATH/memberof.ldif
24+
# Load retcode overlay and configure
25+
sudo slapadd -F /etc/ldap/slapd.d -b "cn=config" -l $BASE_PATH/retcode.ldif
2326

2427
# Add base domain.
2528
sudo slapadd -F /etc/ldap/slapd.d <<EOM

test/fixtures/openldap/retcode.ldif

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
dn: cn=module,cn=config
2+
cn: module
3+
objectClass: olcModuleList
4+
objectClass: top
5+
olcModulePath: /usr/lib/ldap
6+
olcModuleLoad: retcode.la
7+
8+
# source: http://www.opensource.apple.com/source/OpenLDAP/OpenLDAP-186/OpenLDAP/tests/data/retcode.conf?txt
9+
10+
dn: olcOverlay={2}retcode,olcDatabase={1}hdb,cn=config
11+
objectClass: olcConfig
12+
objectClass: olcRetcodeConfig
13+
objectClass: olcOverlayConfig
14+
objectClass: top
15+
olcOverlay: retcode
16+
olcRetcodeParent: ou=Retcodes,dc=rubyldap,dc=com
17+
olcRetcodeInDir: TRUE
18+
olcRetcodeSleep: 0
19+
olcRetcodeItem: "cn=success" 0x00
20+
olcRetcodeItem: "cn=success w/ delay" 0x00 sleeptime=2
21+
olcRetcodeItem: "cn=operationsError" 0x01
22+
olcRetcodeItem: "cn=protocolError" 0x02
23+
olcRetcodeItem: "cn=timeLimitExceeded" 0x03 op=search
24+
olcRetcodeItem: "cn=sizeLimitExceeded" 0x04 op=search
25+
olcRetcodeItem: "cn=compareFalse" 0x05 op=compare
26+
olcRetcodeItem: "cn=compareTrue" 0x06 op=compare
27+
olcRetcodeItem: "cn=authMethodNotSupported" 0x07
28+
olcRetcodeItem: "cn=strongAuthNotSupported" 0x07 text="same as authMethodNotSupported"
29+
olcRetcodeItem: "cn=strongAuthRequired" 0x08
30+
olcRetcodeItem: "cn=strongerAuthRequired" 0x08 text="same as strongAuthRequired"
31+
olcRetcodeItem: "cn=referral" 0x0a text="LDAPv3" ref="ldap://:9019"
32+
olcRetcodeItem: "cn=adminLimitExceeded" 0x0b text="LDAPv3"
33+
olcRetcodeItem: "cn=unavailableCriticalExtension" 0x0c text="LDAPv3"
34+
olcRetcodeItem: "cn=confidentialityRequired" 0x0d text="LDAPv3"
35+
olcRetcodeItem: "cn=saslBindInProgress" 0x0e text="LDAPv3"
36+
olcRetcodeItem: "cn=noSuchAttribute" 0x10
37+
olcRetcodeItem: "cn=undefinedAttributeType" 0x11
38+
olcRetcodeItem: "cn=inappropriateMatching" 0x12
39+
olcRetcodeItem: "cn=constraintViolation" 0x13
40+
olcRetcodeItem: "cn=attributeOrValueExists" 0x14
41+
olcRetcodeItem: "cn=invalidAttributeSyntax" 0x15
42+
olcRetcodeItem: "cn=noSuchObject" 0x20
43+
olcRetcodeItem: "cn=aliasProblem" 0x21
44+
olcRetcodeItem: "cn=invalidDNSyntax" 0x22
45+
olcRetcodeItem: "cn=aliasDereferencingProblem" 0x24
46+
olcRetcodeItem: "cn=proxyAuthzFailure" 0x2F text="LDAPv3 proxy authorization"
47+
olcRetcodeItem: "cn=inappropriateAuthentication" 0x30
48+
olcRetcodeItem: "cn=invalidCredentials" 0x31
49+
olcRetcodeItem: "cn=insufficientAccessRights" 0x32
50+
olcRetcodeItem: "cn=busy" 0x33
51+
olcRetcodeItem: "cn=unavailable" 0x34
52+
olcRetcodeItem: "cn=unwillingToPerform" 0x35
53+
olcRetcodeItem: "cn=loopDetect" 0x36
54+
olcRetcodeItem: "cn=namingViolation" 0x40
55+
olcRetcodeItem: "cn=objectClassViolation" 0x41
56+
olcRetcodeItem: "cn=notAllowedOnNonleaf" 0x42
57+
olcRetcodeItem: "cn=notAllowedOnRDN" 0x43
58+
olcRetcodeItem: "cn=entryAlreadyExists" 0x44
59+
olcRetcodeItem: "cn=objectClassModsProhibited" 0x45
60+
olcRetcodeItem: "cn=resultsTooLarge" 0x46 text="CLDAP"
61+
olcRetcodeItem: "cn=affectsMultipleDSAs" 0x47 text="LDAPv3"
62+
olcRetcodeItem: "cn=other" 0x50
63+
olcRetcodeItem: "cn=cupResourcesExhausted" 0x71
64+
olcRetcodeItem: "cn=cupSecurityViolation" 0x72
65+
olcRetcodeItem: "cn=cupInvalidData" 0x73
66+
olcRetcodeItem: "cn=cupUnsupportedScheme" 0x74
67+
olcRetcodeItem: "cn=cupReloadRequired" 0x75
68+
olcRetcodeItem: "cn=cancelled" 0x76
69+
olcRetcodeItem: "cn=noSuchOperation" 0x77
70+
olcRetcodeItem: "cn=tooLate" 0x78
71+
olcRetcodeItem: "cn=cannotCancel" 0x79
72+
olcRetcodeItem: "cn=syncRefreshRequired" 0x4100
73+
olcRetcodeItem: "cn=noOperation" 0x410e
74+
olcRetcodeItem: "cn=assertionFailed" 0x410f
75+
olcRetcodeItem: "cn=noReferralsFound" 0x4110
76+
olcRetcodeItem: "cn=cannotChain" 0x4111

test/integration/test_return_codes.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
require_relative '../test_helper'
2+
3+
# NOTE: These tests depend on the OpenLDAP retcode overlay.
4+
# See: section 12.12 http://www.openldap.org/doc/admin24/overlays.html
5+
6+
class TestReturnCodeIntegration < LDAPIntegrationTestCase
7+
def test_operations_error
8+
refute @ldap.search(filter: "cn=operationsError", base: "ou=Retcodes,dc=rubyldap,dc=com")
9+
assert result = @ldap.get_operation_result
10+
11+
assert_equal 1, result.code
12+
assert_equal Net::LDAP::ResultStrings[1], result.message
13+
end
14+
15+
def test_protocol_error
16+
refute @ldap.search(filter: "cn=protocolError", base: "ou=Retcodes,dc=rubyldap,dc=com")
17+
assert result = @ldap.get_operation_result
18+
19+
assert_equal 2, result.code
20+
assert_equal Net::LDAP::ResultStrings[2], result.message
21+
end
22+
23+
def test_time_limit_exceeded
24+
refute @ldap.search(filter: "cn=timeLimitExceeded", base: "ou=Retcodes,dc=rubyldap,dc=com")
25+
assert result = @ldap.get_operation_result
26+
27+
assert_equal 3, result.code
28+
assert_equal Net::LDAP::ResultStrings[3], result.message
29+
end
30+
31+
def test_size_limit_exceeded
32+
refute @ldap.search(filter: "cn=sizeLimitExceeded", base: "ou=Retcodes,dc=rubyldap,dc=com")
33+
assert result = @ldap.get_operation_result
34+
35+
assert_equal 4, result.code
36+
assert_equal Net::LDAP::ResultStrings[4], result.message
37+
end
38+
end

test/support/vm/openldap/Vagrantfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
VAGRANTFILE_API_VERSION = "2"
66

77
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8-
config.vm.hostname = "freeipa.ghe.local"
8+
config.vm.hostname = "rubyldap.com"
99

1010
config.vm.box = "hashicorp/precise64"
1111

0 commit comments

Comments
 (0)