From 652cb0c0b2c7c41c7d8c6dac13518013373ecef2 Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount Date: Sun, 12 Dec 2010 02:28:47 +0000 Subject: [PATCH] ignore undefined attrs (ITS#6600) --- tests/data/proxycache.out | 20 ++++++++++----- tests/scripts/test020-proxycache | 42 ++++++++++++++++++++++++++------ 2 files changed, 49 insertions(+), 13 deletions(-) diff --git a/tests/data/proxycache.out b/tests/data/proxycache.out index dfffc88aad..d879fd806c 100644 --- a/tests/data/proxycache.out +++ b/tests/data/proxycache.out @@ -189,7 +189,11 @@ dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example, dc=com mail: bjensen@mailgw.example.com -# Query 10: filter:(|(cn=*Jones)(sn=Jones)) attrs:cn sn title uid +# Query 10: filter:(|(cn=All Staff)(sn=All Staff)) attrs:sn cn title uid undefinedAttr +dn: cn=All Staff,ou=Groups,dc=example,dc=com +cn: All Staff + +# Query 11: filter:(|(cn=*Jones)(sn=Jones)) attrs:cn sn title uid dn: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com cn: James A Jones 1 cn: James Jones @@ -207,7 +211,7 @@ sn: Doe uid: jjones title: Senior Manager, Information Technology Division -# Query 11: filter:(sn=Smith) attrs:cn sn title uid +# Query 12: filter:(sn=Smith) attrs:cn sn title uid dn: cn=Jennifer Smith,ou=Alumni Association,ou=People,dc=example,dc=com cn: Jennifer Smith cn: Jen Smith @@ -215,7 +219,7 @@ sn: Smith uid: jen title: Telemarketer, UM Alumni Association -# Query 12: filter:(uid=bjorn) attrs:mail postaladdress telephonenumber cn uid +# Query 13: filter:(uid=bjorn) attrs:mail postaladdress telephonenumber cn uid dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc =com cn: Bjorn Jensen @@ -225,7 +229,7 @@ postalAddress: Info Tech Division $ 535 W. William St. $ Anytown, MI 48103 mail: bjorn@mailgw.example.com telephoneNumber: +1 313 555 0355 -# Query 13: filter:(mail=jaj@mail.alumni.example.com) attrs:cn sn title uid +# Query 14: filter:(mail=jaj@mail.alumni.example.com) attrs:cn sn title uid dn: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com cn: James A Jones 1 cn: James Jones @@ -234,7 +238,7 @@ sn: Jones uid: jaj title: Mad Cow Researcher, UM Alumni Association -# Query 14: filter:(mail=*example.com) attrs:cn sn title uid +# Query 15: filter:(mail=*example.com) attrs:cn sn title uid dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example, dc=com cn: Barbara Jensen @@ -243,8 +247,12 @@ sn:: IEplbnNlbiA= uid: bjensen title: Mythical Manager, Research Systems -# Query 15: filter:(uid=b*) attrs:mail +# Query 16: filter:(uid=b*) attrs:mail dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example, dc=com mail: bjensen@mailgw.example.com +# Query 17: filter:(|(cn=All Staff)(sn=All Staff)) attrs:sn cn title uid undefinedAttr +dn: cn=All Staff,ou=Groups,dc=example,dc=com +cn: All Staff + diff --git a/tests/scripts/test020-proxycache b/tests/scripts/test020-proxycache index a0b0e25e31..02cbd0323f 100755 --- a/tests/scripts/test020-proxycache +++ b/tests/scripts/test020-proxycache @@ -295,10 +295,24 @@ case $RC in ;; esac +CNT=`expr $CNT + 1` +FILTER="(|(cn=All Staff)(sn=All Staff))" +ATTRS="sn cn title uid undefinedAttr" +echo "Query $CNT: filter:$FILTER attrs:$ATTRS" +echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT +$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \ + "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + FIRST=$CNT -# queries 2-6,8-9 are cacheable -CACHEABILITY=011111011 +# queries 2-6,8-10 are cacheable +CACHEABILITY=0111110111 grep CACHEABLE $LOG2 | awk '{ if ($2 == "NOT") printf "Query %d not cacheable\n",NR @@ -431,11 +445,25 @@ case $RC in ;; esac -#queries 10-12,15 are answerable, 13-14 are not -#actually, 12 would be answerable, but since 8 made mail=*example.com +CNT=`expr $CNT + 1` +FILTER="(|(cn=All Staff)(sn=All Staff))" +ATTRS="sn cn title uid undefinedAttr" +echo "Query $CNT: filter:$FILTER attrs:$ATTRS" +echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT +$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \ + "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +#queries 11-13,16-17 are answerable, 14-15 are not +#actually, 14 would be answerable, but since 8 made mail=*example.com #not answerable because of sizelimit, queries contained in it are no longer #answerable as well -ANSWERABILITY=111001 +ANSWERABILITY=1110011 grep ANSWERABLE $LOG2 | awk "BEGIN {FIRST=$FIRST}"'{ if (NR > FIRST) { if ($2 == "NOT") @@ -462,9 +490,9 @@ else fi echo "Filtering ldapsearch results..." -$LDIFFILTER < $SEARCHOUT > $SEARCHFLT +$LDIFFILTER -s ldif=a < $SEARCHOUT > $SEARCHFLT echo "Filtering original ldif..." -$LDIFFILTER < $PROXYCACHEOUT > $LDIFFLT +$LDIFFILTER -s ldif=a < $PROXYCACHEOUT > $LDIFFLT echo "Comparing filter output..." $CMP $SEARCHFLT $LDIFFLT > $CMPOUT -- 2.39.5