From: Howard Chu Date: Fri, 13 Mar 2009 23:09:14 +0000 (+0000) Subject: ITS#5988 don't respond if consumer's state is newer than ours X-Git-Tag: ACLCHECK_0~694 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2f14098a9b8091895c810264a1ff67d3a597bac1;p=openldap ITS#5988 don't respond if consumer's state is newer than ours --- diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 6799e03c79..e4a853f698 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -2377,13 +2377,22 @@ syncprov_op_search( Operation *op, SlapReply *rs ) /* If nothing has changed, shortcut it */ if ( srs->sr_state.numcsns == numcsns ) { - int i, j; + int i, j, newer; for ( i=0; isr_state.numcsns; i++ ) { for ( j=0; jsr_state.sids[i] != sids[j] ) continue; - if ( !bvmatch( &srs->sr_state.ctxcsn[i], &ctxcsn[j] )) + newer = ber_bvcmp( &srs->sr_state.ctxcsn[i], &ctxcsn[j] ); + /* If our state is newer, tell consumer about changes */ + if ( newer < 0 ) changed = SS_CHANGED; + else if ( newer > 0 ) { + /* our state is older, tell consumer nothing */ + rs->sr_err = LDAP_SUCCESS; + rs->sr_ctrls = NULL; + send_ldap_result( op, rs ); + return rs->sr_err; + } break; } if ( changed )