From 33bb06475b636ff398be64a7cfc43c0fcda7dbab Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 7 Dec 2004 18:52:55 +0000 Subject: [PATCH] Fix findpresent, include user's filter --- servers/slapd/overlays/syncprov.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 61f94b9662..5847451ea2 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -586,7 +586,7 @@ syncprov_findcsn( Operation *op, int mode ) char buf[LDAP_LUTIL_CSNSTR_BUFSIZE + STRLENOF("(entryCSN<=)")]; char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE]; struct berval fbuf, maxcsn; - Filter cf; + Filter cf, af; AttributeAssertion eq; int i, rc = LDAP_SUCCESS; fpres_cookie pcookie; @@ -608,6 +608,12 @@ syncprov_findcsn( Operation *op, int mode ) cf.f_av_desc = slap_schema.si_ad_entryCSN; cf.f_next = NULL; + fop.o_callback = &cb; + fop.ors_limit = NULL; + fop.ors_tlimit = SLAP_NO_LIMIT; + fop.ors_filter = &cf; + fop.ors_filterstr = fbuf; + switch( mode ) { case FIND_MAXCSN: cf.f_choice = LDAP_FILTER_GE; @@ -634,10 +640,14 @@ syncprov_findcsn( Operation *op, int mode ) cb.sc_response = findcsn_cb; break; case FIND_PRESENT: + af.f_choice = LDAP_FILTER_AND; + af.f_next = NULL; + af.f_and = &cf; cf.f_choice = LDAP_FILTER_LE; cf.f_av_value = *srs->sr_state.ctxcsn; - fbuf.bv_len = sprintf( buf, "(entryCSN<=%s)", - cf.f_av_value.bv_val ); + cf.f_next = op->ors_filter; + fop.ors_filter = ⁡ + filter2bv_x( &fop, fop.ors_filter, &fop.ors_filterstr ); fop.ors_attrsonly = 0; fop.ors_attrs = uuid_anlist; fop.ors_slimit = SLAP_NO_LIMIT; @@ -660,11 +670,6 @@ syncprov_findcsn( Operation *op, int mode ) } break; } - fop.o_callback = &cb; - fop.ors_limit = NULL; - fop.ors_tlimit = SLAP_NO_LIMIT; - fop.ors_filter = &cf; - fop.ors_filterstr = fbuf; fop.o_bd->bd_info = on->on_info->oi_orig; fop.o_bd->be_search( &fop, &frs ); @@ -683,6 +688,7 @@ syncprov_findcsn( Operation *op, int mode ) break; case FIND_PRESENT: op->o_tmpfree( pcookie.uuids, op->o_tmpmemctx ); + op->o_tmpfree( fop.ors_filterstr.bv_val, op->o_tmpmemctx ); break; } -- 2.39.5