]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/syncrepl.c
implement search timeout when the remote server does not respond in the specified...
[openldap] / servers / slapd / syncrepl.c
index 1271f76af92bf1261e984612c2daafd2e12aa169..72374ec545cee7451b0037308f8ed4808249959f 100644 (file)
@@ -828,9 +828,10 @@ do_syncrep2(
                                                                struct berval *syncuuid_bv;
                                                                syncuuid_bv = ber_dupbv( NULL, &syncUUIDs[i] );
                                                                slap_sl_free( syncUUIDs[i].bv_val,op->o_tmpmemctx );
-                                                               avl_insert( &si->si_presentlist,
+                                                               if ( avl_insert( &si->si_presentlist,
                                                                        (caddr_t) syncuuid_bv,
-                                                                       syncuuid_cmp, avl_dup_error );
+                                                                       syncuuid_cmp, avl_dup_error ))
+                                                                       ber_bvfree( syncuuid_bv );
                                                        }
                                                        slap_sl_free( syncUUIDs, op->o_tmpmemctx );
                                                }
@@ -1325,9 +1326,14 @@ syncrepl_message_to_op(
                op->orr_modlist = NULL;
                if ( slap_modrdn2mods( op, &rs ))
                        goto done;
-               /* FIXME: append entryCSN, modifiersName, modifyTimestamp to
-                * modlist here. Should accesslog give these to us in a reqMod?
-                */
+               /* Append modlist for operational attrs */
+               {
+                       Modifications *m;
+
+                       for ( m = op->orr_modlist; m->sml_next; m = m->sml_next ) ;
+                       m->sml_next = modlist;
+                       modlist = NULL;
+               }
                rc = op->o_bd->be_modrdn( op, &rs );
                slap_mods_free( op->orr_modlist, 1 );
                Debug( rc ? LDAP_DEBUG_ANY : LDAP_DEBUG_SYNC,
@@ -1407,12 +1413,6 @@ syncrepl_message_to_entry(
                return rc;
        }
 
-       dnPrettyNormal( NULL, &bdn, &dn, &ndn, op->o_tmpmemctx );
-       ber_dupbv( &op->o_req_dn, &dn );
-       ber_dupbv( &op->o_req_ndn, &ndn );
-       slap_sl_free( ndn.bv_val, op->o_tmpmemctx );
-       slap_sl_free( dn.bv_val, op->o_tmpmemctx );
-
        if ( syncstate == LDAP_SYNC_PRESENT || syncstate == LDAP_SYNC_DELETE ) {
                /* NOTE: this could be done even before decoding the DN,
                 * although encoding errors wouldn't be detected */
@@ -1425,6 +1425,12 @@ syncrepl_message_to_entry(
                goto done;
        }
 
+       dnPrettyNormal( NULL, &bdn, &dn, &ndn, op->o_tmpmemctx );
+       ber_dupbv( &op->o_req_dn, &dn );
+       ber_dupbv( &op->o_req_ndn, &ndn );
+       slap_sl_free( ndn.bv_val, op->o_tmpmemctx );
+       slap_sl_free( dn.bv_val, op->o_tmpmemctx );
+
        e = entry_alloc();
        e->e_name = op->o_req_dn;
        e->e_nname = op->o_req_ndn;
@@ -1603,8 +1609,11 @@ syncrepl_entry(
        if (( syncstate == LDAP_SYNC_PRESENT || syncstate == LDAP_SYNC_ADD )) {
                if ( !si->si_refreshPresent ) {
                        syncuuid_bv = ber_dupbv( NULL, syncUUID );
-                       avl_insert( &si->si_presentlist, (caddr_t) syncuuid_bv,
-                               syncuuid_cmp, avl_dup_error );
+                       if ( avl_insert( &si->si_presentlist, (caddr_t) syncuuid_bv,
+                               syncuuid_cmp, avl_dup_error )) {
+                               ber_bvfree( syncuuid_bv );
+                               syncuuid_bv = NULL;
+                       }
                }
        }
 
@@ -2281,7 +2290,7 @@ syncrepl_updateCookie(
        Modifications mod = { { 0 } };
        struct berval vals[ 2 ];
 
-       int rc;
+       int rc, flags;
 
        slap_callback cb = { NULL };
        SlapReply       rs_modify = {REP_RESULT};
@@ -2309,7 +2318,10 @@ syncrepl_updateCookie(
        /* update contextCSN */
        op->o_msgid = SLAP_SYNC_UPDATE_MSGID;
        op->orm_modlist = &mod;
+       flags = SLAP_DBFLAGS( op->o_bd );
+       SLAP_DBFLAGS( op->o_bd ) |= SLAP_DBFLAG_NOLASTMOD;
        rc = be->be_modify( op, &rs_modify );
+       SLAP_DBFLAGS( op->o_bd ) = flags;
        op->o_msgid = 0;
 
        if ( rs_modify.sr_err == LDAP_SUCCESS ) {
@@ -3377,7 +3389,7 @@ add_syncrepl(
                         * in case they really want to do this, they can vary
                         * the case of the URL to allow it.
                         */
-                       if ( l ) {
+                       if ( l && !SLAP_DBHIDDEN( c->be )) {
                                int i;
                                for ( i=0; l[i]; i++ ) {
                                        if ( bvmatch( &l[i]->sl_url, &si->si_bindconf.sb_uri )) {