From 73bf45060013be27881a529eb39f6543956f9e93 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 18 Jan 2005 01:02:34 +0000 Subject: [PATCH] strengthen the tests --- tests/data/slapd-sql.conf | 4 + tests/data/sql-read.out | 64 +++++- tests/data/sql-write.out | 376 ++++++++++++++++++++++++++++++++ tests/scripts/sql-test000-read | 11 + tests/scripts/sql-test900-write | 250 +++++++++++++++++++-- 5 files changed, 679 insertions(+), 26 deletions(-) diff --git a/tests/data/slapd-sql.conf b/tests/data/slapd-sql.conf index 2c0a29a523..35a474225c 100644 --- a/tests/data/slapd-sql.conf +++ b/tests/data/slapd-sql.conf @@ -39,6 +39,10 @@ access to attr=userpassword access to * by * read +# FIXME: this is required to work with referrals the old way; +# the new way requires to map referrals in ldap_oc_mappings on their own +schemacheck off + ####################################################################### # sql database definitions ####################################################################### diff --git a/tests/data/sql-read.out b/tests/data/sql-read.out index e1240ca268..33a5f24b65 100644 --- a/tests/data/sql-read.out +++ b/tests/data/sql-read.out @@ -39,7 +39,7 @@ seeAlso: documentTitle=book1,dc=example,dc=com givenName: Torvlobnor telephoneNumber: 545-4563 -# refldap://localhost/dc=example,dc=com??one +# refldap://localhost:9010/dc=example,dc=com??one # Testing subtree search... dn: documentTitle=book1,dc=example,dc=com @@ -81,7 +81,55 @@ seeAlso: documentTitle=book1,dc=example,dc=com givenName: Torvlobnor telephoneNumber: 545-4563 -# refldap://localhost/dc=example,dc=com??sub +# refldap://localhost:9010/dc=example,dc=com??sub + +# Testing subtree search with manageDSAit... +dn: documentTitle=book1,dc=example,dc=com +objectClass: document +description: abstract1 +documentTitle: book1 +documentAuthor: cn=Mitya Kovalev,dc=example,dc=com +documentAuthor: cn=Torvlobnor Puzdoy,dc=example,dc=com +documentIdentifier: document 1 + +dn: documentTitle=book2,dc=example,dc=com +objectClass: document +description: abstract2 +documentTitle: book2 +documentAuthor: cn=Mitya Kovalev,dc=example,dc=com +documentIdentifier: document 2 + +dn: dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: Example +dc: example + +dn: cn=Mitya Kovalev,dc=example,dc=com +objectClass: inetOrgPerson +cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=book1,dc=example,dc=com +seeAlso: documentTitle=book2,dc=example,dc=com +givenName: Mitya +telephoneNumber: 222-3234 +telephoneNumber: 332-2334 + +dn: cn=Torvlobnor Puzdoy,dc=example,dc=com +objectClass: inetOrgPerson +cn: Torvlobnor Puzdoy +sn: Puzdoy +seeAlso: documentTitle=book1,dc=example,dc=com +givenName: Torvlobnor +telephoneNumber: 545-4563 + +dn: cn=Akakiy Zinberstein,dc=example,dc=com +objectClass: inetOrgPerson +objectClass: referral +cn: Akakiy Zinberstein +sn: Zinberstein +ref: ldap://localhost:9010/ +givenName: Akakiy # Testing invalid filter... # Testing exact search... @@ -221,7 +269,7 @@ seeAlso: documentTitle=book1,dc=example,dc=com givenName: Torvlobnor telephoneNumber: 545-4563 -# refldap://localhost/dc=example,dc=com??sub +# refldap://localhost:9010/dc=example,dc=com??sub # Testing NOT search on objectClass... dn: documentTitle=book1,dc=example,dc=com @@ -279,7 +327,7 @@ seeAlso: documentTitle=book1,dc=example,dc=com givenName: Torvlobnor telephoneNumber: 545-4563 -# refldap://localhost/dc=example,dc=com??sub +# refldap://localhost:9010/dc=example,dc=com??sub # Testing attribute inheritance in filter... dn: dc=example,dc=com @@ -307,7 +355,7 @@ seeAlso: documentTitle=book1,dc=example,dc=com givenName: Torvlobnor telephoneNumber: 545-4563 -# refldap://localhost/dc=example,dc=com??sub +# refldap://localhost:9010/dc=example,dc=com??sub # Testing "auxiliary" objectClass in filter... dn: dc=example,dc=com @@ -323,7 +371,7 @@ objectClass: dcObject o: Example dc: example -# refldap://localhost/dc=example,dc=com??sub +# refldap://localhost:9010/dc=example,dc=com??sub # Testing entryUUID in filter... dn: cn=Mitya Kovalev,dc=example,dc=com @@ -359,7 +407,7 @@ objectClass: inetOrgPerson dn: cn=Torvlobnor Puzdoy,dc=example,dc=com objectClass: inetOrgPerson -# refldap://localhost/dc=example,dc=com??sub +# refldap://localhost:9010/dc=example,dc=com??sub # Testing operational attributes in request... dn: documentTitle=book1,dc=example,dc=com @@ -397,5 +445,5 @@ subschemaSubentry: cn=Subschema hasSubordinates: FALSE entryUUID: 00000001-0000-0002-0000-000000000000 -# refldap://localhost/dc=example,dc=com??sub +# refldap://localhost:9010/dc=example,dc=com??sub diff --git a/tests/data/sql-write.out b/tests/data/sql-write.out index 3e89e3fb15..a45eac4437 100644 --- a/tests/data/sql-write.out +++ b/tests/data/sql-write.out @@ -1,3 +1,379 @@ +# Using ldapsearch to retrieve all the entries... +dn: documentTitle=book1,dc=example,dc=com +objectClass: document +description: abstract1 +documentTitle: book1 +documentAuthor: cn=Mitya Kovalev,dc=example,dc=com +documentAuthor: cn=Torvlobnor Puzdoy,dc=example,dc=com +documentIdentifier: document 1 + +dn: documentTitle=book2,dc=example,dc=com +objectClass: document +description: abstract2 +documentTitle: book2 +documentAuthor: cn=Mitya Kovalev,dc=example,dc=com +documentIdentifier: document 2 + +dn: dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: Example +dc: example + +dn: cn=Mitya Kovalev,dc=example,dc=com +objectClass: inetOrgPerson +cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=book1,dc=example,dc=com +seeAlso: documentTitle=book2,dc=example,dc=com +givenName: Mitya +telephoneNumber: 222-3234 +telephoneNumber: 332-2334 + +dn: cn=Torvlobnor Puzdoy,dc=example,dc=com +objectClass: inetOrgPerson +cn: Torvlobnor Puzdoy +sn: Puzdoy +seeAlso: documentTitle=book1,dc=example,dc=com +givenName: Torvlobnor +telephoneNumber: 545-4563 + +# refldap://localhost:9010/dc=example,dc=com??sub + +# Using ldapsearch to retrieve all the entries... +dn: o=An Org,dc=example,dc=com +objectClass: organization +o: An Org + +dn: documentTitle=book1,dc=example,dc=com +objectClass: document +description: abstract1 +documentTitle: book1 +documentAuthor: cn=Mitya Kovalev,dc=example,dc=com +documentAuthor: cn=Torvlobnor Puzdoy,dc=example,dc=com +documentIdentifier: document 1 + +dn: documentTitle=book2,dc=example,dc=com +objectClass: document +description: abstract2 +documentTitle: book2 +documentAuthor: cn=Mitya Kovalev,dc=example,dc=com +documentIdentifier: document 2 + +dn: dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: Example +dc: example + +dn: cn=Lev Tolstoij,dc=example,dc=com +objectClass: inetOrgPerson +cn: Lev Tolstoij +sn: Tolstoij +seeAlso: documentTitle=War and Peace,dc=example,dc=com +givenName: Lev +telephoneNumber: +39 02 XXXX YYYY +telephoneNumber: +39 02 XXXX ZZZZ + +dn: cn=Mitya Kovalev,dc=example,dc=com +objectClass: inetOrgPerson +cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=book1,dc=example,dc=com +seeAlso: documentTitle=book2,dc=example,dc=com +givenName: Mitya +telephoneNumber: 222-3234 +telephoneNumber: 332-2334 + +dn: cn=Some One,dc=example,dc=com +objectClass: inetOrgPerson +objectClass: simpleSecurityObject +cn: Some One +sn: One +givenName: Some +telephoneNumber: +1 800 900 1234 +telephoneNumber: +1 800 900 1235 + +dn: dc=subnet,dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: SubNet +dc: subnet + +dn: cn=SubNet User,dc=subnet,dc=example,dc=com +objectClass: inetOrgPerson +cn: SubNet User +sn: User +givenName: SubNet + +dn: dc=subnet2,dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: SubNet 2 +dc: subnet 2 + +dn: cn=Torvlobnor Puzdoy,dc=example,dc=com +objectClass: inetOrgPerson +cn: Torvlobnor Puzdoy +sn: Puzdoy +seeAlso: documentTitle=book1,dc=example,dc=com +givenName: Torvlobnor +telephoneNumber: 545-4563 + +dn: documentTitle=War and Peace,dc=example,dc=com +objectClass: document +description: Historical novel +documentTitle: War and Peace +documentAuthor: cn=Lev Tolstoij,dc=example,dc=com +documentIdentifier: document 3 + +# refldap://localhost:9010/dc=example,dc=com??sub + +# Using ldapsearch to retrieve all the entries... +dn: o=An Org,dc=example,dc=com +objectClass: organization +o: An Org + +dn: documentTitle=book1,dc=example,dc=com +objectClass: document +description: abstract1 +documentTitle: book1 +documentAuthor: cn=Lev Tolstoij,dc=example,dc=com +documentAuthor: cn=Mitya Kovalev,dc=example,dc=com +documentAuthor: cn=Torvlobnor Puzdoy,dc=example,dc=com +documentIdentifier: document 1 + +dn: documentTitle=book2,dc=example,dc=com +objectClass: document +description: abstract2 +documentTitle: book2 +documentAuthor: cn=Lev Tolstoij,dc=example,dc=com +documentAuthor: cn=Mitya Kovalev,dc=example,dc=com +documentIdentifier: document 2 + +dn: dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: Example +dc: example + +dn: cn=Lev Tolstoij,dc=example,dc=com +objectClass: inetOrgPerson +cn: Lev Tolstoij +sn: Tolstoij +seeAlso: documentTitle=book1,dc=example,dc=com +seeAlso: documentTitle=book2,dc=example,dc=com +seeAlso: documentTitle=War and Peace,dc=example,dc=com +givenName: Lev +telephoneNumber: +39 02 XXXX ZZZZ +telephoneNumber: +39 333 ZZZ 1234 + +dn: cn=Mitya Kovalev,dc=example,dc=com +objectClass: inetOrgPerson +cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=book1,dc=example,dc=com +seeAlso: documentTitle=book2,dc=example,dc=com +givenName: Mitya +telephoneNumber: +1 800 123 4567 +telephoneNumber: 222-3234 +telephoneNumber: 332-2334 + +dn: cn=Some One,dc=example,dc=com +objectClass: inetOrgPerson +objectClass: simpleSecurityObject +cn: Some One +sn: One +givenName: Some + +dn: dc=subnet,dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: SubNet +dc: subnet + +dn: cn=SubNet User,dc=subnet,dc=example,dc=com +objectClass: inetOrgPerson +cn: SubNet User +sn: User +givenName: SubNet + +dn: dc=subnet2,dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: SubNet 2 +dc: subnet 2 + +dn: cn=Torvlobnor Puzdoy,dc=example,dc=com +objectClass: inetOrgPerson +cn: Torvlobnor Puzdoy +sn: Puzdoy +seeAlso: documentTitle=book1,dc=example,dc=com +givenName: Torvlobnor +telephoneNumber: 545-4563 + +dn: documentTitle=War and Peace,dc=example,dc=com +objectClass: document +description: Historical novel +documentTitle: War and Peace +documentAuthor: cn=Lev Tolstoij,dc=example,dc=com +documentIdentifier: document 3 + +# refldap://localhost:9010/dc=example,dc=com??sub + +# Using ldapsearch to retrieve all the entries... +dn: o=An Org,dc=example,dc=com +objectClass: organization +o: An Org + +dn: documentTitle=book2,dc=example,dc=com +objectClass: document +description: abstract2 +documentTitle: book2 +documentAuthor: cn=Lev Tolstoij,dc=example,dc=com +documentAuthor: cn=Mitya Kovalev,dc=example,dc=com +documentIdentifier: document 2 + +dn: dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: Example +dc: example + +dn: cn=Lev Tolstoij,dc=example,dc=com +objectClass: inetOrgPerson +cn: Lev Tolstoij +sn: Tolstoij +seeAlso: documentTitle=book2,dc=example,dc=com +seeAlso: documentTitle=War and Peace,dc=example,dc=com +givenName: Lev +telephoneNumber: +39 02 XXXX ZZZZ +telephoneNumber: +39 333 ZZZ 1234 + +dn: cn=Mitya Kovalev,dc=example,dc=com +objectClass: inetOrgPerson +cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=book2,dc=example,dc=com +givenName: Mitya +telephoneNumber: +1 800 123 4567 +telephoneNumber: 222-3234 +telephoneNumber: 332-2334 + +dn: cn=Some One,dc=example,dc=com +objectClass: inetOrgPerson +objectClass: simpleSecurityObject +cn: Some One +sn: One +givenName: Some + +dn: dc=subnet,dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: SubNet +dc: subnet + +dn: cn=SubNet User,dc=subnet,dc=example,dc=com +objectClass: inetOrgPerson +cn: SubNet User +sn: User +givenName: SubNet + +dn: documentTitle=War and Peace,dc=example,dc=com +objectClass: document +description: Historical novel +documentTitle: War and Peace +documentAuthor: cn=Lev Tolstoij,dc=example,dc=com +documentIdentifier: document 3 + +# refldap://localhost:9010/dc=example,dc=com??sub + +# Using ldapsearch to retrieve all the entries... +dn: dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: Example +dc: example + +dn: cn=Lev Tolstoij,dc=subnet,dc=example,dc=com +objectClass: inetOrgPerson +cn: Lev Tolstoij +sn: Tolstoij +seeAlso: documentTitle=Renamed Book,dc=example,dc=com +seeAlso: documentTitle=War and Peace,dc=example,dc=com +givenName: Lev +telephoneNumber: +39 02 XXXX ZZZZ +telephoneNumber: +39 333 ZZZ 1234 + +dn: cn=Mitya Kovalev,dc=example,dc=com +objectClass: inetOrgPerson +cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=Renamed Book,dc=example,dc=com +givenName: Mitya +telephoneNumber: +1 800 123 4567 +telephoneNumber: 222-3234 +telephoneNumber: 332-2334 + +dn: documentTitle=Renamed Book,dc=example,dc=com +objectClass: document +description: abstract2 +documentTitle: Renamed Book +documentAuthor: cn=Lev Tolstoij,dc=subnet,dc=example,dc=com +documentAuthor: cn=Mitya Kovalev,dc=example,dc=com +documentIdentifier: document 2 + +dn: o=Renamed Org,dc=example,dc=com +objectClass: organization +o: Renamed Org + +dn: cn=Some One,dc=example,dc=com +objectClass: inetOrgPerson +objectClass: simpleSecurityObject +cn: Some One +sn: One +givenName: Some + +dn: dc=subnet,dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: SubNet +dc: subnet + +dn: cn=SubNet User,dc=subnet,dc=example,dc=com +objectClass: inetOrgPerson +cn: SubNet User +sn: User +givenName: SubNet + +dn: documentTitle=War and Peace,dc=example,dc=com +objectClass: document +description: Historical novel +documentTitle: War and Peace +documentAuthor: cn=Lev Tolstoij,dc=subnet,dc=example,dc=com +documentIdentifier: document 3 + +# refldap://localhost:9010/dc=example,dc=com??sub + +# Using ldapsearch to retrieve the modified entry... +dn: cn=Akakiy Zinberstein,dc=example,dc=com +objectClass: inetOrgPerson +objectClass: referral +cn: Akakiy Zinberstein +sn: Zinberstein +ref: ldap://localhost:9009/ +givenName: Akakiy + +# Using ldapsearch to retrieve the renamed entry... +dn: cn=Akakiy Zinber,dc=example,dc=com +objectClass: inetOrgPerson +objectClass: referral +cn: Akakiy Zinber +sn: Zinber +ref: ldap://localhost:9009/ +givenName: Akakiy + +# Using ldapsearch to retrieve all the entries... dn: dc=example,dc=com objectClass: organization objectClass: dcObject diff --git a/tests/scripts/sql-test000-read b/tests/scripts/sql-test000-read index 2e239cfc47..e66127444b 100755 --- a/tests/scripts/sql-test000-read +++ b/tests/scripts/sql-test000-read @@ -110,6 +110,17 @@ if test $RC != 0 ; then exit $RC fi +echo "Testing subtree search with manageDSAit..." +echo "# Testing subtree search with manageDSAit..." >> $SEARCHOUT +$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" -M '*' ref >> $SEARCHOUT 2>&1 + +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + echo "Testing invalid filter..." echo "# Testing invalid filter..." >> $SEARCHOUT $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \ diff --git a/tests/scripts/sql-test900-write b/tests/scripts/sql-test900-write index aa03171bba..c692e1e26d 100755 --- a/tests/scripts/sql-test900-write +++ b/tests/scripts/sql-test900-write @@ -61,15 +61,29 @@ if test $RC != 0 ; then exit $RC fi +cat /dev/null > $SEARCHOUT + BASEDN="dc=example,dc=com" + +echo "Using ldapsearch to retrieve all the entries..." +echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT +$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \ + "objectClass=*" >> $SEARCHOUT 2>&1 + +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + case ${RDBMS} in # list here the RDBMSes whose mapping allows writes postgres|ibmdb2) MANAGERDN="cn=Manager,${BASEDN}" echo "Testing add..." $LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \ - -h $LOCALHOST -p $PORT1 > \ - $TESTOUT 2>&1 << EOMODS + -h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS version: 1 # Adding an organization... @@ -86,6 +100,14 @@ objectClass: dcObject o: SubNet dc: subnet +# Adding another organization with an "auxiliary" objectClass.. +dn: dc=subnet2,${BASEDN} +changetype: add +objectClass: organization +objectClass: dcObject +o: SubNet 2 +dc: subnet2 + # Adding a person... dn: cn=Lev Tolstoij,${BASEDN} changetype: add @@ -125,7 +147,6 @@ description: Historical novel documentTitle: War and Peace documentAuthor: cn=Lev Tolstoij,dc=example,dc=com documentIdentifier: document 3 - EOMODS RC=$? @@ -135,10 +156,21 @@ EOMODS exit $RC fi + echo "Using ldapsearch to retrieve all the entries..." + echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT + $LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \ + "objectClass=*" >> $SEARCHOUT 2>&1 + + RC=$? + if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + echo "Testing modify..." $LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \ - -h $LOCALHOST -p $PORT1 > \ - $TESTOUT 2>&1 << EOMODS + -h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS version: 1 # Deleting all telephone numbers... @@ -197,7 +229,6 @@ dn: cn=Lev Tolstoij,${BASEDN} changetype: modify delete: userPassword - - EOMODS RC=$? @@ -207,10 +238,21 @@ EOMODS exit $RC fi + echo "Using ldapsearch to retrieve all the entries..." + echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT + $LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \ + "objectClass=*" >> $SEARCHOUT 2>&1 + + RC=$? + if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + echo "Testing delete..." $LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \ - -h $LOCALHOST -p $PORT1 -M > \ - $TESTOUT 2>&1 << EOMODS + -h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS version: 1 # Deleting a person... @@ -218,13 +260,12 @@ dn: cn=Torvlobnor Puzdoy,${BASEDN} changetype: delete # Deleting a document... -dn: documentTitle=book1,dc=example,dc=com +dn: documentTitle=book1,${BASEDN} changetype: delete -# Deleting a person with an "auxiliary" objectClass... -dn: cn=Akakiy Zinberstein,dc=example,dc=com +# Deleting an organization with an "auxiliary" objectClass... +dn: dc=subnet2,${BASEDN} changetype: delete - EOMODS RC=$? @@ -234,31 +275,203 @@ EOMODS exit $RC fi + echo "Using ldapsearch to retrieve all the entries..." + echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT + $LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \ + "objectClass=*" >> $SEARCHOUT 2>&1 + + RC=$? + if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + echo "Testing rename..." $LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \ - -h $LOCALHOST -p $PORT1 > \ - $TESTOUT 2>&1 << EOMODS + -h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS version: 1 -# Renaming an organization +# Renaming an organization... dn: o=An Org,${BASEDN} changetype: modrdn newrdn: o=Renamed Org deleteoldrdn: 1 -# Renaming a person +# Moving a person to another subtree... dn: cn=Lev Tolstoij,${BASEDN} changetype: modrdn newrdn: cn=Lev Tolstoij deleteoldrdn: 0 newsuperior: dc=subnet,${BASEDN} -# Renaming a book +# Renaming a book... dn: documentTitle=book2,${BASEDN} changetype: modrdn newrdn: documentTitle=Renamed Book deleteoldrdn: 1 +EOMODS + + RC=$? + if test $RC != 0 ; then + echo "ldapmodify failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + + echo "Using ldapsearch to retrieve all the entries..." + echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT + $LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \ + "objectClass=*" >> $SEARCHOUT 2>&1 + + RC=$? + if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + + echo "Adding a child to a referral (should fail)..." + $LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \ + -h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS +version: 1 + +dn: cn=Should Fail,cn=Akakiy Zinberstein,${BASEDN} +changetype: add +objectClass: inetOrgPerson +cn: Should Fail +sn: Fail +telephoneNumber: +39 02 23456789 +EOMODS + + RC=$? + if test $RC = 0 ; then + echo "ldapmodify should have failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + + echo "Modifying a referral (should fail)..." + $LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \ + -h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS +version: 1 + +dn: cn=Akakiy Zinberstein,${BASEDN} +changetype: modify +replace: ref +ref: ldap://localhost:9009/ +- +EOMODS + + RC=$? + if test $RC = 0 ; then + echo "ldapmodify should have failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + + echo "Renaming a referral (should fail)..." + $LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \ + -h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS +version: 1 + +dn: cn=Akakiy Zinberstein,${BASEDN} +changetype: modrdn +newrdn: cn=Akakiy Zinber +deleteoldrdn: 1 +EOMODS + + RC=$? + if test $RC = 0 ; then + echo "ldapmodify should have failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + + echo "Deleting a referral (should fail)..." + $LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \ + -h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS +version: 1 + +dn: cn=Akakiy Zinberstein,${BASEDN} +changetype: delete +EOMODS + + RC=$? + if test $RC = 0 ; then + echo "ldapmodify should have failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + + echo "Modifying a referral with manageDSAit..." + $LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \ + -h $LOCALHOST -p $PORT1 -M >> $TESTOUT 2>&1 << EOMODS +version: 1 + +dn: cn=Akakiy Zinberstein,${BASEDN} +changetype: modify +replace: ref +ref: ldap://localhost:9009/ +- +EOMODS + + RC=$? + if test $RC != 0 ; then + echo "ldapmodify failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + + echo "Using ldapsearch to retrieve the modified entry..." + echo "# Using ldapsearch to retrieve the modified entry..." >> $SEARCHOUT + $LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "cn=Akakiy Zinberstein,$BASEDN" -M \ + "objectClass=*" '*' ref >> $SEARCHOUT 2>&1 + + RC=$? + if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + + echo "Renaming a referral with manageDSAit..." + $LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \ + -h $LOCALHOST -p $PORT1 -M >> $TESTOUT 2>&1 << EOMODS +version: 1 + +dn: cn=Akakiy Zinberstein,${BASEDN} +changetype: modrdn +newrdn: cn=Akakiy Zinber +deleteoldrdn: 1 +EOMODS + + RC=$? + if test $RC != 0 ; then + echo "ldapmodify failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + + echo "Using ldapsearch to retrieve the renamed entry..." + echo "# Using ldapsearch to retrieve the renamed entry..." >> $SEARCHOUT + $LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "cn=Akakiy Zinber,$BASEDN" -M \ + "objectClass=*" '*' ref >> $SEARCHOUT 2>&1 + + RC=$? + if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + echo "Deleting a referral with manageDSAit..." + $LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \ + -h $LOCALHOST -p $PORT1 -M >> $TESTOUT 2>&1 << EOMODS +version: 1 + +dn: cn=Akakiy Zinber,${BASEDN} +changetype: delete EOMODS RC=$? @@ -304,8 +517,9 @@ EOMODS fi echo "Using ldapsearch to retrieve all the entries..." + echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT $LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \ - "objectClass=*" > $SEARCHOUT 2>&1 + "objectClass=*" >> $SEARCHOUT 2>&1 RC=$? if test $RC != 0 ; then -- 2.39.5