- if [ ! -f /etc/ldap/slapd.conf ]; then
- echo "cp_get_ldap_suffix: /etc/ldap/slapd.conf: No such file" >&2
+ RET=""
+
+ if [ -d /etc/ldap/slapd.d/ ]; then
+ RET="`grep -r olcSuffix: /etc/ldap/slapd.d/ | awk '{print $2}' | head -1`"
+ elif [ -f /etc/ldap/slapd.conf ]; then
+ RET="`awk '/^suffix/ { exit }
+ END { gsub(/"/, "", $2); print $2 }' \
+ < /etc/ldap/slapd.conf`"
+ else
+ RET=""
+ echo "cp_get_ldap_suffix: /etc/ldap/slapd.{d/,conf}: No such file or directory" >&2