Skip to content

Commit

Permalink
Merge branch 'fix-v1.3.0' of https:/obourdon/osixia-docke…
Browse files Browse the repository at this point in the history
…r-openldap into obourdon-fix-v1.3.0
  • Loading branch information
BertrandGouny committed Dec 2, 2019
2 parents 2a03b39 + 63cbdc2 commit f902e45
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
7 changes: 3 additions & 4 deletions image/service/slapd/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,12 @@ if [ ! -e "$FIRST_START_DONE" ]; then
fi
# Check that LDAP_BASE_DN and LDAP_DOMAIN are in sync
domain_from_base_dn=$(echo $LDAP_BASE_DN | tr ',' '\n' | sed -e 's/^.*=//' | tr '\n' '.' | sed -e 's/\.$//')
set +e
echo "$domain_from_base_dn" | egrep -q ".*$LDAP_DOMAIN\$"
if [ $? -ne 0 ]; then
if `echo "$domain_from_base_dn" | egrep -q ".*$LDAP_DOMAIN\$" || echo $LDAP_DOMAIN | egrep -q ".*$domain_from_base_dn\$"`; then
: # pass
else
log-helper error "Error: domain $domain_from_base_dn derived from LDAP_BASE_DN $LDAP_BASE_DN does not match LDAP_DOMAIN $LDAP_DOMAIN"
exit 1
fi
set -e
}

function is_new_schema() {
Expand Down
17 changes: 15 additions & 2 deletions test/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ load test_helper

}

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

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

Expand All @@ -35,7 +35,7 @@ load test_helper

}

@test "ldap domain with ldap base dn subdomain" {
@test "ldap domain with matching ldap base dn subdomain" {

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"

Expand All @@ -48,6 +48,19 @@ load test_helper

}

@test "ldap base dn domain with matching ldap subdomain" {

run_image -h ldap.example.fr -e LDAP_TLS=false -e LDAP_DOMAIN=mysub.example.fr -e LDAP_BASE_DN="o=example,c=fr"

sleep 5

CSTATUS=$(check_container)
clear_container

[ "$CSTATUS" == "running 0" ]

}

@test "ldap domain with ldap base dn subdomain included" {

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"
Expand Down

0 comments on commit f902e45

Please sign in to comment.