Fixed slapd-bdb/hdb auto-recovery issue (ITS#4361)
Fixed slapd-bdb/hdb BDB 4.4 compatibility issues (ITS#4362)
Fixed slapo-ppolicy modify issue (ITS#4355)
+ Fixed slapo-syncprov/pache filter dup issue (ITS#4364)
+ Fixed slapo-syncprov playlog netries reset issue (ITS#4365)
Build environment
Fixed slaptools when --disable-debug (ITS#4351)
Fixed slapd(8) solaris select(2) issue (ITS#4357)
filter2bv_x( &op, f, fstr );
}
+Filter *
+filter_dup( Filter *f, void *memctx )
+{
+ BerMemoryFunctions *mf = &slap_sl_mfuncs;
+ Filter *n;
+
+ if ( !f )
+ return NULL;
+
+ n = mf->bmf_malloc( sizeof(Filter), memctx );
+ n->f_choice = f->f_choice;
+ n->f_next = NULL;
+
+ switch( f->f_choice ) {
+ case SLAPD_FILTER_COMPUTED:
+ n->f_result = f->f_result;
+ break;
+ case LDAP_FILTER_PRESENT:
+ n->f_desc = f->f_desc;
+ break;
+ case LDAP_FILTER_EQUALITY:
+ case LDAP_FILTER_GE:
+ case LDAP_FILTER_LE:
+ case LDAP_FILTER_APPROX:
+ /* Should this be ava_dup() ? */
+ n->f_ava = mf->bmf_calloc( 1, sizeof(AttributeAssertion), memctx );
+ *n->f_ava = *f->f_ava;
+ ber_dupbv_x( &n->f_av_value, &f->f_av_value, memctx );
+ break;
+ case LDAP_FILTER_SUBSTRINGS:
+ n->f_sub = mf->bmf_calloc( 1, sizeof(SubstringsAssertion), memctx );
+ n->f_sub_desc = f->f_sub_desc;
+ if ( !BER_BVISNULL( &f->f_sub_initial ))
+ ber_dupbv_x( &n->f_sub_initial, &f->f_sub_initial, memctx );
+ if ( f->f_sub_any ) {
+ int i;
+ for ( i = 0; !BER_BVISNULL( &f->f_sub_any[i] ); i++ );
+ n->f_sub_any = mf->bmf_malloc(( i+1 )*sizeof( struct berval ),
+ memctx );
+ for ( i = 0; !BER_BVISNULL( &f->f_sub_any[i] ); i++ ) {
+ ber_dupbv_x( &n->f_sub_any[i], &f->f_sub_any[i], memctx );
+ }
+ BER_BVZERO( &n->f_sub_any[i] );
+ }
+ if ( !BER_BVISNULL( &f->f_sub_final ))
+ ber_dupbv_x( &n->f_sub_final, &f->f_sub_final, memctx );
+ break;
+ case LDAP_FILTER_EXT: {
+ /* Should this be mra_dup() ? */
+ ber_len_t length;
+ length = sizeof(MatchingRuleAssertion);
+ if ( !BER_BVISNULL( &f->f_mr_rule_text ))
+ length += f->f_mr_rule_text.bv_len + 1;
+ n->f_mra = mf->bmf_calloc( 1, length, memctx );
+ *n->f_mra = *f->f_mra;
+ ber_dupbv_x( &n->f_mr_value, &f->f_mr_value, memctx );
+ if ( !BER_BVISNULL( &f->f_mr_rule_text )) {
+ n->f_mr_rule_text.bv_val = (char *)(n->f_mra+1);
+ AC_MEMCPY(n->f_mr_rule_text.bv_val,
+ f->f_mr_rule_text.bv_val, f->f_mr_rule_text.bv_len );
+ }
+ } break;
+ case LDAP_FILTER_AND:
+ case LDAP_FILTER_OR:
+ case LDAP_FILTER_NOT: {
+ Filter **p;
+ for ( p = &n->f_list, f = f->f_list; f; f = f->f_next ) {
+ *p = filter_dup( f, memctx );
+ p = &(*p)->f_next;
+ }
+ } break;
+ }
+ return n;
+}
+
static int
get_simple_vrFilter(
Operation *op,
struct search_info *si;
Debug( LDAP_DEBUG_TRACE, "QUERY CACHEABLE\n", 0, 0, 0 );
- query.filter = str2filter(op->ors_filterstr.bv_val);
+ query.filter = filter_dup(op->ors_filter, NULL);
add_filter_attrs(op, &query.attrs, &qm->attr_sets[attr_set],
filter_attrs, fattr_cnt, fattr_got_oc);
mf.f_av_value = uuids[i];
cb.sc_private = NULL;
fop.ors_slimit = 1;
+ frs.sr_nentries = 0;
rc = fop.o_bd->be_search( &fop, &frs );
/* If entry was not found, add to delete list */
op2->ors_filterstr.bv_val = ptr;
strcpy( ptr, so->s_filterstr.bv_val );
op2->ors_filterstr.bv_len = so->s_filterstr.bv_len;
- op2->ors_filter = str2filter( ptr );
+ op2->ors_filter = filter_dup( op->ors_filter, NULL );
so->s_op = op2;
/* Copy any cached group ACLs individually */
LDAP_SLAPD_F (void) filter_free_x LDAP_P(( Operation *op, Filter *f ));
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 ));
LDAP_SLAPD_F (int) get_vrFilter LDAP_P(( Operation *op, BerElement *ber,
ValuesReturnFilter **f,
Slapi_Filter *
slapi_filter_dup( Slapi_Filter *filter )
{
- Filter *f;
-
- f = (Filter *) slapi_ch_malloc( sizeof(Filter) );
- f->f_next = NULL;
- f->f_choice = filter->f_choice;
-
- switch ( f->f_choice ) {
- case LDAP_FILTER_AND:
- case LDAP_FILTER_NOT:
- case LDAP_FILTER_OR: {
- Filter *pFilter, **ppF;
-
- for ( pFilter = filter->f_list, ppF = &f->f_list;
- pFilter != NULL;
- pFilter = pFilter->f_next, ppF = &f->f_next )
- {
- *ppF = slapi_filter_dup( pFilter );
- if ( *ppF == NULL )
- break;
- }
- break;
- }
- case LDAP_FILTER_PRESENT:
- f->f_desc = filter->f_desc;
- break;
- case LDAP_FILTER_EQUALITY:
- case LDAP_FILTER_GE:
- case LDAP_FILTER_LE:
- case LDAP_FILTER_APPROX:
- f->f_ava = (AttributeAssertion *)slapi_ch_malloc( sizeof(AttributeAssertion) );
- f->f_ava->aa_desc = filter->f_ava->aa_desc;
- ber_dupbv( &f->f_ava->aa_value, &filter->f_ava->aa_value );
- break;
- case LDAP_FILTER_EXT:
- f->f_mra = (MatchingRuleAssertion *)slapi_ch_malloc( sizeof(MatchingRuleAssertion) );
- f->f_mra->ma_rule = filter->f_mra->ma_rule;
- f->f_mra->ma_rule_text = filter->f_mra->ma_rule_text; /* struct copy */
- f->f_mra->ma_desc = filter->f_mra->ma_desc;
- f->f_mra->ma_dnattrs = filter->f_mra->ma_dnattrs;
- ber_dupbv( &f->f_mra->ma_value, &filter->f_mra->ma_value );
- break;
- case LDAP_FILTER_SUBSTRINGS: {
- int i;
-
- f->f_sub = (SubstringsAssertion *)slapi_ch_malloc( sizeof(SubstringsAssertion) );
- f->f_sub->sa_desc = filter->f_sub->sa_desc;
- ber_dupbv( &f->f_sub_initial, &filter->f_sub_initial );
- if ( filter->f_sub_any != NULL ) {
- for ( i = 0; filter->f_sub_any[i].bv_val != NULL; i++ )
- ;
- f->f_sub_any = (BerVarray)slapi_ch_malloc( (i + 1) * (sizeof(struct berval)) );
- for ( i = 0; filter->f_sub_any[i].bv_val != NULL; i++ ) {
- ber_dupbv( &f->f_sub_any[i], &filter->f_sub_any[i] );
- }
- f->f_sub_any[i].bv_val = NULL;
- } else {
- f->f_sub_any = NULL;
- }
- ber_dupbv( &f->f_sub_final, &filter->f_sub_final );
- break;
- }
- case SLAPD_FILTER_COMPUTED:
- f->f_result = filter->f_result;
- break;
- default:
- slapi_ch_free( (void **)&f );
- f = NULL;
- break;
- }
-
- return f;
+ return filter_dup( filter, NULL );
}
int