]> git.sur5r.net Git - openldap/commitdiff
More for prev commit
authorHoward Chu <hyc@openldap.org>
Fri, 13 Mar 2009 00:26:24 +0000 (00:26 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 13 Mar 2009 00:26:24 +0000 (00:26 +0000)
servers/slapd/overlays/syncprov.c

index 0b9e8d133ba226cbd22c0aa157d7a3b29f232756..14850b74f72720ab28d2e1269cae46152255b8b6 100644 (file)
@@ -783,7 +783,7 @@ syncprov_sendresp( Operation *op, opcookie *opc, syncops *so,
        ctrls[1] = NULL;
        csns[0] = opc->sctxcsn;
        BER_BVZERO( &csns[1] );
-       slap_compose_sync_cookie( op, &cookie, csns, so->s_rid, slap_serverID );
+       slap_compose_sync_cookie( op, &cookie, csns, so->s_rid, slap_serverID ? slap_serverID : -1 );
 
        Debug( LDAP_DEBUG_SYNC, "syncprov_sendresp: cookie=%s\n", cookie.bv_val, 0, 0 );
 
@@ -982,7 +982,7 @@ syncprov_qresp( opcookie *opc, syncops *so, int mode )
                syncprov_info_t *si = opc->son->on_bi.bi_private;
 
                slap_compose_sync_cookie( NULL, &cookie, si->si_ctxcsn,
-                       so->s_rid, slap_serverID);
+                       so->s_rid, slap_serverID ? slap_serverID : -1);
        }
 
        srsize = sizeof(syncres) + opc->suuid.bv_len + 1 +
@@ -1176,14 +1176,14 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit )
                        continue;
 
                /* Don't send ops back to the originator */
-               if ( opc->ssid && opc->ssid == ss->s_sid ) {
+               if ( opc->ssid > 0 && opc->ssid == ss->s_sid ) {
                        Debug( LDAP_DEBUG_SYNC, "syncprov_matchops: skipping original sid %03x\n",
                                opc->ssid, 0, 0 );
                        continue;
                }
 
                /* Don't send ops back to the messenger */
-               if ( scook && scook->sid && scook->sid == ss->s_sid ) {
+               if ( scook && scook->sid > 0 && scook->sid == ss->s_sid ) {
                        Debug( LDAP_DEBUG_SYNC, "syncprov_matchops: skipping relayed sid %03x\n",
                                scook->sid, 0, 0 );
                        continue;
@@ -1596,7 +1596,7 @@ syncprov_playlog( Operation *op, SlapReply *rs, sessionlog *sl,
 
                if ( delcsn[0].bv_len ) {
                        slap_compose_sync_cookie( op, &cookie, delcsn, srs->sr_state.rid,
-                               slap_serverID );
+                               slap_serverID ? slap_serverID : -1 );
 
                        Debug( LDAP_DEBUG_SYNC, "syncprov_playlog: cookie=%s\n", cookie.bv_val, 0, 0 );
                }
@@ -2164,7 +2164,7 @@ syncprov_search_response( Operation *op, SlapReply *rs )
                /* If we're in delta-sync mode, always send a cookie */
                if ( si->si_nopres && si->si_usehint && a ) {
                        struct berval cookie;
-                       slap_compose_sync_cookie( op, &cookie, a->a_nvals, srs->sr_state.rid, slap_serverID );
+                       slap_compose_sync_cookie( op, &cookie, a->a_nvals, srs->sr_state.rid, slap_serverID ? slap_serverID : -1 );
                        rs->sr_err = syncprov_state_ctrl( op, rs, rs->sr_entry,
                                LDAP_SYNC_ADD, rs->sr_ctrls, 0, 1, &cookie );
                } else {
@@ -2176,7 +2176,7 @@ syncprov_search_response( Operation *op, SlapReply *rs )
 
                if ( ss->ss_flags & SS_CHANGED ) {
                        slap_compose_sync_cookie( op, &cookie, ss->ss_ctxcsn,
-                               srs->sr_state.rid, slap_serverID );
+                               srs->sr_state.rid, slap_serverID ? slap_serverID : -1 );
 
                        Debug( LDAP_DEBUG_SYNC, "syncprov_search_response: cookie=%s\n", cookie.bv_val, 0, 0 );
                }