mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-25 09:09:54 -05:00
don't free and reuse filter structure; don't rewrite undefined filter values (ITS#5731,ITS#5732)
This commit is contained in:
parent
9078381252
commit
6845c2510d
16 changed files with 29 additions and 23 deletions
|
|
@ -2211,7 +2211,7 @@ acl_set_gather( SetCookie *cookie, struct berval *name, AttributeDescription *de
|
|||
|
||||
url_done:;
|
||||
if ( op2.ors_filter && op2.ors_filter != slap_filter_objectClass_pres ) {
|
||||
filter_free_x( cp->asc_op, op2.ors_filter );
|
||||
filter_free_x( cp->asc_op, op2.ors_filter, 1 );
|
||||
}
|
||||
if ( !BER_BVISNULL( &op2.o_req_ndn ) ) {
|
||||
slap_sl_free( op2.o_req_ndn.bv_val, cp->asc_op->o_tmpmemctx );
|
||||
|
|
|
|||
|
|
@ -868,7 +868,7 @@ monitor_search2ndn(
|
|||
|
||||
cleanup:;
|
||||
if ( op->ors_filter != NULL ) {
|
||||
filter_free_x( op, op->ors_filter );
|
||||
filter_free_x( op, op->ors_filter, 1 );
|
||||
}
|
||||
if ( !BER_BVISNULL( &op->ors_filterstr ) ) {
|
||||
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
|
||||
|
|
|
|||
|
|
@ -1496,7 +1496,7 @@ fe_acl_group(
|
|||
{
|
||||
rc = 0;
|
||||
}
|
||||
filter_free_x( op, filter );
|
||||
filter_free_x( op, filter, 1 );
|
||||
}
|
||||
loopit:
|
||||
ldap_free_urldesc( ludp );
|
||||
|
|
|
|||
|
|
@ -1205,7 +1205,7 @@ static int parseAssert (
|
|||
send_ldap_result( op, rs );
|
||||
}
|
||||
if( op->o_assertion != NULL ) {
|
||||
filter_free_x( op, op->o_assertion );
|
||||
filter_free_x( op, op->o_assertion, 1 );
|
||||
}
|
||||
return rs->sr_err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ return_error:
|
|||
}
|
||||
|
||||
void
|
||||
filter_free_x( Operation *op, Filter *f )
|
||||
filter_free_x( Operation *op, Filter *f, int freeme )
|
||||
{
|
||||
Filter *p, *next;
|
||||
|
||||
|
|
@ -531,7 +531,7 @@ filter_free_x( Operation *op, Filter *f )
|
|||
case LDAP_FILTER_NOT:
|
||||
for ( p = f->f_list; p != NULL; p = next ) {
|
||||
next = p->f_next;
|
||||
filter_free_x( op, p );
|
||||
filter_free_x( op, p, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -548,7 +548,9 @@ filter_free_x( Operation *op, Filter *f )
|
|||
break;
|
||||
}
|
||||
|
||||
op->o_tmpfree( f, op->o_tmpmemctx );
|
||||
if ( freeme ) {
|
||||
op->o_tmpfree( f, op->o_tmpmemctx );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -560,7 +562,7 @@ filter_free( Filter *f )
|
|||
op.o_hdr = &ohdr;
|
||||
op.o_tmpmemctx = slap_sl_context( f );
|
||||
op.o_tmpmfuncs = &slap_sl_mfuncs;
|
||||
filter_free_x( &op, f );
|
||||
filter_free_x( &op, f, 1 );
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ dds_expire( void *ctx, dds_info_t *di )
|
|||
|
||||
done_search:;
|
||||
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
|
||||
filter_free_x( op, op->ors_filter );
|
||||
filter_free_x( op, op->ors_filter, 1 );
|
||||
|
||||
rc = rs.sr_err;
|
||||
switch ( rs.sr_err ) {
|
||||
|
|
@ -1671,7 +1671,7 @@ dds_count( void *ctx, BackendDB *be )
|
|||
|
||||
done_search:;
|
||||
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
|
||||
filter_free_x( op, op->ors_filter );
|
||||
filter_free_x( op, op->ors_filter, 1 );
|
||||
|
||||
rc = rs.sr_err;
|
||||
switch ( rs.sr_err ) {
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@ cleanup:;
|
|||
slap_op_groups_free( &o );
|
||||
}
|
||||
if ( o.ors_filter ) {
|
||||
filter_free_x( &o, o.ors_filter );
|
||||
filter_free_x( &o, o.ors_filter, 1 );
|
||||
}
|
||||
if ( o.ors_attrs && o.ors_attrs != rs->sr_attrs
|
||||
&& o.ors_attrs != slap_anlist_no_attrs )
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ retcode_op_internal( Operation *op, SlapReply *rs )
|
|||
rc = op2.o_bd->be_search( &op2, rs );
|
||||
op->o_abandon = op2.o_abandon;
|
||||
|
||||
filter_free_x( &op2, op2.ors_filter );
|
||||
filter_free_x( &op2, op2.ors_filter, 1 );
|
||||
ber_memfree_x( op2.ors_filterstr.bv_val, op2.o_tmpmemctx );
|
||||
|
||||
if ( rdc.rdc_flags == SLAP_CB_CONTINUE ) {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ rwm_op_rollback( Operation *op, SlapReply *rs, rwm_op_state *ros )
|
|||
break;
|
||||
case LDAP_REQ_SEARCH:
|
||||
ch_free( ros->mapped_attrs );
|
||||
filter_free_x( op, op->ors_filter );
|
||||
filter_free_x( op, op->ors_filter, 1 );
|
||||
ch_free( op->ors_filterstr.bv_val );
|
||||
op->ors_attrs = ros->ors_attrs;
|
||||
op->ors_filter = ros->ors_filter;
|
||||
|
|
@ -833,7 +833,7 @@ error_return:;
|
|||
}
|
||||
|
||||
if ( f != NULL ) {
|
||||
filter_free_x( op, f );
|
||||
filter_free_x( op, f, 1 );
|
||||
}
|
||||
|
||||
if ( !BER_BVISNULL( &fstr ) ) {
|
||||
|
|
|
|||
|
|
@ -495,6 +495,10 @@ rwm_int_filter_map_rewrite(
|
|||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
if ( f->f_choice & SLAPD_FILTER_UNDEFINED ) {
|
||||
goto computed;
|
||||
}
|
||||
|
||||
switch ( f->f_choice & SLAPD_FILTER_MASK ) {
|
||||
case LDAP_FILTER_EQUALITY:
|
||||
ad = f->f_av_desc;
|
||||
|
|
@ -706,7 +710,7 @@ rwm_int_filter_map_rewrite(
|
|||
|
||||
case -1:
|
||||
computed:;
|
||||
filter_free_x( op, f );
|
||||
filter_free_x( op, f, 0 );
|
||||
f->f_choice = SLAPD_FILTER_COMPUTED;
|
||||
f->f_result = SLAPD_COMPARE_UNDEFINED;
|
||||
/* fallthru */
|
||||
|
|
|
|||
|
|
@ -1013,7 +1013,7 @@ unique_search(
|
|||
|
||||
nop->o_bd = on->on_info->oi_origdb;
|
||||
rc = nop->o_bd->be_search(nop, &nrs);
|
||||
filter_free_x(nop, nop->ors_filter);
|
||||
filter_free_x(nop, nop->ors_filter, 1);
|
||||
op->o_tmpfree( key->bv_val, op->o_tmpmemctx );
|
||||
|
||||
if(rc != LDAP_SUCCESS && rc != LDAP_NO_SUCH_OBJECT) {
|
||||
|
|
|
|||
|
|
@ -1029,7 +1029,7 @@ LDAP_SLAPD_F (int) get_filter LDAP_P((
|
|||
const char **text ));
|
||||
|
||||
LDAP_SLAPD_F (void) filter_free LDAP_P(( Filter *f ));
|
||||
LDAP_SLAPD_F (void) filter_free_x LDAP_P(( Operation *op, Filter *f ));
|
||||
LDAP_SLAPD_F (void) filter_free_x LDAP_P(( Operation *op, Filter *f, int freeme ));
|
||||
LDAP_SLAPD_F (void) filter2bv LDAP_P(( Filter *f, struct berval *bv ));
|
||||
LDAP_SLAPD_F (void) filter2bv_x LDAP_P(( Operation *op, Filter *f, struct berval *bv ));
|
||||
LDAP_SLAPD_F (Filter *) filter_dup LDAP_P(( Filter *f, void *memctx ));
|
||||
|
|
|
|||
|
|
@ -1044,7 +1044,7 @@ slapd_rw_apply( void *private, const char *filter, struct berval *val )
|
|||
}
|
||||
rc = REWRITE_ERR;
|
||||
}
|
||||
filter_free_x( op, op->ors_filter );
|
||||
filter_free_x( op, op->ors_filter, 1 );
|
||||
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1226,7 +1226,7 @@ is_dn: bv.bv_len = uri->bv_len - (bv.bv_val - uri->bv_val);
|
|||
|
||||
done:
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
if( *filter ) filter_free_x( op, *filter );
|
||||
if( *filter ) filter_free_x( op, *filter, 1 );
|
||||
BER_BVZERO( base );
|
||||
BER_BVZERO( fstr );
|
||||
} else {
|
||||
|
|
@ -1843,7 +1843,7 @@ exact_match:
|
|||
CONCLUDED:
|
||||
if( !BER_BVISNULL( &op.o_req_dn ) ) slap_sl_free( op.o_req_dn.bv_val, opx->o_tmpmemctx );
|
||||
if( !BER_BVISNULL( &op.o_req_ndn ) ) slap_sl_free( op.o_req_ndn.bv_val, opx->o_tmpmemctx );
|
||||
if( op.ors_filter ) filter_free_x( opx, op.ors_filter );
|
||||
if( op.ors_filter ) filter_free_x( opx, op.ors_filter, 1 );
|
||||
if( !BER_BVISNULL( &op.ors_filterstr ) ) ch_free( op.ors_filterstr.bv_val );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
|
|
@ -2015,7 +2015,7 @@ FINISHED:
|
|||
slap_sl_free( op.o_req_ndn.bv_val, opx->o_tmpmemctx );
|
||||
}
|
||||
if( op.ors_filter ) {
|
||||
filter_free_x( opx, op.ors_filter );
|
||||
filter_free_x( opx, op.ors_filter, 1 );
|
||||
}
|
||||
if( !BER_BVISNULL( &op.ors_filterstr ) ) {
|
||||
ch_free( op.ors_filterstr.bv_val );
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ return_results:;
|
|||
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
|
||||
}
|
||||
if ( op->ors_filter != NULL) {
|
||||
filter_free_x( op, op->ors_filter );
|
||||
filter_free_x( op, op->ors_filter, 1 );
|
||||
}
|
||||
if ( op->ors_attrs != NULL ) {
|
||||
op->o_tmpfree( op->ors_attrs, op->o_tmpmemctx );
|
||||
|
|
|
|||
|
|
@ -2475,7 +2475,7 @@ syncrepl_del_nonpresent(
|
|||
op->o_tmpfree( cf, op->o_tmpmemctx );
|
||||
op->ors_filter = of;
|
||||
}
|
||||
if ( op->ors_filter ) filter_free_x( op, op->ors_filter );
|
||||
if ( op->ors_filter ) filter_free_x( op, op->ors_filter, 1 );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue