12de962bdSlukem#! /bin/sh 2d11b170bStron# $OpenLDAP$ 32de962bdSlukem## This work is part of OpenLDAP Software <http://www.openldap.org/>. 42de962bdSlukem## 5*e670fd5cSchristos## Copyright 2005-2021 The OpenLDAP Foundation. 62de962bdSlukem## All rights reserved. 72de962bdSlukem## 82de962bdSlukem## Redistribution and use in source and binary forms, with or without 92de962bdSlukem## modification, are permitted only as authorized by the OpenLDAP 102de962bdSlukem## Public License. 112de962bdSlukem## 122de962bdSlukem## A copy of this license is available in the file LICENSE in the 132de962bdSlukem## top-level directory of the distribution or, alternatively, at 142de962bdSlukem## <http://www.OpenLDAP.org/license.html>. 152de962bdSlukem 162de962bdSlukemecho "running defines.sh" 172de962bdSlukem. $SRCDIR/scripts/defines.sh 182de962bdSlukem 19ef2f90d3Sadamcase $BACKEND in ldif | null) 20ef2f90d3Sadam # LDIF lacks ACL support, NULL cannot hold dynamic entries 21ef2f90d3Sadam echo "Test does not support $BACKEND backend, test skipped" 224e6df137Slukem exit 0 23ef2f90d3Sadamesac 244e6df137Slukem 252de962bdSlukemif test $DDS = ddsno; then 262de962bdSlukem echo "Dynamic Directory Services overlay not available, test skipped" 272de962bdSlukem exit 0 282de962bdSlukemfi 292de962bdSlukem 302de962bdSlukemmkdir -p $TESTDIR $DBDIR1 312de962bdSlukem 322de962bdSlukemecho "Running slapadd to build slapd database..." 33*e670fd5cSchristos. $CONFFILTER $BACKEND < $MCONF > $ADDCONF 342de962bdSlukem$SLAPADD -f $ADDCONF -l $LDIFORDERED 352de962bdSlukemRC=$? 362de962bdSlukemif test $RC != 0 ; then 372de962bdSlukem echo "slapadd failed ($RC)!" 382de962bdSlukem exit $RC 392de962bdSlukemfi 402de962bdSlukem 412de962bdSlukemecho "Running slapindex to index slapd database..." 42*e670fd5cSchristos. $CONFFILTER $BACKEND < $DDSCONF > $CONF1 432de962bdSlukem$SLAPINDEX -f $CONF1 442de962bdSlukemRC=$? 452de962bdSlukemif test $RC != 0 ; then 462de962bdSlukem echo "warning: slapindex failed ($RC)" 472de962bdSlukem echo " assuming no indexing support" 482de962bdSlukemfi 492de962bdSlukem 502de962bdSlukemecho "Starting slapd on TCP/IP port $PORT1..." 51*e670fd5cSchristos$SLAPD -f $CONF1 -h $URI1 -d $LVL > $LOG1 2>&1 & 522de962bdSlukemPID=$! 532de962bdSlukemif test $WAIT != 0 ; then 542de962bdSlukem echo PID $PID 552de962bdSlukem read foo 562de962bdSlukemfi 572de962bdSlukemKILLPIDS="$PID" 582de962bdSlukem 592de962bdSlukemsleep 1 602de962bdSlukem 612de962bdSlukemecho "Testing slapd searching..." 622de962bdSlukemfor i in 0 1 2 3 4 5; do 63*e670fd5cSchristos $LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \ 642de962bdSlukem '(objectclass=*)' > /dev/null 2>&1 652de962bdSlukem RC=$? 662de962bdSlukem if test $RC = 0 ; then 672de962bdSlukem break 682de962bdSlukem fi 692de962bdSlukem echo "Waiting 5 seconds for slapd to start..." 702de962bdSlukem sleep 5 712de962bdSlukemdone 722de962bdSlukem 732de962bdSlukemif test $RC != 0 ; then 742de962bdSlukem echo "ldapsearch failed ($RC)!" 752de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 762de962bdSlukem exit $RC 772de962bdSlukemfi 782de962bdSlukem 792de962bdSlukemcat /dev/null > $SEARCHOUT 802de962bdSlukem 812de962bdSlukemecho "Creating a dynamic entry..." 82*e670fd5cSchristos$LDAPADD -D $MANAGERDN -w $PASSWD -H $URI1 \ 832de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 842de962bdSlukemdn: cn=Dynamic Object,dc=example,dc=com 852de962bdSlukemobjectClass: inetOrgPerson 862de962bdSlukemobjectClass: dynamicObject 872de962bdSlukemcn: Dynamic Object 882de962bdSlukemsn: Object 892de962bdSlukemEOMODS 902de962bdSlukemRC=$? 912de962bdSlukemif test $RC != 0 ; then 922de962bdSlukem echo "ldapadd failed ($RC)!" 932de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 942de962bdSlukem exit $RC 952de962bdSlukemfi 962de962bdSlukem 972de962bdSlukemecho "Refreshing the newly created dynamic entry..." 98*e670fd5cSchristos$LDAPEXOP -D $MANAGERDN -w $PASSWD -H $URI1 \ 992de962bdSlukem "refresh" "cn=Dynamic Object,dc=example,dc=com" "120" \ 1002de962bdSlukem >> $TESTOUT 2>&1 1012de962bdSlukemRC=$? 1022de962bdSlukemif test $RC != 0 ; then 1032de962bdSlukem echo "ldapexop failed ($RC)!" 1042de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1052de962bdSlukem exit $RC 1062de962bdSlukemfi 1072de962bdSlukem 1082de962bdSlukemecho "Modifying the newly created dynamic entry..." 109*e670fd5cSchristos$LDAPMODIFY -D $MANAGERDN -w $PASSWD -H $URI1 \ 1102de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 1112de962bdSlukemdn: cn=Dynamic Object,dc=example,dc=com 1122de962bdSlukemchangetype: modify 1132de962bdSlukemadd: userPassword 1142de962bdSlukemuserPassword: dynamic 1152de962bdSlukemEOMODS 1162de962bdSlukemRC=$? 1172de962bdSlukemif test $RC != 0 ; then 1182de962bdSlukem echo "ldapadd failed ($RC)!" 1192de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1202de962bdSlukem exit $RC 1212de962bdSlukemfi 1222de962bdSlukem 1232de962bdSlukemecho "Binding as the newly created dynamic entry..." 124*e670fd5cSchristos$LDAPWHOAMI -H $URI1 \ 1252de962bdSlukem -D "cn=Dynamic Object,dc=example,dc=com" -w dynamic 1262de962bdSlukemRC=$? 1272de962bdSlukemif test $RC != 0 ; then 1282de962bdSlukem echo "ldapwhoami failed ($RC)!" 1292de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1302de962bdSlukem exit $RC 1312de962bdSlukemfi 1322de962bdSlukem 1332de962bdSlukemecho "Creating a dynamic entry subordinate to another..." 134*e670fd5cSchristos$LDAPADD -D $MANAGERDN -w $PASSWD -H $URI1 \ 1352de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 1362de962bdSlukemdn: cn=Subordinate Dynamic Object,cn=Dynamic Object,dc=example,dc=com 1372de962bdSlukemobjectClass: inetOrgPerson 1382de962bdSlukemobjectClass: dynamicObject 1392de962bdSlukemcn: Subordinate Dynamic Object 1402de962bdSlukemsn: Object 1412de962bdSlukemuserPassword: dynamic 1422de962bdSlukemEOMODS 1432de962bdSlukemRC=$? 1442de962bdSlukemif test $RC != 0 ; then 1452de962bdSlukem echo "ldapadd failed ($RC)!" 1462de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1472de962bdSlukem exit $RC 1482de962bdSlukemfi 1492de962bdSlukem 1502de962bdSlukemSEARCH=0 1512de962bdSlukem 1522de962bdSlukemSEARCH=`expr $SEARCH + 1` 1534e27b3e8Schristossleep $SLEEP0 1542de962bdSlukemecho "# [$SEARCH] Searching the dynamic portion of the database..." >> $SEARCHOUT 155*e670fd5cSchristos$LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \ 1562de962bdSlukem '(objectClass=dynamicObject)' '*' entryTtl \ 1572de962bdSlukem >> $SEARCHOUT 2>&1 1582de962bdSlukemRC=$? 1592de962bdSlukemif test $RC != 0 ; then 1602de962bdSlukem echo "ldapsearch failed ($RC)!" 1612de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1622de962bdSlukem exit $RC 1632de962bdSlukemfi 1642de962bdSlukem 1652de962bdSlukemecho "Creating a static entry subordinate to a dynamic one (should fail)..." 166*e670fd5cSchristos$LDAPADD -D $MANAGERDN -w $PASSWD -H $URI1 \ 1672de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 1682de962bdSlukemdn: cn=Subordinate Static Object,cn=Dynamic Object,dc=example,dc=com 1692de962bdSlukemobjectClass: inetOrgPerson 1702de962bdSlukemcn: Subordinate Static Object 1712de962bdSlukemsn: Object 1722de962bdSlukemuserPassword: static 1732de962bdSlukemEOMODS 1742de962bdSlukemRC=$? 1752de962bdSlukemcase $RC in 1762de962bdSlukem0) 1772de962bdSlukem echo "ldapadd should have failed ($RC)!" 1782de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1792de962bdSlukem exit -1 1802de962bdSlukem ;; 1812de962bdSlukem19) 1822de962bdSlukem echo "ldapadd failed ($RC)" 1832de962bdSlukem ;; 1842de962bdSlukem*) 1852de962bdSlukem echo "ldapadd failed ($RC)!" 1862de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1872de962bdSlukem exit $RC 1882de962bdSlukem ;; 1892de962bdSlukemesac 1902de962bdSlukem 1912de962bdSlukemecho "Turning a static into a dynamic entry (should fail)..." 192*e670fd5cSchristos$LDAPMODIFY -D $MANAGERDN -w $PASSWD -H $URI1 \ 1932de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 1942de962bdSlukemdn: ou=People,dc=example,dc=com 1952de962bdSlukemchangetype: modify 1962de962bdSlukemadd: objectClass 1972de962bdSlukemobjectClass: dynamicObject 1982de962bdSlukemEOMODS 1992de962bdSlukemRC=$? 2002de962bdSlukemcase $RC in 2012de962bdSlukem0) 2022de962bdSlukem echo "ldapmodify should have failed ($RC)!" 2032de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 2042de962bdSlukem exit -1 2052de962bdSlukem ;; 2062de962bdSlukem65) 2072de962bdSlukem echo "ldapmodify failed ($RC)" 2082de962bdSlukem ;; 2092de962bdSlukem*) 2102de962bdSlukem echo "ldapmodify failed ($RC)!" 2112de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 2122de962bdSlukem exit $RC 2132de962bdSlukem ;; 2142de962bdSlukemesac 2152de962bdSlukem 2162de962bdSlukemecho "Turning a dynamic into a static entry (should fail)..." 217*e670fd5cSchristos$LDAPMODIFY -D $MANAGERDN -w $PASSWD -H $URI1 \ 2182de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 2192de962bdSlukemdn: cn=Dynamic Object,dc=example,dc=com 2202de962bdSlukemchangetype: modify 2212de962bdSlukemdelete: objectClass 2222de962bdSlukemobjectClass: dynamicObject 2232de962bdSlukemEOMODS 2242de962bdSlukemRC=$? 2252de962bdSlukemcase $RC in 2262de962bdSlukem0) 2272de962bdSlukem echo "ldapmodify should have failed ($RC)!" 2282de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 2292de962bdSlukem exit -1 2302de962bdSlukem ;; 2312de962bdSlukem65) 2322de962bdSlukem echo "ldapmodify failed ($RC)" 2332de962bdSlukem ;; 2342de962bdSlukem*) 2352de962bdSlukem echo "ldapmodify failed ($RC)!" 2362de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 2372de962bdSlukem exit $RC 2382de962bdSlukem ;; 2392de962bdSlukemesac 2402de962bdSlukem 2412de962bdSlukemecho "Renaming a dynamic entry..." 242*e670fd5cSchristos$LDAPMODIFY -D $MANAGERDN -w $PASSWD -H $URI1 \ 2432de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 2442de962bdSlukemdn: cn=Subordinate Dynamic Object,cn=Dynamic Object,dc=example,dc=com 2452de962bdSlukemchangetype: modrdn 2462de962bdSlukemnewrdn: cn=Renamed Dynamic Object 2472de962bdSlukemdeleteoldrdn: 1 2482de962bdSlukemEOMODS 2492de962bdSlukemRC=$? 2502de962bdSlukemif test $RC != 0 ; then 2512de962bdSlukem echo "ldapmodrdn failed ($RC)!" 2522de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 2532de962bdSlukem exit $RC 2542de962bdSlukemfi 2552de962bdSlukem 2562de962bdSlukemSEARCH=`expr $SEARCH + 1` 2574e27b3e8Schristossleep $SLEEP0 2582de962bdSlukemecho "# [$SEARCH] Searching the dynamic portion of the database..." >> $SEARCHOUT 259*e670fd5cSchristos$LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \ 2602de962bdSlukem '(objectClass=dynamicObject)' '*' entryTtl \ 2612de962bdSlukem >> $SEARCHOUT 2>&1 2622de962bdSlukemRC=$? 2632de962bdSlukemif test $RC != 0 ; then 2642de962bdSlukem echo "ldapsearch failed ($RC)!" 2652de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 2662de962bdSlukem exit $RC 2672de962bdSlukemfi 2682de962bdSlukem 2692de962bdSlukemecho "Refreshing the initial dynamic entry to make it expire earlier than the subordinate..." 270*e670fd5cSchristos$LDAPEXOP -D $MANAGERDN -w $PASSWD -H $URI1 \ 2712de962bdSlukem "refresh" "cn=Dynamic Object,dc=example,dc=com" "1" \ 2722de962bdSlukem >> $TESTOUT 2>&1 2732de962bdSlukemRC=$? 2742de962bdSlukemif test $RC != 0 ; then 2752de962bdSlukem echo "ldapexop failed ($RC)!" 2762de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 2772de962bdSlukem exit $RC 2782de962bdSlukemfi 2792de962bdSlukem 2802de962bdSlukemSLEEP=10 2812de962bdSlukemecho "Waiting $SLEEP seconds to force a subordinate/superior expiration conflict..." 2822de962bdSlukemsleep $SLEEP 2832de962bdSlukem 2842de962bdSlukemecho "Re-vitalizing the initial dynamic entry..." 285*e670fd5cSchristos$LDAPEXOP -D $MANAGERDN -w $PASSWD -H $URI1 \ 2862de962bdSlukem "refresh" "cn=Dynamic Object,dc=example,dc=com" "120" \ 2872de962bdSlukem >> $TESTOUT 2>&1 2882de962bdSlukemRC=$? 2892de962bdSlukemif test $RC != 0 ; then 2902de962bdSlukem echo "ldapexop failed ($RC)!" 2912de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 2922de962bdSlukem exit $RC 2932de962bdSlukemfi 2942de962bdSlukem 2952de962bdSlukemecho "Re-renaming the subordinate dynamic entry (new superior)..." 296*e670fd5cSchristos$LDAPMODIFY -D $MANAGERDN -w $PASSWD -H $URI1 \ 2972de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 2982de962bdSlukemdn: cn=Renamed Dynamic Object,cn=Dynamic Object,dc=example,dc=com 2992de962bdSlukemchangetype: modrdn 3002de962bdSlukemnewrdn: cn=Renamed Dynamic Object 3012de962bdSlukemdeleteoldrdn: 1 3022de962bdSlukemnewsuperior: dc=example,dc=com 3032de962bdSlukemEOMODS 3042de962bdSlukemRC=$? 3052de962bdSlukemif test $RC != 0 ; then 3062de962bdSlukem echo "ldapmodrdn failed ($RC)!" 3072de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 3082de962bdSlukem exit $RC 3092de962bdSlukemfi 3102de962bdSlukem 3112de962bdSlukemSEARCH=`expr $SEARCH + 1` 3124e27b3e8Schristossleep $SLEEP0 3132de962bdSlukemecho "# [$SEARCH] Searching the dynamic portion of the database..." >> $SEARCHOUT 314*e670fd5cSchristos$LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \ 3152de962bdSlukem '(objectClass=dynamicObject)' '*' entryTtl \ 3162de962bdSlukem >> $SEARCHOUT 2>&1 3172de962bdSlukemRC=$? 3182de962bdSlukemif test $RC != 0 ; then 3192de962bdSlukem echo "ldapsearch failed ($RC)!" 3202de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 3212de962bdSlukem exit $RC 3222de962bdSlukemfi 3232de962bdSlukem 3242de962bdSlukemecho "Deleting a dynamic entry..." 325*e670fd5cSchristos$LDAPMODIFY -D $MANAGERDN -w $PASSWD -H $URI1 \ 3262de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 3272de962bdSlukemdn: cn=Dynamic Object,dc=example,dc=com 3282de962bdSlukemchangetype: delete 3292de962bdSlukemEOMODS 3302de962bdSlukemRC=$? 3312de962bdSlukemif test $RC != 0 ; then 3322de962bdSlukem echo "ldapdelete failed ($RC)!" 3332de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 3342de962bdSlukem exit $RC 3352de962bdSlukemfi 3362de962bdSlukem 3372de962bdSlukemSEARCH=`expr $SEARCH + 1` 3384e27b3e8Schristossleep $SLEEP0 3392de962bdSlukemecho "# [$SEARCH] Searching the dynamic portion of the database..." >> $SEARCHOUT 340*e670fd5cSchristos$LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \ 3412de962bdSlukem '(objectClass=dynamicObject)' '*' entryTtl \ 3422de962bdSlukem >> $SEARCHOUT 2>&1 3432de962bdSlukemRC=$? 3442de962bdSlukemif test $RC != 0 ; then 3452de962bdSlukem echo "ldapsearch failed ($RC)!" 3462de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 3472de962bdSlukem exit $RC 3482de962bdSlukemfi 3492de962bdSlukem 3502de962bdSlukemecho "Refreshing the remaining dynamic entry..." 351*e670fd5cSchristos$LDAPEXOP -D $MANAGERDN -w $PASSWD -H $URI1 \ 3522de962bdSlukem "refresh" "cn=Renamed Dynamic Object,dc=example,dc=com" "1" \ 3532de962bdSlukem >> $TESTOUT 2>&1 3542de962bdSlukemRC=$? 3552de962bdSlukemif test $RC != 0 ; then 3562de962bdSlukem echo "ldapexop failed ($RC)!" 3572de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 3582de962bdSlukem exit $RC 3592de962bdSlukemfi 3602de962bdSlukem 3612de962bdSlukemSEARCH=`expr $SEARCH + 1` 3624e27b3e8Schristossleep $SLEEP0 3632de962bdSlukemecho "# [$SEARCH] Searching the dynamic portion of the database..." >> $SEARCHOUT 364*e670fd5cSchristos$LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \ 3652de962bdSlukem '(objectClass=dynamicObject)' '*' entryTtl \ 3662de962bdSlukem >> $SEARCHOUT 2>&1 3672de962bdSlukemRC=$? 3682de962bdSlukemif test $RC != 0 ; then 3692de962bdSlukem echo "ldapsearch failed ($RC)!" 3702de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 3712de962bdSlukem exit $RC 3722de962bdSlukemfi 3732de962bdSlukem 3742de962bdSlukemSLEEP=15 3752de962bdSlukemecho "Waiting $SLEEP seconds for remaining entry to expire..." 3762de962bdSlukemsleep $SLEEP 3772de962bdSlukem 3782de962bdSlukemSEARCH=`expr $SEARCH + 1` 3794e27b3e8Schristossleep $SLEEP0 3802de962bdSlukemecho "# [$SEARCH] Searching the dynamic portion of the database..." >> $SEARCHOUT 381*e670fd5cSchristos$LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \ 3822de962bdSlukem '(objectClass=dynamicObject)' '*' entryTtl \ 3832de962bdSlukem >> $SEARCHOUT 2>&1 3842de962bdSlukemRC=$? 3852de962bdSlukemif test $RC != 0 ; then 3862de962bdSlukem echo "ldapsearch failed ($RC)!" 3872de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 3882de962bdSlukem exit $RC 3892de962bdSlukemfi 3902de962bdSlukem 3912de962bdSlukem# Meeting 3922de962bdSlukemMEETINGDN="cn=Meeting,ou=Groups,dc=example,dc=com" 3932de962bdSlukemecho "Creating a meeting as $BJORNSDN..." 394*e670fd5cSchristos$LDAPMODIFY -D "$BJORNSDN" -w bjorn -H $URI1 \ 3952de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 3962de962bdSlukemdn: $MEETINGDN 3972de962bdSlukemchangetype: add 3982de962bdSlukemobjectClass: groupOfNames 3992de962bdSlukemobjectClass: dynamicObject 4002de962bdSlukemcn: Meeting 4012de962bdSlukemmember: $BJORNSDN 4022de962bdSlukem 4032de962bdSlukemdn: $MEETINGDN 4042de962bdSlukemchangetype: modify 4052de962bdSlukemadd: member 4064e6df137Slukemmember: $JOHNDDN 4072de962bdSlukemEOMODS 4082de962bdSlukemRC=$? 4092de962bdSlukemif test $RC != 0 ; then 4102de962bdSlukem echo "ldapmodify failed ($RC)!" 4112de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 4122de962bdSlukem exit $RC 4132de962bdSlukemfi 4142de962bdSlukem 4152de962bdSlukemecho "Refreshing the meeting as $BJORNSDN..." 416*e670fd5cSchristos$LDAPEXOP -D "$BJORNSDN" -w bjorn -H $URI1 \ 4172de962bdSlukem "refresh" "$MEETINGDN" "120" \ 4182de962bdSlukem >> $TESTOUT 2>&1 4192de962bdSlukemRC=$? 4202de962bdSlukemif test $RC != 0 ; then 4212de962bdSlukem echo "ldapexop failed ($RC)!" 4222de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 4232de962bdSlukem exit $RC 4242de962bdSlukemfi 4252de962bdSlukem 4262de962bdSlukemecho "Joining the meeting as $BABSDN..." 427*e670fd5cSchristos$LDAPMODIFY -D "$BABSDN" -w bjensen -H $URI1 \ 4282de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 4292de962bdSlukemdn: $MEETINGDN 4302de962bdSlukemchangetype: modify 4312de962bdSlukemadd: member 4322de962bdSlukemmember: $BABSDN 4332de962bdSlukemEOMODS 4342de962bdSlukemRC=$? 4352de962bdSlukemif test $RC != 0 ; then 4362de962bdSlukem echo "ldapmodify failed ($RC)!" 4372de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 4382de962bdSlukem exit $RC 4392de962bdSlukemfi 4402de962bdSlukem 4412de962bdSlukemecho "Trying to add a member as $BABSDN (should fail)..." 442*e670fd5cSchristos$LDAPMODIFY -D "$BABSDN" -w bjensen -H $URI1 \ 4432de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 4442de962bdSlukemdn: $MEETINGDN 4452de962bdSlukemchangetype: modify 4462de962bdSlukemadd: member 4472de962bdSlukemmember: $MELLIOTDN 4482de962bdSlukemEOMODS 4492de962bdSlukemRC=$? 4502de962bdSlukemcase $RC in 4512de962bdSlukem0) 4522de962bdSlukem echo "ldapmodify should have failed ($RC)!" 4532de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 454ef2f90d3Sadam exit -1 4552de962bdSlukem ;; 4562de962bdSlukem50) 4572de962bdSlukem echo "ldapmodify failed ($RC)" 4582de962bdSlukem ;; 4592de962bdSlukem*) 4602de962bdSlukem echo "ldapmodify failed ($RC)!" 4612de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 4622de962bdSlukem exit $RC 4632de962bdSlukem ;; 4642de962bdSlukemesac 4652de962bdSlukem 4662de962bdSlukemecho "Refreshing the meeting as $BABSDN..." 467*e670fd5cSchristos$LDAPEXOP -D "$BABSDN" -w bjensen -H $URI1 \ 4682de962bdSlukem "refresh" "$MEETINGDN" "180" \ 4692de962bdSlukem >> $TESTOUT 2>&1 4702de962bdSlukemRC=$? 4712de962bdSlukemif test $RC != 0 ; then 4722de962bdSlukem echo "ldapexop failed ($RC)!" 4732de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 4742de962bdSlukem exit $RC 4752de962bdSlukemfi 4762de962bdSlukem 4772de962bdSlukemecho "Trying to refresh the meeting anonymously (should fail)..." 478*e670fd5cSchristos$LDAPEXOP -H $URI1 \ 4792de962bdSlukem "refresh" "$MEETINGDN" "240" \ 4802de962bdSlukem >> $TESTOUT 2>&1 4812de962bdSlukemRC=$? 4822de962bdSlukemif test $RC = 0 ; then 4832de962bdSlukem echo "ldapexop should have failed ($RC)!" 4842de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 485ef2f90d3Sadam exit -1 4862de962bdSlukemfi 4872de962bdSlukem 4884e6df137Slukemecho "Trying to refresh the meeting as $JAJDN (should fail)..." 489*e670fd5cSchristos$LDAPEXOP -D "$JAJDN" -w "jaj" -H $URI1 \ 4904e6df137Slukem "refresh" "$MEETINGDN" "240" \ 4914e6df137Slukem >> $TESTOUT 2>&1 4924e6df137SlukemRC=$? 4934e6df137Slukemif test $RC = 0 ; then 4944e6df137Slukem echo "ldapexop should have failed ($RC)!" 4954e6df137Slukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 496ef2f90d3Sadam exit -1 4974e6df137Slukemfi 4984e6df137Slukem 4992de962bdSlukemecho "Trying to delete the meeting as $BABSDN (should fail)..." 500*e670fd5cSchristos$LDAPMODIFY -D "$BABSDN" -w bjensen -H $URI1 \ 5012de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 5022de962bdSlukemdn: $MEETINGDN 5032de962bdSlukemchangetype: delete 5042de962bdSlukemEOMODS 5052de962bdSlukemRC=$? 5062de962bdSlukemcase $RC in 5072de962bdSlukem0) 5082de962bdSlukem echo "ldapdelete should have failed ($RC)!" 5092de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 510ef2f90d3Sadam exit -1 5112de962bdSlukem ;; 5122de962bdSlukem50) 5132de962bdSlukem echo "ldapdelete failed ($RC)" 5142de962bdSlukem ;; 5152de962bdSlukem*) 5162de962bdSlukem echo "ldapdelete failed ($RC)!" 5172de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 5182de962bdSlukem exit $RC 5192de962bdSlukem ;; 5202de962bdSlukemesac 5212de962bdSlukem 5222de962bdSlukemecho "Deleting the meeting as $BJORNSDN..." 523*e670fd5cSchristos$LDAPMODIFY -D "$BJORNSDN" -w bjorn -H $URI1 \ 5242de962bdSlukem >> $TESTOUT 2>&1 << EOMODS 5252de962bdSlukemdn: $MEETINGDN 5262de962bdSlukemchangetype: delete 5272de962bdSlukemEOMODS 5282de962bdSlukemRC=$? 5292de962bdSlukemif test $RC != 0 ; then 5302de962bdSlukem echo "ldapdelete failed ($RC)!" 5312de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 5322de962bdSlukem exit $RC 5332de962bdSlukemfi 5342de962bdSlukem 5352de962bdSlukemtest $KILLSERVERS != no && kill -HUP $KILLPIDS 5362de962bdSlukem 5372de962bdSlukemLDIF=$DDSOUT 5382de962bdSlukem 5394e27b3e8Schristos# dds removes entryTtl and re-adds it, changing the order of attributes 5402de962bdSlukemecho "Filtering ldapsearch results..." 5414e27b3e8Schristos$LDIFFILTER -s a < $SEARCHOUT > $SEARCHFLT 5424e27b3e8Schristosgrep -i -v -e '^entryttl: ' < $SEARCHFLT > $SEARCHFLT2 5432de962bdSlukemecho "Filtering original ldif used to create database..." 5444e27b3e8Schristos$LDIFFILTER -s a < $LDIF > $LDIFFLT 5454e27b3e8Schristosgrep -i -v -e '^entryttl: ' < $LDIFFLT > $LDIFFLT2 5462de962bdSlukemecho "Comparing filter output..." 5474e27b3e8Schristos$CMP $SEARCHFLT2 $LDIFFLT2 > $CMPOUT 5482de962bdSlukem 5492de962bdSlukemif test $? != 0 ; then 5502de962bdSlukem echo "Comparison failed" 5512de962bdSlukem exit 1 5522de962bdSlukemfi 5532de962bdSlukem 5544e27b3e8Schristosecho "Listing entryTtl values from ldapsearch results..." 5554e27b3e8Schristosgrep -i -e '^entryttl: ' < $SEARCHFLT | awk '{ print $2 }' > $SEARCHFLT2 5564e27b3e8Schristosecho "Listing entryTtl values from original ldif used to create database..." 5574e27b3e8Schristosgrep -i -e '^entryttl: ' < $LDIFFLT | awk '{ print $2 }' > $LDIFFLT2 5584e27b3e8Schristos 5594e27b3e8Schristosif ! type paste >/dev/null 2>&1; then 5604e27b3e8Schristos echo "Cannot find 'paste' command, skipping entryTtl checks..." 5614e27b3e8Schristoselse 5624e27b3e8Schristos echo "Checking entryTtl appears to decrease with time..." 5634e27b3e8Schristos paste $SEARCHFLT2 $LDIFFLT2 | while read resultTTL savedTTL; do 5644e27b3e8Schristos if [ `expr $savedTTL - $resultTTL` -lt $SLEEP0 ]; then 5654e27b3e8Schristos echo "TTL has not reduced accordingly" 5664e27b3e8Schristos exit 1 5674e27b3e8Schristos fi 5684e27b3e8Schristos done 5694e27b3e8Schristosfi 5704e27b3e8Schristos 5712de962bdSlukemecho ">>>>> Test succeeded" 5722de962bdSlukem 5732de962bdSlukemtest $KILLSERVERS != no && wait 5742de962bdSlukem 5752de962bdSlukemexit 0 576