]> git.sur5r.net Git - openldap/commitdiff
Don't do ctxcsn checks in Tool mode, don't generate ctxcsn if it's missing
authorHoward Chu <hyc@openldap.org>
Sat, 9 Apr 2005 11:26:31 +0000 (11:26 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 9 Apr 2005 11:26:31 +0000 (11:26 +0000)
and we're also a consumer.

servers/slapd/overlays/syncprov.c

index 05b6606ad15e5855637c6cca409ef957c5e2e308..721dc15b8dfa165cb4d8093c78a0449b0cc629ad 100644 (file)
@@ -2057,6 +2057,10 @@ syncprov_db_open(
        Attribute *a;
        int rc;
 
+       if ( slapMode & SLAP_TOOL_MODE ) {
+               return 0;
+       }
+
        rc = overlay_register_control( be, LDAP_CONTROL_SYNC );
        if ( rc ) {
                return rc;
@@ -2090,6 +2094,12 @@ syncprov_db_open(
                op->o_req_ndn = be->be_nsuffix[0];
                op->ors_scope = LDAP_SCOPE_SUBTREE;
                syncprov_findcsn( op, FIND_MAXCSN );
+       } else if ( SLAP_SYNC_SHADOW( op->o_bd )) {
+               /* If we're also a consumer, and we didn't find the context entry,
+                * then don't generate anything, wait for our provider to send it
+                * to us.
+                */
+               goto out;
        }
 
        if ( BER_BVISEMPTY( &si->si_ctxcsn ) ) {
@@ -2105,6 +2115,7 @@ syncprov_db_open(
                syncprov_checkpoint( op, &rs, on );
        }
 
+out:
        op->o_bd->bd_info = (BackendInfo *)on;
        return 0;
 }
@@ -2120,6 +2131,9 @@ syncprov_db_close(
     syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private;
        int i;
 
+       if ( slapMode & SLAP_TOOL_MODE ) {
+               return 0;
+       }
        if ( si->si_numops ) {
                Connection conn;
                char opbuf[OPERATION_BUFFER_SIZE];