From c939422ae5f9705744189305909a54f5f3d6558e Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sun, 18 Apr 2010 17:11:29 +0000 Subject: [PATCH] alreadyExists is a legitimate result code (further improve ITS#6472 commit; also fix ITS#6528) --- servers/slapd/syncrepl.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index b513b8dde0..77a5f6e7ba 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -2570,7 +2570,8 @@ retry_modrdn:; /* 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 ); + Operation op2 = *op; + rc = syncrepl_add_glue_ancestors( &op2, entry ); if ( rc == LDAP_SUCCESS ) { goto retry_modrdn; } @@ -2903,10 +2904,9 @@ syncrepl_del_nonpresent( static int syncrepl_add_glue_ancestors( - Operation* o, + Operation* op, Entry *e ) { - Operation op2 = *o, *op = &op2; Backend *be = op->o_bd; slap_callback cb = { NULL }; Attribute *a; @@ -3012,6 +3012,8 @@ syncrepl_add_glue_ancestors( be_entry_release_w( op, glue ); } else { /* incl. ALREADY EXIST */ + Debug(LDAP_DEBUG_TRACE, "syncrepl_add_glue_ancestors: add of ancestor DN=\"%s\" of entry DN=\"%s\" failed (%d)\n", + dn.bv_val, e->e_name.bv_val, rc ); entry_free( glue ); if ( rs_add.sr_err != LDAP_ALREADY_EXISTS ) { entry_free( e ); @@ -3042,25 +3044,31 @@ syncrepl_add_glue_ancestors( int syncrepl_add_glue( - Operation* o, + Operation* op, Entry *e ) { - Operation op2 = *o, *op = &op2; slap_callback cb = { NULL }; int rc; Backend *be = op->o_bd; SlapReply rs_add = {REP_RESULT}; + rc = syncrepl_add_glue_ancestors( op, e ); + switch ( rc ) { + case LDAP_SUCCESS: + case LDAP_ALREADY_EXISTS: + Debug(LDAP_DEBUG_TRACE, "syncrepl_add_glue: add DN=\"%s\" ancestors (%d)\n", + e->e_name.bv_val, rc, 0 ); + break; + + default: + return rc; + } + op->o_tag = LDAP_REQ_ADD; op->o_callback = &cb; cb.sc_response = null_callback; cb.sc_private = NULL; - 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; -- 2.39.5