Skip to content

Commit 78925bf

Browse files
committed
Merge branch 'obourdon-fix-v1.3.0' into release-1.4.0
2 parents c89cc16 + f902e45 commit 78925bf

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

image/service/slapd/startup.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,12 @@ if [ ! -e "$FIRST_START_DONE" ]; then
9797
fi
9898
# Check that LDAP_BASE_DN and LDAP_DOMAIN are in sync
9999
domain_from_base_dn=$(echo $LDAP_BASE_DN | tr ',' '\n' | sed -e 's/^.*=//' | tr '\n' '.' | sed -e 's/\.$//')
100-
set +e
101-
echo "$domain_from_base_dn" | egrep -q ".*$LDAP_DOMAIN\$"
102-
if [ $? -ne 0 ]; then
100+
if `echo "$domain_from_base_dn" | egrep -q ".*$LDAP_DOMAIN\$" || echo $LDAP_DOMAIN | egrep -q ".*$domain_from_base_dn\$"`; then
101+
: # pass
102+
else
103103
log-helper error "Error: domain $domain_from_base_dn derived from LDAP_BASE_DN $LDAP_BASE_DN does not match LDAP_DOMAIN $LDAP_DOMAIN"
104104
exit 1
105105
fi
106-
set -e
107106
}
108107

109108
function is_new_schema() {

test/test.bats

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ load test_helper
2222

2323
}
2424

25-
@test "ldap domain with ldap base dn" {
25+
@test "ldap domain with non-matching ldap base dn" {
2626

2727
run_image -h ldap.example.org -e LDAP_TLS=false -e LDAP_DOMAIN=example.com -e LDAP_BASE_DN="dc=example,dc=org"
2828

@@ -35,7 +35,7 @@ load test_helper
3535

3636
}
3737

38-
@test "ldap domain with ldap base dn subdomain" {
38+
@test "ldap domain with matching ldap base dn subdomain" {
3939

4040
run_image -h ldap.example.fr -e LDAP_TLS=false -e LDAP_DOMAIN=example.fr -e LDAP_BASE_DN="ou=myou,o=example,c=fr"
4141

@@ -48,6 +48,19 @@ load test_helper
4848

4949
}
5050

51+
@test "ldap base dn domain with matching ldap subdomain" {
52+
53+
run_image -h ldap.example.fr -e LDAP_TLS=false -e LDAP_DOMAIN=mysub.example.fr -e LDAP_BASE_DN="o=example,c=fr"
54+
55+
sleep 5
56+
57+
CSTATUS=$(check_container)
58+
clear_container
59+
60+
[ "$CSTATUS" == "running 0" ]
61+
62+
}
63+
5164
@test "ldap domain with ldap base dn subdomain included" {
5265

5366
run_image -h ldap.example.com -e LDAP_TLS=false -e LDAP_DOMAIN=example.com -e LDAP_BASE_DN="ou=myou,o=example,dc=com,c=fr"

0 commit comments

Comments
 (0)