# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
-## Copyright 1998-2008 The OpenLDAP Foundation.
-## Copyright 2008 Red Hat, Inc.
+## Copyright 1998-2012 The OpenLDAP Foundation.
+## Portions Copyright 2008 Red Hat, Inc.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
exit 0
fi
-if test "$BACKEND" != "hdb" ; then
- echo "Test does not support $BACKEND"
+if test $REFINT = refintno; then
+ echo "Referential Integrity overlay not available, test skipped"
+ exit 0
+fi
+
+if test $BACKEND = bdb; then
+ echo "$BACKEND backend does not support subtree rename, test skipped"
exit 0
fi
cat /dev/null > $TESTOUT
+indexInclude="" mainInclude="" bdbInclude="# " nullExclude=""
+test $INDEXDB = indexdb || indexInclude="# "
+test $MAINDB = maindb || mainInclude="# "
+case $BACKEND in
+bdb | hdb) bdbInclude="" ;;
+null) nullExclude="# " ;;
+esac
+
if [ "$MEMBEROF" = memberofmod ]; then
- echo "Inserting memberof overlay on producer..."
+ echo "Inserting memberof overlay on provider..."
$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF > $TESTOUT 2>&1
dn: cn=module,cn=config
objectClass: olcModuleList
>> $TESTOUT 2>&1 <<EOF
dn: olcDatabase={1}$BACKEND,cn=config
objectClass: olcDatabaseConfig
-objectClass: olc${BACKEND}Config
+${nullExclude}objectClass: olc${BACKEND}Config
olcDatabase: {1}$BACKEND
olcSuffix: $BASEDN
olcRootDN: cn=Manager,$BASEDN
olcRootPW:: c2VjcmV0
olcMonitoring: TRUE
-olcDbDirectory: $TESTDIR/db.1.a/
-olcDbCacheSize: 1000
-olcDbIndex: objectClass eq
-olcDbIndex: cn pres,eq,sub
-olcDbIndex: uid pres,eq,sub
-olcDbIndex: sn pres,eq,sub
-olcDbMode: 384
+${nullExclude}olcDbDirectory: $TESTDIR/db.1.a/
+${bdbInclude}olcDbCacheSize: 1000
+${indexInclude}olcDbIndex: objectClass eq
+${indexInclude}olcDbIndex: cn pres,eq,sub
+${indexInclude}olcDbIndex: uid pres,eq,sub
+${indexInclude}olcDbIndex: sn pres,eq,sub
+${mainInclude}olcDbMode: 384
# {0}memberof, {1}$BACKEND, config
dn: olcOverlay={0}memberof,olcDatabase={1}$BACKEND,cn=config
newsuperior: $BASEDN
EOF
+# refint runs in a background thread, so it most likely won't complete
+# before the modify returns. Give it some time to execute.
+sleep 1
+
echo "Re-search the entire database..."
echo "# Re-search the entire database..." >> $SEARCHOUT
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
newsuperior: $BASEDN
EOF
+sleep 1
+
echo "Re-search the entire database..."
echo "# Re-search the entire database..." >> $SEARCHOUT
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
changetype: delete
EOF
+sleep 1
+
echo "Re-search the entire database..."
echo "# Re-search the entire database..." >> $SEARCHOUT
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
LDIF=$MEMBEROFREFINTOUT
echo "Filtering ldapsearch results..."
-. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
+$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
echo "Filtering original ldif used to create database..."
-. $LDIFFILTER < $LDIF > $LDIFFLT
+$LDIFFILTER < $LDIF > $LDIFFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT