]> git.sur5r.net Git - openldap/commitdiff
Fix findpresent, include user's filter
authorHoward Chu <hyc@openldap.org>
Tue, 7 Dec 2004 18:52:55 +0000 (18:52 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 7 Dec 2004 18:52:55 +0000 (18:52 +0000)
servers/slapd/overlays/syncprov.c

index 61f94b966273038df99944b90c789c42c7a7d641..5847451ea2e7dc4b93dfba5d52afc8400ec9bd55 100644 (file)
@@ -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 = &af;
+               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;
        }