Files
heimdal/tests/ldap/slapd-init.in
Nicolas Williams 274021f7db Make check-ldap run on Ubuntu
Apparmor on Ubuntu prevents slapd from using the Unix domain socket we
want it to.  The fix is to copy the slapd executable into the objdir,
which disables the apparmor profile for slapd.

Also, make sure the ldapi: URI has the right path for the socket in
krb5.conf.
2016-11-15 15:35:29 -06:00

49 lines
1.2 KiB
Bash

#!/bin/sh
# $Id$
srcdir=@srcdir@
rm -rf db schema
mkdir db
# kill of old slapd if running
sh "${srcdir}/slapd-stop" > /dev/null
SCHEMA_NEEDED="hdb core nis cosine inetorgperson openldap samba"
SCHEMA_PATHS="${srcdir}/../../lib/hdb ${srcdir} /etc/ldap/schema /etc/openldap/schema /private/etc/openldap/schema /usr/share/openldap/schema"
test -d schema || mkdir schema
# setup needed schema files
for f in $SCHEMA_NEEDED; do
if [ ! -r schema/$f.schema ]; then
for d in $SCHEMA_PATHS ; do
if [ -r $d/$f.schema ] ; then
cp $d/$f.schema schema/$f.schema
continue 2
fi
done
echo "SKIPPING TESTS: you need the following schema file: $f.schema"
exit 1
fi
done
touch modules.conf || exit 1
if ! slapadd -d 0 -f "${srcdir}/slapd.conf" < "${srcdir}/init.ldif"; then
echo "moduleload back_bdb.la" >> modules.conf
if ! slapadd -d 0 -f "${srcdir}/slapd.conf" < "${srcdir}/init.ldif"; then
echo "modulepath /usr/lib/ldap" > modules.conf
echo "moduleload back_bdb.la" >> modules.conf
slapadd -d 0 -f "${srcdir}/slapd.conf" < "${srcdir}/init.ldif" || exit 1
fi
fi
cp "`which slapd`" . || true # fails if running
echo "starting slapd"
./slapd -d0 -f "${srcdir}/slapd.conf" -h ldapi://.%2Fldap-socket &
sleep 4