]> git.sur5r.net Git - openldap/commitdiff
fix out of order add/rename, when rename to newly added new superior occurs while...
authorPierangelo Masarati <ando@openldap.org>
Sat, 17 Apr 2010 21:59:35 +0000 (21:59 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 17 Apr 2010 21:59:35 +0000 (21:59 +0000)
servers/slapd/syncrepl.c

index 526cc0e47b4f8f144b9f79edc4fd0bdb850558dc..a5a35d5ba4b7ba23b969db5c47c391defed7033c 100644 (file)
@@ -131,6 +131,8 @@ static int syncrepl_updateCookie(
                                        struct sync_cookie * );
 static struct berval * slap_uuidstr_from_normalized(
                                        struct berval *, struct berval *, void * );
+static int syncrepl_add_glue_ancestors(
+       Operation* op, Entry *e );
 
 /* callback functions */
 static int dn_callback( Operation *, SlapReply * );
@@ -2562,7 +2564,18 @@ retry_add:;
                                mod->sml_next = m2;
                        }
                        op->o_bd = si->si_wbe;
+retry_modrdn:;
                        rc = op->o_bd->be_modrdn( op, &rs_modify );
+
+                       /* NOTE: noSuchObject should result because the new superior
+                        * has not been added yet (ITS#6472) */
+                       if ( rc == LDAP_NO_SUCH_OBJECT && !BER_BVISNULL( op->orr_nnewSup )) {
+                               rc = syncrepl_add_glue_ancestors( op, entry );
+                               if ( rc == LDAP_SUCCESS ) {
+                                       goto retry_modrdn;
+                               }
+                       }
+               
                        op->o_tmpfree( op->orr_nnewrdn.bv_val, op->o_tmpmemctx );
                        op->o_tmpfree( op->orr_newrdn.bv_val, op->o_tmpmemctx );
 
@@ -2888,8 +2901,8 @@ syncrepl_del_nonpresent(
        return;
 }
 
-int
-syncrepl_add_glue(
+static int
+syncrepl_add_glue_ancestors(
        Operation* op,
        Entry *e )
 {
@@ -3023,6 +3036,23 @@ syncrepl_add_glue(
                ndn.bv_len = e->e_nname.bv_len - (ndn.bv_val - e->e_nname.bv_val);
        }
 
+       return rc;
+}
+
+int
+syncrepl_add_glue(
+       Operation* op,
+       Entry *e )
+{
+       int     rc;
+       Backend *be = op->o_bd;
+       SlapReply       rs_add = {REP_RESULT};
+
+       rc = syncrepl_add_glue_ancestors( op, e );
+       if ( rc != LDAP_SUCCESS ) {
+               return rc;
+       }
+
        op->o_req_dn = e->e_name;
        op->o_req_ndn = e->e_nname;
        op->ora_e = e;