*** /tmp/RCSAa19058 Fri Sep 18 15:11:15 1992 --- ldapd/search.c Fri Sep 11 11:18:19 1992 *************** *** 138,144 **** as_free( sa.sra_eis.eis_select ); send_ldap_result( clientsb, LDAP_RES_SEARCH_RESULT, msgid, ! LDAP_UNDEFINED_TYPE, "" ); return( 0 ); } --- 138,145 ---- as_free( sa.sra_eis.eis_select ); send_ldap_result( clientsb, LDAP_RES_SEARCH_RESULT, msgid, ! LDAP_UNDEFINED_TYPE, attrs[i] ); ! charlist_free( attrs ); return( 0 ); } *************** *** 187,192 **** --- 188,202 ---- * present [7] AttributeType,, * approxMatch [8] AttributeValueAssertion * } + * + * SubstringFilter ::= SEQUENCE { + * type AttributeType, + * SEQUENCE OF CHOICE { + * initial [0] IA5String, + * any [1] IA5String, + * final [2] IA5String + * } + * } */ f = filter_alloc(); *************** *** 193,198 **** --- 203,209 ---- *filt = f; f->flt_next = NULLFILTER; + err = 0; switch (tag = ber_peek_tag( ber, &len )) { case LDAP_FILTER_EQUALITY: Debug( LDAP_DEBUG_ARGS, "EQUALITY\n", 0, 0, 0 ); *************** *** 206,212 **** case LDAP_FILTER_SUBSTRINGS: Debug( LDAP_DEBUG_ARGS, "SUBSTRINGS\n", 0, 0, 0 ); ! return( get_substring_filter( ber, f ) ); break; case LDAP_FILTER_GE: --- 217,223 ---- case LDAP_FILTER_SUBSTRINGS: Debug( LDAP_DEBUG_ARGS, "SUBSTRINGS\n", 0, 0, 0 ); ! err = get_substring_filter( ber, f ); break; case LDAP_FILTER_GE: *************** *** 253,265 **** case LDAP_FILTER_AND: Debug( LDAP_DEBUG_ARGS, "AND\n", 0, 0, 0 ); f->flt_type = FILTER_AND; ! return( get_filter_list( ber, f ) ); break; case LDAP_FILTER_OR: Debug( LDAP_DEBUG_ARGS, "OR\n", 0, 0, 0 ); f->flt_type = FILTER_OR; ! return( get_filter_list( ber, f ) ); break; case LDAP_FILTER_NOT: --- 264,276 ---- case LDAP_FILTER_AND: Debug( LDAP_DEBUG_ARGS, "AND\n", 0, 0, 0 ); f->flt_type = FILTER_AND; ! err = get_filter_list( ber, f ); break; case LDAP_FILTER_OR: Debug( LDAP_DEBUG_ARGS, "OR\n", 0, 0, 0 ); f->flt_type = FILTER_OR; ! err = get_filter_list( ber, f ); break; case LDAP_FILTER_NOT: *************** *** 266,272 **** Debug( LDAP_DEBUG_ARGS, "NOT\n", 0, 0, 0 ); f->flt_type = FILTER_NOT; (void) ber_skip_tag( ber, &len ); ! return( get_filter( ber, &f->FUFILT ) ); break; default: --- 277,283 ---- Debug( LDAP_DEBUG_ARGS, "NOT\n", 0, 0, 0 ); f->flt_type = FILTER_NOT; (void) ber_skip_tag( ber, &len ); ! err = get_filter( ber, &f->FUFILT ); break; default: *************** *** 276,282 **** break; } ! return( 0 ); } static get_filter_list( ber, f ) --- 287,294 ---- break; } ! Debug( LDAP_DEBUG_TRACE, "end get_filter\n", 0, 0, 0 ); ! return( err ); } static get_filter_list( ber, f ) *************** *** 303,308 **** --- 315,321 ---- tail = new; } + Debug( LDAP_DEBUG_TRACE, "end get_filter_list\n", 0, 0, 0 ); return( 0 ); } *************** *** 313,319 **** int tag, len; char typestr[64]; AttributeType type; ! char *valstr; AttributeValue value; Debug( LDAP_DEBUG_TRACE, "get_substring_filter\n", 0, 0, 0 ); --- 326,332 ---- int tag, len; char typestr[64]; AttributeType type; ! char *valstr, *last; AttributeValue value; Debug( LDAP_DEBUG_TRACE, "get_substring_filter\n", 0, 0, 0 ); *************** *** 321,327 **** f->flt_type = FILTER_ITEM; f->FUITEM.fi_type = FILTERITEM_SUBSTRINGS; len = sizeof(typestr); ! if ( ber_scanf( ber, "{s{", typestr, &len ) == -1 ) { return( LDAP_PROTOCOL_ERROR ); } if ( (type = str2AttrT( typestr )) == NULLAttrT ) { --- 334,340 ---- f->flt_type = FILTER_ITEM; f->FUITEM.fi_type = FILTERITEM_SUBSTRINGS; len = sizeof(typestr); ! if ( ber_scanf( ber, "{s", typestr, &len ) == -1 ) { return( LDAP_PROTOCOL_ERROR ); } if ( (type = str2AttrT( typestr )) == NULLAttrT ) { *************** *** 331,342 **** f->FUITEM.UNSUB.fi_sub_initial = NULLAV; f->FUITEM.UNSUB.fi_sub_any = NULLAV; f->FUITEM.UNSUB.fi_sub_final = NULLAV; ! while ( (tag = ber_peek_tag( ber, &len )) != -1 ! && tag != LBER_SEQUENCE ) { AV_Sequence avs; if ( ber_scanf( ber, "a", &valstr ) == -1 ) { - free( f ); return( LDAP_PROTOCOL_ERROR ); } --- 344,354 ---- f->FUITEM.UNSUB.fi_sub_initial = NULLAV; f->FUITEM.UNSUB.fi_sub_any = NULLAV; f->FUITEM.UNSUB.fi_sub_final = NULLAV; ! for ( tag = ber_first_element( ber, &len, &last ); tag != -1; ! tag = ber_next_element( ber, &len, last ) ) { AV_Sequence avs; if ( ber_scanf( ber, "a", &valstr ) == -1 ) { return( LDAP_PROTOCOL_ERROR ); } *************** *** 346,355 **** } if ( (avs = avs_comp_new( value )) == NULLAV ) ! return( LDAP_OTHER ); switch ( tag ) { case LDAP_SUBSTRING_INITIAL: if ( f->FUITEM.UNSUB.fi_sub_initial != NULLAV && f->FUITEM.UNSUB.fi_sub_initial->avseq_next != NULLAV ) { --- 358,368 ---- } if ( (avs = avs_comp_new( value )) == NULLAV ) ! return( LDAP_OPERATIONS_ERROR ); switch ( tag ) { case LDAP_SUBSTRING_INITIAL: + Debug( LDAP_DEBUG_ARGS, " INITIAL\n", 0, 0, 0 ); if ( f->FUITEM.UNSUB.fi_sub_initial != NULLAV && f->FUITEM.UNSUB.fi_sub_initial->avseq_next != NULLAV ) { *************** *** 360,370 **** --- 373,385 ---- break; case LDAP_SUBSTRING_ANY: + Debug( LDAP_DEBUG_ARGS, " ANY\n", 0, 0, 0 ); f->FUITEM.UNSUB.fi_sub_any = avs_merge( avs, f->FUITEM.UNSUB.fi_sub_any ); break; case LDAP_SUBSTRING_FINAL: + Debug( LDAP_DEBUG_ARGS, " FINAL\n", 0, 0, 0 ); if ( f->FUITEM.UNSUB.fi_sub_final != NULLAV && f->FUITEM.UNSUB.fi_sub_final->avseq_next != NULLAV ) { *************** *** 375,384 **** --- 390,401 ---- break; default: + Debug( LDAP_DEBUG_ARGS, " unknown type\n", tag, 0, 0 ); return( LDAP_PROTOCOL_ERROR ); } } + Debug( LDAP_DEBUG_TRACE, "end get_substring_filter\n", 0, 0, 0 ); return( 0 ); }