query_manager* qm,
int num )
{
- int i;
+ int i = 0;
int count = 0;
if ( attrs ) {
- for ( ; attrs[count].an_name.bv_val; count++ );
+ for ( ; attrs[i].an_name.bv_val; i++ ) {
+ /* only count valid attribute names
+ * (searches ignore others, this overlay does the same) */
+ if ( attrs[i].an_desc ) {
+ count++;
+ }
+ }
}
- /* recognize a single "*" or a "1.1" */
- if ( count == 0 ) {
+ /* recognize default or explicit single "*" */
+ if ( ! attrs ||
+ ( i == 1 && bvmatch( &attrs[0].an_name, slap_bv_all_user_attrs ) ) )
+ {
count = 1;
attrs = slap_anlist_all_user_attributes;
- } else if ( count == 1 && bvmatch( &attrs[0].an_name, slap_bv_no_attrs ) ) {
+ /* recognize implicit (no valid attributes) or explicit single "1.1" */
+ } else if ( count == 0 ||
+ ( i == 1 && bvmatch( &attrs[0].an_name, slap_bv_no_attrs ) ) )
+ {
count = 0;
attrs = NULL;
}
}
for ( a2 = attrs; a2->an_name.bv_val; a2++ ) {
+ if ( !a2->an_desc && !bvmatch( &a2->an_name, slap_bv_all_user_attrs ) ) continue;
+
if ( !an_find( qm->attr_sets[i].attrs, &a2->an_name ) ) {
found = 0;
break;
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
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
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
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
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
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
+
;;
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
;;
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")
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