mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
ITS#4952 use memcmp to compare CSN values
This commit is contained in:
parent
810b2389dc
commit
2779af4730
@ -2537,7 +2537,7 @@ syncrepl_updateCookie(
|
|||||||
Modifications mod[2];
|
Modifications mod[2];
|
||||||
struct berval first = BER_BVNULL;
|
struct berval first = BER_BVNULL;
|
||||||
|
|
||||||
int rc, i, j;
|
int rc, i, j, len;
|
||||||
|
|
||||||
slap_callback cb = { NULL };
|
slap_callback cb = { NULL };
|
||||||
SlapReply rs_modify = {REP_RESULT};
|
SlapReply rs_modify = {REP_RESULT};
|
||||||
@ -2562,8 +2562,11 @@ syncrepl_updateCookie(
|
|||||||
for ( j=0; j<si->si_cookieState->cs_num; j++ ) {
|
for ( j=0; j<si->si_cookieState->cs_num; j++ ) {
|
||||||
if ( syncCookie->sids[i] != si->si_cookieState->cs_sids[j] )
|
if ( syncCookie->sids[i] != si->si_cookieState->cs_sids[j] )
|
||||||
continue;
|
continue;
|
||||||
if ( ber_bvcmp( &syncCookie->ctxcsn[i],
|
len = syncCookie->ctxcsn[i].bv_len;
|
||||||
&si->si_cookieState->cs_vals[j] ) > 0 ) {
|
if ( len > si->si_cookieState->cs_vals[j].bv_len )
|
||||||
|
len = si->si_cookieState->cs_vals[j].bv_len;
|
||||||
|
if ( memcmp( syncCookie->ctxcsn[i].bv_val,
|
||||||
|
&si->si_cookieState->cs_vals[j].bv_val, len ) > 0 ) {
|
||||||
ber_bvarray_add_x( &mod[0].sml_values,
|
ber_bvarray_add_x( &mod[0].sml_values,
|
||||||
&si->si_cookieState->cs_vals[j], op->o_tmpmemctx );
|
&si->si_cookieState->cs_vals[j], op->o_tmpmemctx );
|
||||||
ber_bvarray_add_x( &mod[1].sml_values,
|
ber_bvarray_add_x( &mod[1].sml_values,
|
||||||
@ -2845,15 +2848,20 @@ dn_callback(
|
|||||||
slap_schema.si_ad_entryCSN );
|
slap_schema.si_ad_entryCSN );
|
||||||
new = attr_find( dni->new_entry->e_attrs,
|
new = attr_find( dni->new_entry->e_attrs,
|
||||||
slap_schema.si_ad_entryCSN );
|
slap_schema.si_ad_entryCSN );
|
||||||
if ( new && old && ber_bvcmp( &old->a_vals[0],
|
if ( new && old ) {
|
||||||
&new->a_vals[0] ) >= 0 ) {
|
int len = old->a_vals[0].bv_len;
|
||||||
Debug( LDAP_DEBUG_SYNC,
|
if ( len > new->a_vals[0].bv_len )
|
||||||
"dn_callback : new entry is older than ours "
|
len = new->a_vals[0].bv_len;
|
||||||
"%s ours %s, new %s\n",
|
if ( memcmp( old->a_vals[0].bv_val,
|
||||||
rs->sr_entry->e_name.bv_val,
|
new->a_vals[0].bv_val, len ) >= 0 ) {
|
||||||
old->a_vals[0].bv_val,
|
Debug( LDAP_DEBUG_SYNC,
|
||||||
new->a_vals[0].bv_val );
|
"dn_callback : new entry is older than ours "
|
||||||
return LDAP_SUCCESS;
|
"%s ours %s, new %s\n",
|
||||||
|
rs->sr_entry->e_name.bv_val,
|
||||||
|
old->a_vals[0].bv_val,
|
||||||
|
new->a_vals[0].bv_val );
|
||||||
|
return LDAP_SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We assume that attributes are saved in the same order
|
/* We assume that attributes are saved in the same order
|
||||||
|
Loading…
Reference in New Issue
Block a user