]> git.sur5r.net Git - openldap/blobdiff - tests/scripts/test024-unique
Merge remote branch 'origin/mdb.master'
[openldap] / tests / scripts / test024-unique
index f116c09f09fdc7473c71e3b3da1c38ca3147a281..1851bcab6a15a5c02c4425c15ddaa92461353650 100755 (executable)
@@ -2,7 +2,7 @@
 # $OpenLDAP$
 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
 ##
-## Copyright 2004-2007 The OpenLDAP Foundation.
+## Copyright 2004-2012 The OpenLDAP Foundation.
 ## All rights reserved.
 ##
 ## Redistribution and use in source and binary forms, with or without
@@ -21,6 +21,9 @@ if test $UNIQUE = uniqueno; then
        exit 0
 fi
 
+RCODEconstraint=19
+test $BACKEND = null && RCODEconstraint=0
+
 mkdir -p $TESTDIR $DBDIR1
 
 $SLAPPASSWD -g -n >$CONFIGPWF
@@ -107,7 +110,7 @@ employeeType: contractor
 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
@@ -223,7 +226,7 @@ employeeType: contractor
 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
@@ -280,7 +283,7 @@ employeeType: contractor
 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
@@ -340,7 +343,7 @@ employeeType: contractor
 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
@@ -425,6 +428,7 @@ dn: olcOverlay={0}unique,olcDatabase={1}$BACKEND,cn=config
 changetype: modify
 add: olcUniqueURI
 olcUniqueURI: ldap:///?sn?sub?(cn=e*)
+olcUniqueURI: ldap:///?uid?sub?(cn=edgar)
 -
 delete: olcUniqueURI
 olcUniqueURI: ldap:///?description?one
@@ -445,6 +449,7 @@ objectClass: olcUniqueConfig
 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
@@ -473,6 +478,24 @@ if test $RC != 0 ; then
        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 > \
@@ -485,7 +508,7 @@ cn: elvis
 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
@@ -557,7 +580,7 @@ description: left the building
 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