mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
ITS#6872
Perform the internal FIND_CSN search based at the backend's suffix with the privileges of the backend's root DN.
This commit is contained in:
parent
d5920a42b1
commit
fa64b07cfc
@ -586,7 +586,7 @@ findpres_cb( Operation *op, SlapReply *rs )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
syncprov_findcsn( Operation *op, find_csn_t mode )
|
syncprov_findcsn( Operation *op, find_csn_t mode, struct berval *csn )
|
||||||
{
|
{
|
||||||
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
|
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
|
||||||
syncprov_info_t *si = on->on_bi.bi_private;
|
syncprov_info_t *si = on->on_bi.bi_private;
|
||||||
@ -659,15 +659,12 @@ again:
|
|||||||
break;
|
break;
|
||||||
case FIND_CSN:
|
case FIND_CSN:
|
||||||
if ( BER_BVISEMPTY( &cf.f_av_value )) {
|
if ( BER_BVISEMPTY( &cf.f_av_value )) {
|
||||||
cf.f_av_value = srs->sr_state.ctxcsn[0];
|
cf.f_av_value = *csn;
|
||||||
/* If there are multiple CSNs, use the smallest */
|
|
||||||
for ( i=1; i<srs->sr_state.numcsns; i++ ) {
|
|
||||||
if ( ber_bvcmp( &cf.f_av_value, &srs->sr_state.ctxcsn[i] )
|
|
||||||
> 0 ) {
|
|
||||||
cf.f_av_value = srs->sr_state.ctxcsn[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
fop.o_dn = op->o_bd->be_rootdn;
|
||||||
|
fop.o_ndn = op->o_bd->be_rootndn;
|
||||||
|
fop.o_req_dn = op->o_bd->be_suffix[0];
|
||||||
|
fop.o_req_ndn = op->o_bd->be_nsuffix[0];
|
||||||
/* Look for exact match the first time */
|
/* Look for exact match the first time */
|
||||||
if ( findcsn_retry ) {
|
if ( findcsn_retry ) {
|
||||||
cf.f_choice = LDAP_FILTER_EQUALITY;
|
cf.f_choice = LDAP_FILTER_EQUALITY;
|
||||||
@ -2624,7 +2621,7 @@ no_change: if ( !(op->o_sync_mode & SLAP_SYNC_PERSIST) ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Is the CSN still present in the database? */
|
/* Is the CSN still present in the database? */
|
||||||
if ( syncprov_findcsn( op, FIND_CSN ) != LDAP_SUCCESS ) {
|
if ( syncprov_findcsn( op, FIND_CSN, &mincsn ) != LDAP_SUCCESS ) {
|
||||||
/* No, so a reload is required */
|
/* No, so a reload is required */
|
||||||
/* the 2.2 consumer doesn't send this hint */
|
/* the 2.2 consumer doesn't send this hint */
|
||||||
if ( si->si_usehint && srs->sr_rhint == 0 ) {
|
if ( si->si_usehint && srs->sr_rhint == 0 ) {
|
||||||
@ -2648,7 +2645,7 @@ no_change: if ( !(op->o_sync_mode & SLAP_SYNC_PERSIST) ) {
|
|||||||
} else {
|
} else {
|
||||||
gotstate = 1;
|
gotstate = 1;
|
||||||
/* If changed and doing Present lookup, send Present UUIDs */
|
/* If changed and doing Present lookup, send Present UUIDs */
|
||||||
if ( do_present && syncprov_findcsn( op, FIND_PRESENT ) !=
|
if ( do_present && syncprov_findcsn( op, FIND_PRESENT, 0 ) !=
|
||||||
LDAP_SUCCESS ) {
|
LDAP_SUCCESS ) {
|
||||||
if ( ctxcsn )
|
if ( ctxcsn )
|
||||||
ber_bvarray_free_x( ctxcsn, op->o_tmpmemctx );
|
ber_bvarray_free_x( ctxcsn, op->o_tmpmemctx );
|
||||||
@ -2976,7 +2973,7 @@ syncprov_db_otask(
|
|||||||
void *ptr
|
void *ptr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
syncprov_findcsn( ptr, FIND_MAXCSN );
|
syncprov_findcsn( ptr, FIND_MAXCSN, 0 );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user