From 93fe70d6c7237304e7a4b31373a3a24350216f31 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Mon, 29 Sep 2008 21:51:06 +0000 Subject: [PATCH] add tests specific to mapped attrs (ITS#5717) --- tests/data/dynlist.out | 77 +++++++++++++++++++++++ tests/scripts/test044-dynlist | 111 ++++++++++++++++++++++++++++++++++ 2 files changed, 188 insertions(+) diff --git a/tests/data/dynlist.out b/tests/data/dynlist.out index 370a5dafeb..429039b671 100644 --- a/tests/data/dynlist.out +++ b/tests/data/dynlist.out @@ -71,6 +71,83 @@ UNDEFINED # Testing list compare with manageDSAit... FALSE +# Testing list search of all (mapped) attrs... +dn: cn=Dynamic List,ou=Dynamic Lists,dc=example,dc=com +objectClass: groupOfURLs +cn: Dynamic List +memberURL: ldap:///ou=People,dc=example,dc=com?cn,mail?sub?(objectClass=person + ) +sn: Barbara Jensen +sn: Babs Jensen +sn: Bjorn Jensen +sn: Biiff Jensen +sn: Dorothy Stevens +sn: Dot Stevens +sn: James A Jones 1 +sn: James Jones +sn: Jim Jones +sn: James A Jones 2 +sn: Jane Doe +sn: Jane Alverson +sn: Jennifer Smith +sn: Jen Smith +sn: John Doe +sn: Jonathon Doe +sn: Mark Elliot +sn: Mark A Elliot +sn: Ursula Hampster +mail: bjensen@mailgw.example.com +mail: bjorn@mailgw.example.com +mail: dots@mail.alumni.example.com +mail: jaj@mail.alumni.example.com +mail: jjones@mailgw.example.com +mail: jdoe@woof.net +mail: jen@mail.alumni.example.com +mail: johnd@mailgw.example.com +mail: melliot@mail.alumni.example.com +mail: uham@mail.alumni.example.com + +# Testing list search of a (mapped) listed attr... +dn: cn=Dynamic List,ou=Dynamic Lists,dc=example,dc=com +sn: Barbara Jensen +sn: Babs Jensen +sn: Bjorn Jensen +sn: Biiff Jensen +sn: Dorothy Stevens +sn: Dot Stevens +sn: James A Jones 1 +sn: James Jones +sn: Jim Jones +sn: James A Jones 2 +sn: Jane Doe +sn: Jane Alverson +sn: Jennifer Smith +sn: Jen Smith +sn: John Doe +sn: Jonathon Doe +sn: Mark Elliot +sn: Mark A Elliot +sn: Ursula Hampster + +# Testing list search of a (n unmapped) listed attr... +dn: cn=Dynamic List,ou=Dynamic Lists,dc=example,dc=com +mail: bjensen@mailgw.example.com +mail: bjorn@mailgw.example.com +mail: dots@mail.alumni.example.com +mail: jaj@mail.alumni.example.com +mail: jjones@mailgw.example.com +mail: jdoe@woof.net +mail: jen@mail.alumni.example.com +mail: johnd@mailgw.example.com +mail: melliot@mail.alumni.example.com +mail: uham@mail.alumni.example.com + +# Testing list compare (mapped attrs) ... +TRUE + +# Testing list compare (mapped attrs; should return FALSE)... +FALSE + # Testing list search of all attrs... dn: cn=Dynamic List of Members,ou=Dynamic Lists,dc=example,dc=com objectClass: groupOfURLs diff --git a/tests/scripts/test044-dynlist b/tests/scripts/test044-dynlist index e0bb527409..3311731f00 100755 --- a/tests/scripts/test044-dynlist +++ b/tests/scripts/test044-dynlist @@ -244,6 +244,116 @@ case $RC in esac echo "" >> $SEARCHOUT +echo "Reconfiguring slapd..." +$LDAPMODIFY -x -D cn=config -h $LOCALHOST -p $PORT1 -y $CONFIGPWF > \ + $TESTOUT 2>&1 << EOMODS +version: 1 +dn: olcOverlay={0}dynlist,olcDatabase={2}$BACKEND,cn=config +changetype: modify +delete: olcDLattrSet +olcDLattrSet: {0} +- +add: olcDLattrSet +olcDLattrSet: groupOfURLs memberURL sn:cn mail +- +EOMODS + +echo "==========================================================" >> $LOG1 + +echo "Testing attribute mapping" + +echo "Testing list search of all (mapped) attrs..." +echo "# Testing list search of all (mapped) attrs..." >> $SEARCHOUT +$LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \ + '(cn=Dynamic List)' '*' \ + >> $SEARCHOUT 2>&1 +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Testing list search of a (mapped) listed attr..." +echo "# Testing list search of a (mapped) listed attr..." >> $SEARCHOUT +$LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \ + '(cn=Dynamic List)' sn \ + >> $SEARCHOUT 2>&1 +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Testing list search of a (n unmapped) listed attr..." +echo "# Testing list search of a (n unmapped) listed attr..." >> $SEARCHOUT +$LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \ + '(cn=Dynamic List)' mail \ + >> $SEARCHOUT 2>&1 +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Testing list compare (mapped attrs) ..." +echo "# Testing list compare (mapped attrs) ..." >> $SEARCHOUT +$LDAPCOMPARE -h $LOCALHOST -p $PORT1 \ + "cn=Dynamic List,$LISTDN" "sn:Bjorn Jensen" \ + >> $SEARCHOUT 2>&1 +RC=$? +case $RC in +5) + echo "ldapcompare returned FALSE ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +6) + echo "ldapcompare returned TRUE ($RC)" + ;; +0) + echo "ldapcompare returned success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit -1 + ;; +*) + echo "ldapcompare failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac +echo "" >> $SEARCHOUT + +echo "Testing list compare (mapped attrs; should return FALSE)..." +echo "# Testing list compare (mapped attrs; should return FALSE)..." >> $SEARCHOUT +$LDAPCOMPARE -h $LOCALHOST -p $PORT1 \ + "cn=Dynamic List,$LISTDN" "sn:FALSE" \ + >> $SEARCHOUT 2>&1 +RC=$? +case $RC in +5) + echo "ldapcompare returned FALSE ($RC)" + ;; +6) + echo "ldapcompare returned TRUE ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +0) + echo "ldapcompare returned success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit -1 + ;; +*) + echo "ldapcompare failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac +echo "" >> $SEARCHOUT + echo "Reconfiguring slapd..." $LDAPMODIFY -x -D cn=config -h $LOCALHOST -p $PORT1 -y $CONFIGPWF > \ $TESTOUT 2>&1 << EOMODS @@ -255,6 +365,7 @@ olcDLattrSet: {0} - add: olcDLattrSet olcDLattrSet: groupOfURLs memberURL member +- EOMODS echo "==========================================================" >> $LOG1 -- 2.39.5