# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
-## Copyright 2004-2009 The OpenLDAP Foundation.
+## Copyright 2004-2012 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
exit 0
fi
+RCODEconstraint=19
+test $BACKEND = null && RCODEconstraint=0
+
mkdir -p $TESTDIR $DBDIR1
$SLAPPASSWD -g -n >$CONFIGPWF
givenName: Bill
EOTUNIQ2
RC=$?
-if test $RC != 19 ; then
+if test $RC != $RCODEconstraint ; then
echo "unique check failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit -1
givenName: Bill
EOTUNIQ2
RC=$?
-if test $RC != 19 ; then
+if test $RC != $RCODEconstraint ; then
echo "unique check failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit -1
givenName: Bill
EOTUNIQ2
RC=$?
-if test $RC != 19 ; then
+if test $RC != $RCODEconstraint ; then
echo "olcUniqueAttribtue single deletion hit the wrong value"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit -1
givenName: Bill
EOTUNIQ2
RC=$?
-if test $RC != 19 ; then
+if test $RC != $RCODEconstraint ; then
echo "unique check failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit -1
changetype: modify
add: olcUniqueURI
olcUniqueURI: ldap:///?sn?sub?(cn=e*)
+olcUniqueURI: ldap:///?uid?sub?(cn=edgar)
-
delete: olcUniqueURI
olcUniqueURI: ldap:///?description?one
olcOverlay: {0}unique
olcUniqueURI: ldap:///?employeeNumber,displayName?sub
olcUniqueURI: ldap:///?sn?sub?(cn=e*)
+olcUniqueURI: ldap:///?uid?sub?(cn=edgar)
EOF
diff $TESTDIR/third-config.ldif $TESTDIR/third-reference.ldif > /dev/null 2>&1
exit -1
fi
+echo "Adding a record unique in all domains because of filter conditions "
+$LDAPADD -D "$UNIQUEDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
+ $TESTOUT 2>&1 << EOF
+dn: uid=empty,ou=users,o=unique
+objectClass: inetOrgPerson
+uid: edgar
+cn: empty
+sn: empty
+EOF
+
+RC=$?
+if test $RC != 0 ; then
+ echo "spurious unique error ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit -1
+fi
+
+
echo "Adding a record unique in one domain, non-unique in the filtered domain..."
$LDAPADD -D "$UNIQUEDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
EOF
RC=$?
-if test $RC != 19 ; then
+if test $RC != $RCODEconstraint ; then
echo "unique check failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit -1
EOF
RC=$?
-if test $RC != 19 ; then
+if test $RC != $RCODEconstraint ; then
echo "unique check failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit -1