X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=tests%2Fscripts%2Ftest024-unique;h=d449f014ab2694b3a587ef5c477eb5be0a1c1503;hb=dac408369b0812762b3e85f7e024ea472ce79abc;hp=b00bbdfc9dcc877e617dbaf14c85deaeac43052c;hpb=62b0b10edf273a262d44effad6c9c0ba3b514c31;p=openldap
diff --git a/tests/scripts/test024-unique b/tests/scripts/test024-unique
index b00bbdfc9d..d449f014ab 100755
--- a/tests/scripts/test024-unique
+++ b/tests/scripts/test024-unique
@@ -2,7 +2,7 @@
# $OpenLDAP$
## This work is part of OpenLDAP Software .
##
-## Copyright 2004-2007 The OpenLDAP Foundation.
+## Copyright 2004-2011 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
@@ -36,8 +39,8 @@ if test $RC != 0 ; then
fi
echo "Starting slapd on TCP/IP port $PORT1..."
-mkdir testrun/confdir
-$SLAPD -f $CONF1 -F testrun/confdir -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
+mkdir $TESTDIR/confdir
+$SLAPD -f $CONF1 -F $TESTDIR/confdir -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID
@@ -107,15 +110,15 @@ 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
fi
echo Dynamically retrieving initial configuration...
-$LDAPSEARCH -S "" -b olcOverlay='{0}'unique,olcDatabase='{1}'$BACKEND,cn=config -D cn=config -y $CONFIGPWF -h $LOCALHOST -p $PORT1 -LLL | tr -d \\r >testrun/initial-config.ldif
-cat <testrun/initial-reference.ldif
+$LDAPSEARCH -S "" -b olcOverlay='{0}'unique,olcDatabase='{1}'$BACKEND,cn=config -D cn=config -y $CONFIGPWF -h $LOCALHOST -p $PORT1 -LLL | tr -d \\r >$TESTDIR/initial-config.ldif
+cat <$TESTDIR/initial-reference.ldif
dn: olcOverlay={0}unique,olcDatabase={1}$BACKEND,cn=config
objectClass: olcOverlayConfig
objectClass: olcUniqueConfig
@@ -125,7 +128,7 @@ olcUniqueAttribute: employeeNumber
olcUniqueAttribute: displayName
EOF
-diff testrun/initial-config.ldif testrun/initial-reference.ldif > /dev/null 2>&1
+diff $TESTDIR/initial-config.ldif $TESTDIR/initial-reference.ldif > /dev/null 2>&1
RC=$?
if test $RC != 0 ; then
echo "Initial configuration is not reported correctly."
@@ -164,8 +167,8 @@ if test $RC != 80 ; then
fi
echo Verifying initial configuration intact...
-$LDAPSEARCH -S "" -b olcOverlay='{0}'unique,olcDatabase='{1}'$BACKEND,cn=config -D cn=config -y $CONFIGPWF -h $LOCALHOST -p $PORT1 -LLL | tr -d \\r >testrun/initial-config-recheck.ldif
-diff testrun/initial-config-recheck.ldif testrun/initial-reference.ldif > /dev/null 2>&1
+$LDAPSEARCH -S "" -b olcOverlay='{0}'unique,olcDatabase='{1}'$BACKEND,cn=config -D cn=config -y $CONFIGPWF -h $LOCALHOST -p $PORT1 -LLL | tr -d \\r >$TESTDIR/initial-config-recheck.ldif
+diff $TESTDIR/initial-config-recheck.ldif $TESTDIR/initial-reference.ldif > /dev/null 2>&1
RC=$?
if test $RC != 0 ; then
echo "Initial configuration damaged by unsuccessful modifies."
@@ -188,8 +191,8 @@ if test $RC != 0 ; then
fi
echo Verifying base removal...
-$LDAPSEARCH -S "" -b olcOverlay='{0}'unique,olcDatabase='{1}'$BACKEND,cn=config -D cn=config -y $CONFIGPWF -h $LOCALHOST -p $PORT1 -LLL | tr -d \\r >testrun/baseremoval-config.ldif
-cat >testrun/baseremoval-reference.ldif <$TESTDIR/baseremoval-config.ldif
+cat >$TESTDIR/baseremoval-reference.ldif < /dev/null 2>&1
+diff $TESTDIR/baseremoval-config.ldif $TESTDIR/baseremoval-reference.ldif > /dev/null 2>&1
RC=$?
if test $RC != 0 ; then
echo "Configuration damaged by base removal"
@@ -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
@@ -305,8 +308,8 @@ if test $RC != 0 ; then
fi
echo Dynamically retrieving second configuration...
-$LDAPSEARCH -S "" -b olcOverlay='{0}'unique,olcDatabase='{1}'$BACKEND,cn=config -D cn=config -y $CONFIGPWF -h $LOCALHOST -p $PORT1 -LLL | tr -d \\r >testrun/second-config.ldif
-cat >testrun/second-reference.ldif <$TESTDIR/second-config.ldif
+cat >$TESTDIR/second-reference.ldif < /dev/null 2>&1
+diff $TESTDIR/second-config.ldif $TESTDIR/second-reference.ldif > /dev/null 2>&1
RC=$?
if test $RC != 0 ; then
echo "Second configuration is not reported correctly."
@@ -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
@@ -408,8 +411,8 @@ if test $RC != 80 ; then
fi
echo Verifying second configuration intact...
-$LDAPSEARCH -S "" -b olcOverlay='{0}'unique,olcDatabase='{1}'$BACKEND,cn=config -D cn=config -y $CONFIGPWF -h $LOCALHOST -p $PORT1 -LLL | tr -d \\r >testrun/second-config-recheck.ldif
-diff testrun/second-config-recheck.ldif testrun/second-reference.ldif > /dev/null 2>&1
+$LDAPSEARCH -S "" -b olcOverlay='{0}'unique,olcDatabase='{1}'$BACKEND,cn=config -D cn=config -y $CONFIGPWF -h $LOCALHOST -p $PORT1 -LLL | tr -d \\r >$TESTDIR/second-config-recheck.ldif
+diff $TESTDIR/second-config-recheck.ldif $TESTDIR/second-reference.ldif > /dev/null 2>&1
RC=$?
if test $RC != 0 ; then
echo "Second configuration damaged by rejected modifies."
@@ -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
@@ -437,17 +441,18 @@ if test $RC != 0 ; then
fi
echo Dynamically retrieving third configuration...
-$LDAPSEARCH -S "" -b olcOverlay='{0}'unique,olcDatabase='{1}'$BACKEND,cn=config -D cn=config -y $CONFIGPWF -h $LOCALHOST -p $PORT1 -LLL | tr -d \\r >testrun/third-config.ldif
-cat >testrun/third-reference.ldif <$TESTDIR/third-config.ldif
+cat >$TESTDIR/third-reference.ldif < /dev/null 2>&1
+diff $TESTDIR/third-config.ldif $TESTDIR/third-reference.ldif > /dev/null 2>&1
RC=$?
if test $RC != 0 ; then
echo "Third configuration is not reported correctly."
@@ -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
@@ -508,8 +531,8 @@ if test $RC != 0 ; then
fi
echo Dynamically retrieving fourth configuration...
-$LDAPSEARCH -S "" -b olcOverlay='{0}'unique,olcDatabase='{1}'$BACKEND,cn=config -D cn=config -y $CONFIGPWF -h $LOCALHOST -p $PORT1 -LLL | tr -d \\r >testrun/fourth-config.ldif
-cat >testrun/fourth-reference.ldif <$TESTDIR/fourth-config.ldif
+cat >$TESTDIR/fourth-reference.ldif < /dev/null 2>&1
+diff $TESTDIR/fourth-config.ldif $TESTDIR/fourth-reference.ldif > /dev/null 2>&1
RC=$?
if test $RC != 0 ; then
echo "Fourth configuration is not reported correctly."
@@ -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