From 96b994e6dd42b69fc13e228ba4aaf034e69f6d0a Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Thu, 23 Aug 2012 13:09:05 +0200 Subject: [PATCH] ITS#7366 Update slapo-constraint tests --- tests/data/constraint/constraint.out | 3 +++ tests/data/constraint/t_fail_01.ldif | 2 +- tests/data/constraint/t_fail_02.ldif | 2 +- tests/data/constraint/t_fail_03.ldif | 2 +- tests/data/constraint/t_fail_04.ldif | 2 +- tests/data/constraint/t_fail_05.ldif | 2 +- tests/data/constraint/t_fail_06.ldif | 2 +- tests/data/constraint/t_fail_07.ldif | 2 +- tests/data/constraint/t_fail_08.ldif | 2 +- tests/data/constraint/t_fail_09.ldif | 2 +- tests/data/constraint/t_fail_10.ldif | 2 +- tests/data/constraint/t_fail_11.ldif | 2 +- tests/data/constraint/t_fail_12.ldif | 10 ++++++++++ tests/data/constraint/t_fail_13.ldif | 4 ++++ tests/data/constraint/t_fail_14.ldif | 4 ++++ tests/data/constraint/t_ok_01.ldif | 2 +- tests/data/constraint/t_ok_02.ldif | 2 +- tests/data/constraint/t_ok_03.ldif | 2 +- tests/data/constraint/t_ok_04.ldif | 2 +- tests/data/constraint/t_ok_05.ldif | 2 +- tests/data/constraint/t_ok_06.ldif | 2 +- tests/data/constraint/t_ok_07.ldif | 2 +- tests/data/constraint/t_ok_08.ldif | 2 +- tests/data/constraint/t_ok_09.ldif | 2 +- tests/data/constraint/t_ok_10.ldif | 2 +- tests/data/constraint/t_ok_11.ldif | 2 +- tests/data/constraint/t_ok_12.ldif | 2 +- tests/data/constraint/t_ok_13.ldif | 2 +- tests/data/constraint/t_ok_14.ldif | 2 +- tests/data/constraint/user.ldif | 5 +++-- tests/scripts/test064-constraint | 8 ++++++-- 31 files changed, 55 insertions(+), 29 deletions(-) create mode 100644 tests/data/constraint/t_fail_12.ldif create mode 100644 tests/data/constraint/t_fail_13.ldif create mode 100644 tests/data/constraint/t_fail_14.ldif diff --git a/tests/data/constraint/constraint.out b/tests/data/constraint/constraint.out index 94c8d35e1e..f2d21e998e 100644 --- a/tests/data/constraint/constraint.out +++ b/tests/data/constraint/constraint.out @@ -23,3 +23,6 @@ FAIL FAIL FAIL FAIL +FAIL +FAIL +FAIL diff --git a/tests/data/constraint/t_fail_01.ldif b/tests/data/constraint/t_fail_01.ldif index c797271eaf..f90f33c10f 100644 --- a/tests/data/constraint/t_fail_01.ldif +++ b/tests/data/constraint/t_fail_01.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: b@example.com diff --git a/tests/data/constraint/t_fail_02.ldif b/tests/data/constraint/t_fail_02.ldif index e3f32af096..cccbb18b51 100644 --- a/tests/data/constraint/t_fail_02.ldif +++ b/tests/data/constraint/t_fail_02.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: b@example.com diff --git a/tests/data/constraint/t_fail_03.ldif b/tests/data/constraint/t_fail_03.ldif index cf6ac23232..41b0d08664 100644 --- a/tests/data/constraint/t_fail_03.ldif +++ b/tests/data/constraint/t_fail_03.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: b@example.com diff --git a/tests/data/constraint/t_fail_04.ldif b/tests/data/constraint/t_fail_04.ldif index 8dd10c68aa..f5e449aa8e 100644 --- a/tests/data/constraint/t_fail_04.ldif +++ b/tests/data/constraint/t_fail_04.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: b@example.com diff --git a/tests/data/constraint/t_fail_05.ldif b/tests/data/constraint/t_fail_05.ldif index 9f11082469..f2ed68d789 100644 --- a/tests/data/constraint/t_fail_05.ldif +++ b/tests/data/constraint/t_fail_05.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: b@example.com diff --git a/tests/data/constraint/t_fail_06.ldif b/tests/data/constraint/t_fail_06.ldif index 1871c92b0e..17bdc2e1c1 100644 --- a/tests/data/constraint/t_fail_06.ldif +++ b/tests/data/constraint/t_fail_06.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify replace: mail mail: a@example.com diff --git a/tests/data/constraint/t_fail_07.ldif b/tests/data/constraint/t_fail_07.ldif index 1041f98820..a7539dd5de 100644 --- a/tests/data/constraint/t_fail_07.ldif +++ b/tests/data/constraint/t_fail_07.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify replace: mail mail: a@example.com diff --git a/tests/data/constraint/t_fail_08.ldif b/tests/data/constraint/t_fail_08.ldif index 4e5b420a55..f2269ede01 100644 --- a/tests/data/constraint/t_fail_08.ldif +++ b/tests/data/constraint/t_fail_08.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: b@example.com diff --git a/tests/data/constraint/t_fail_09.ldif b/tests/data/constraint/t_fail_09.ldif index dd8d747c1d..10e2b9893f 100644 --- a/tests/data/constraint/t_fail_09.ldif +++ b/tests/data/constraint/t_fail_09.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: b@example.com diff --git a/tests/data/constraint/t_fail_10.ldif b/tests/data/constraint/t_fail_10.ldif index 043380f944..812e8662eb 100644 --- a/tests/data/constraint/t_fail_10.ldif +++ b/tests/data/constraint/t_fail_10.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: example@not-allowed.com diff --git a/tests/data/constraint/t_fail_11.ldif b/tests/data/constraint/t_fail_11.ldif index 8bb03fa6a3..e3e9d4b5cf 100644 --- a/tests/data/constraint/t_fail_11.ldif +++ b/tests/data/constraint/t_fail_11.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify delete: mail mail: original@example.com diff --git a/tests/data/constraint/t_fail_12.ldif b/tests/data/constraint/t_fail_12.ldif new file mode 100644 index 0000000000..60558edd81 --- /dev/null +++ b/tests/data/constraint/t_fail_12.ldif @@ -0,0 +1,10 @@ +dn: cn=John Doe,dc=example,dc=com +changetype: modify +delete: mail +mail: original@example.com +- +add: mail +mail: notsooriginal@example.com +- +replace: cn +cn: John Fail diff --git a/tests/data/constraint/t_fail_13.ldif b/tests/data/constraint/t_fail_13.ldif new file mode 100644 index 0000000000..855de83021 --- /dev/null +++ b/tests/data/constraint/t_fail_13.ldif @@ -0,0 +1,4 @@ +dn: cn=John Doe,dc=example,dc=com +changetype: modify +replace: givenname +givenname: Joe diff --git a/tests/data/constraint/t_fail_14.ldif b/tests/data/constraint/t_fail_14.ldif new file mode 100644 index 0000000000..5ba56812c0 --- /dev/null +++ b/tests/data/constraint/t_fail_14.ldif @@ -0,0 +1,4 @@ +dn: cn=John Doe,dc=example,dc=com +changetype: modify +replace: sn +sn: Down diff --git a/tests/data/constraint/t_ok_01.ldif b/tests/data/constraint/t_ok_01.ldif index 87b6a42900..3724eb0e08 100644 --- a/tests/data/constraint/t_ok_01.ldif +++ b/tests/data/constraint/t_ok_01.ldif @@ -1,3 +1,3 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify delete: mail diff --git a/tests/data/constraint/t_ok_02.ldif b/tests/data/constraint/t_ok_02.ldif index a76df6baa3..20526bdb6b 100644 --- a/tests/data/constraint/t_ok_02.ldif +++ b/tests/data/constraint/t_ok_02.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify replace: mail mail: a@example.com diff --git a/tests/data/constraint/t_ok_03.ldif b/tests/data/constraint/t_ok_03.ldif index 19242b470b..311fa0df21 100644 --- a/tests/data/constraint/t_ok_03.ldif +++ b/tests/data/constraint/t_ok_03.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify replace: mail mail: a@example.com diff --git a/tests/data/constraint/t_ok_04.ldif b/tests/data/constraint/t_ok_04.ldif index 87b6a42900..3724eb0e08 100644 --- a/tests/data/constraint/t_ok_04.ldif +++ b/tests/data/constraint/t_ok_04.ldif @@ -1,3 +1,3 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify delete: mail diff --git a/tests/data/constraint/t_ok_05.ldif b/tests/data/constraint/t_ok_05.ldif index 3d260a38ba..0f24b2abae 100644 --- a/tests/data/constraint/t_ok_05.ldif +++ b/tests/data/constraint/t_ok_05.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: a@example.com diff --git a/tests/data/constraint/t_ok_06.ldif b/tests/data/constraint/t_ok_06.ldif index bac6113adf..dbe8670ee6 100644 --- a/tests/data/constraint/t_ok_06.ldif +++ b/tests/data/constraint/t_ok_06.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify delete: mail - diff --git a/tests/data/constraint/t_ok_07.ldif b/tests/data/constraint/t_ok_07.ldif index 870eff8455..d2293e04de 100644 --- a/tests/data/constraint/t_ok_07.ldif +++ b/tests/data/constraint/t_ok_07.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify delete: mail - diff --git a/tests/data/constraint/t_ok_08.ldif b/tests/data/constraint/t_ok_08.ldif index 5593b08d05..450b4c0173 100644 --- a/tests/data/constraint/t_ok_08.ldif +++ b/tests/data/constraint/t_ok_08.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: b@example.com diff --git a/tests/data/constraint/t_ok_09.ldif b/tests/data/constraint/t_ok_09.ldif index 75dd710f24..b161e1b7d5 100644 --- a/tests/data/constraint/t_ok_09.ldif +++ b/tests/data/constraint/t_ok_09.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify replace: mail mail: a@example.com diff --git a/tests/data/constraint/t_ok_10.ldif b/tests/data/constraint/t_ok_10.ldif index 8412264526..7eb72cdc2f 100644 --- a/tests/data/constraint/t_ok_10.ldif +++ b/tests/data/constraint/t_ok_10.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: b@example.com diff --git a/tests/data/constraint/t_ok_11.ldif b/tests/data/constraint/t_ok_11.ldif index a5a5783eb0..04766bf3a4 100644 --- a/tests/data/constraint/t_ok_11.ldif +++ b/tests/data/constraint/t_ok_11.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: b@example.com diff --git a/tests/data/constraint/t_ok_12.ldif b/tests/data/constraint/t_ok_12.ldif index e683bb3263..1cfab0a968 100644 --- a/tests/data/constraint/t_ok_12.ldif +++ b/tests/data/constraint/t_ok_12.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: b@example.com diff --git a/tests/data/constraint/t_ok_13.ldif b/tests/data/constraint/t_ok_13.ldif index 19ccbb8735..acd5771d33 100644 --- a/tests/data/constraint/t_ok_13.ldif +++ b/tests/data/constraint/t_ok_13.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify add: mail mail: b@example.com diff --git a/tests/data/constraint/t_ok_14.ldif b/tests/data/constraint/t_ok_14.ldif index dd00fccdb2..127e463b5b 100644 --- a/tests/data/constraint/t_ok_14.ldif +++ b/tests/data/constraint/t_ok_14.ldif @@ -1,4 +1,4 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com changetype: modify delete: description description: desc1 diff --git a/tests/data/constraint/user.ldif b/tests/data/constraint/user.ldif index b8a06de99e..cc244534b3 100644 --- a/tests/data/constraint/user.ldif +++ b/tests/data/constraint/user.ldif @@ -1,7 +1,8 @@ -dn: cn=user,dc=example,dc=com +dn: cn=John Doe,dc=example,dc=com objectclass: inetOrgPerson objectclass: organizationalPerson -cn: John +cn: John Doe +givenname: John sn: Doe mail: original@example.com description: desc1 diff --git a/tests/scripts/test064-constraint b/tests/scripts/test064-constraint index 2d29baf1c6..a3104e168f 100755 --- a/tests/scripts/test064-constraint +++ b/tests/scripts/test064-constraint @@ -13,7 +13,7 @@ ROOTLDIF="$CONSTRAINTDIR/root.ldif" USERLDIF="$CONSTRAINTDIR/user.ldif" RESULTOUT="$CONSTRAINTDIR/constraint.out" SCRIPTOUT="$TESTDIR/constraint.out" -USERDN="cn=user,$BASEDN" +USERDN="cn=John Doe,$BASEDN" CONFDIR=$TESTDIR/slapd.d mkdir -p $TESTDIR $CONFDIR $DBDIR1 @@ -91,6 +91,10 @@ olcOverlay: constraint olcConstraintAttribute: mail count 3 olcConstraintAttribute: mail regex ^[[:alnum:]]+@example.com$ olcConstraintAttribute: description count 2 +# cn value has to be concatenated givenName SP sn +olcConstraintAttribute: cn,sn,givenName + set "(this/givenName + [ ] + this/sn) & this/cn" + restrict="ldap:///$USERDN??sub?(objectClass=inetOrgPerson)" EOF $SLAPADD -F $CONFDIR -n 0 -l $TESTDIR/config.ldif @@ -123,7 +127,7 @@ fi echo "Running constraint tests..." for ldif in $SRCDIR/data/constraint/{*ok*,*fail*}.ldif; do ### reload - $LDAPDELETE -D "$MANAGERDN" -H $URI1 -w $PASSWD $USERDN &>/dev/null + $LDAPDELETE -D "$MANAGERDN" -H $URI1 -w $PASSWD "$USERDN" &>/dev/null RC=$? if test $RC != 0 ; then echo "ldapdelete failed ($RC)!" -- 2.39.5