struct berval syncUUID_strrep = BER_BVNULL;
struct berval uuid_bv = BER_BVNULL;
- SlapReply rs = {REP_RESULT};
+ SlapReply rs_search = {REP_RESULT};
+ SlapReply rs_delete = {REP_RESULT};
+ SlapReply rs_add = {REP_RESULT};
+ SlapReply rs_modify = {REP_RESULT};
Filter f = {0};
AttributeAssertion ava = {0};
int rc = LDAP_SUCCESS;
si->si_syncUUID_ndn.bv_val = NULL;
- if ( limits_check( op, &rs ) == 0 ) {
- rc = be->be_search( op, &rs );
+ if ( limits_check( op, &rs_search ) == 0 ) {
+ rc = be->be_search( op, &rs_search );
}
if ( op->ors_filterstr.bv_val ) {
cb.sc_response = null_callback;
cb.sc_private = si;
- if ( rc == LDAP_SUCCESS && si->si_syncUUID_ndn.bv_val ) {
+ if ( rs_search.sr_err == LDAP_SUCCESS && si->si_syncUUID_ndn.bv_val ) {
char *subseq_ptr;
if ( syncstate != LDAP_SYNC_DELETE ) {
op->o_req_dn = si->si_syncUUID_ndn;
op->o_req_ndn = si->si_syncUUID_ndn;
op->o_tag = LDAP_REQ_DELETE;
- rc = be->be_delete( op, &rs );
+ rc = be->be_delete( op, &rs_delete );
org_req_dn = op->o_req_dn;
org_req_ndn = op->o_req_ndn;
op->o_ndn = op->o_bd->be_rootndn;
op->o_managedsait = 1;
- while ( rs.sr_err == LDAP_SUCCESS && op->o_delete_glue_parent ) {
+ while ( rs_delete.sr_err == LDAP_SUCCESS && op->o_delete_glue_parent ) {
op->o_delete_glue_parent = 0;
if ( !be_issuffix( op->o_bd, &op->o_req_ndn )) {
slap_callback cb = { NULL };
op->o_req_dn = pdn;
op->o_req_ndn = pdn;
op->o_callback = &cb;
- op->o_bd->be_delete( op, &rs );
+ op->o_bd->be_delete( op, &rs_delete );
} else {
break;
}
switch ( syncstate ) {
case LDAP_SYNC_ADD:
case LDAP_SYNC_MODIFY:
- if ( rc == LDAP_SUCCESS ||
- rc == LDAP_REFERRAL ||
- rc == LDAP_NO_SUCH_OBJECT ||
- rc == LDAP_NOT_ALLOWED_ON_NONLEAF )
+ if ( rs_search.sr_err == LDAP_SUCCESS ||
+ rs_search.sr_err == LDAP_REFERRAL ||
+ rs_search.sr_err == LDAP_NO_SUCH_OBJECT ||
+ rs_search.sr_err == LDAP_NOT_ALLOWED_ON_NONLEAF )
{
attr_delete( &e->e_attrs, slap_schema.si_ad_entryUUID );
attr_merge_one( e, slap_schema.si_ad_entryUUID,
op->ora_e = e;
op->o_req_dn = e->e_name;
op->o_req_ndn = e->e_nname;
- rc = be->be_add( op, &rs );
- if ( rc != LDAP_SUCCESS ) {
- if ( rc == LDAP_ALREADY_EXISTS ) {
+ rc = be->be_add( op, &rs_add );
+
+ if ( rs_add.sr_err != LDAP_SUCCESS ) {
+ if ( rs_add.sr_err == LDAP_ALREADY_EXISTS &&
+ rs_search.sr_err != LDAP_NO_SUCH_OBJECT ) {
Modifications *mod;
Modifications *modtail = modlist;
op->o_req_dn = e->e_name;
op->o_req_ndn = e->e_nname;
- rc = be->be_modify( op, &rs );
- if ( rc != LDAP_SUCCESS ) {
+ rc = be->be_modify( op, &rs_modify );
+ if ( rs_modify.sr_err != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
"syncrepl_entry : be_modify failed (%d)\n",
- rc, 0, 0 );
+ rs_modify.sr_err, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"syncrepl_entry : be_modify failed (%d)\n",
- rc, 0, 0 );
+ rs_modify.sr_err, 0, 0 );
#endif
}
ret = 1;
goto done;
- } else if ( rc == LDAP_REFERRAL || rc == LDAP_NO_SUCH_OBJECT ) {
+ } else if ( rs_modify.sr_err == LDAP_REFERRAL ||
+ rs_modify.sr_err == LDAP_NO_SUCH_OBJECT ) {
syncrepl_add_glue( op, e );
ret = 0;
goto done;
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
"syncrepl_entry : be_add failed (%d)\n",
- rc, 0, 0 );
+ rs_add.sr_err, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"syncrepl_entry : be_add failed (%d)\n",
- rc, 0, 0 );
+ rs_add.sr_err, 0, 0 );
#endif
ret = 1;
goto done;
} else {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
- "syncrepl_entry : be_search failed (%d)\n", rc, 0, 0 );
+ "syncrepl_entry : be_search failed (%d)\n",
+ rs_search.sr_err, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
- "syncrepl_entry : be_search failed (%d)\n", rc, 0, 0 );
+ "syncrepl_entry : be_search failed (%d)\n",
+ rs_search.sr_err, 0, 0 );
#endif
ret = 1;
goto done;
{
Backend* be = op->o_bd;
slap_callback cb = { NULL };
- SlapReply rs = {REP_RESULT};
+ SlapReply rs_search = {REP_RESULT};
+ SlapReply rs_delete = {REP_RESULT};
+ SlapReply rs_modify = {REP_RESULT};
struct nonpresent_entry *np_list, *np_prev;
int rc;
Modifications *ml;
op->o_nocaching = 1;
op->o_managedsait = 0;
- if ( limits_check( op, &rs ) == 0 ) {
- be->be_search( op, &rs );
+ if ( limits_check( op, &rs_search ) == 0 ) {
+ rc = be->be_search( op, &rs_search );
}
op->o_managedsait = 1;
cb.sc_private = si;
op->o_req_dn = *np_prev->npe_name;
op->o_req_ndn = *np_prev->npe_nname;
- rc = op->o_bd->be_delete( op, &rs );
+ rc = op->o_bd->be_delete( op, &rs_delete );
- if ( rc == LDAP_NOT_ALLOWED_ON_NONLEAF ) {
+ if ( rs_delete.sr_err == LDAP_NOT_ALLOWED_ON_NONLEAF ) {
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE;
mod->sml_desc = slap_schema.si_ad_objectClass;
op->o_tag = LDAP_REQ_MODIFY;
op->orm_modlist = modlist;
- rc = be->be_modify( op, &rs );
+ rc = be->be_modify( op, &rs_modify );
for ( ml = modlist; ml != NULL; ml = mlnext ) {
mlnext = ml->sml_next;
op->o_ndn = op->o_bd->be_rootndn;
op->o_managedsait = 1;
- while ( rs.sr_err == LDAP_SUCCESS &&
+ while ( rs_delete.sr_err == LDAP_SUCCESS &&
op->o_delete_glue_parent ) {
op->o_delete_glue_parent = 0;
if ( !be_issuffix( op->o_bd, &op->o_req_ndn )) {
op->o_req_ndn = pdn;
op->o_callback = &cb;
/* give it a root privil ? */
- op->o_bd->be_delete( op, &rs );
+ op->o_bd->be_delete( op, &rs_delete );
} else {
break;
}
struct berval dn = {0, NULL};
struct berval ndn = {0, NULL};
Entry *glue;
- SlapReply rs = {REP_RESULT};
+ SlapReply rs_add = {REP_RESULT};
char *ptr, *comma;
op->o_tag = LDAP_REQ_ADD;
op->o_req_dn = glue->e_name;
op->o_req_ndn = glue->e_nname;
op->ora_e = glue;
- rc = be->be_add ( op, &rs );
- if ( rc == LDAP_SUCCESS ) {
+ rc = be->be_add ( op, &rs_add );
+ if ( rs_add.sr_err == LDAP_SUCCESS ) {
be_entry_release_w( op, glue );
} else {
/* incl. ALREADY EXIST */
op->o_req_dn = e->e_name;
op->o_req_ndn = e->e_nname;
op->ora_e = e;
- rc = be->be_add ( op, &rs );
- if ( rc == LDAP_SUCCESS ) {
+ rc = be->be_add ( op, &rs_add );
+ if ( rs_add.sr_err == LDAP_SUCCESS ) {
be_entry_release_w( op, e );
} else {
entry_free( e );
struct berval slap_syncrepl_cn_bv = BER_BVNULL;
slap_callback cb = { NULL };
- SlapReply rs = {REP_RESULT};
+ SlapReply rs_add = {REP_RESULT};
+ SlapReply rs_modify = {REP_RESULT};
slap_sync_cookie_free( &si->si_syncCookie, 0 );
slap_dup_sync_cookie( &si->si_syncCookie, syncCookie );
update_cookie_retry:
op->o_tag = LDAP_REQ_MODIFY;
op->orm_modlist = modlist;
- rc = be->be_modify( op, &rs );
+ rc = be->be_modify( op, &rs_modify );
- if ( rc != LDAP_SUCCESS ) {
- if ( rc == LDAP_REFERRAL ||
- rc == LDAP_NO_SUCH_OBJECT ) {
+ if ( rs_modify.sr_err != LDAP_SUCCESS ) {
+ if ( rs_modify.sr_err == LDAP_REFERRAL ||
+ rs_modify.sr_err == LDAP_NO_SUCH_OBJECT ) {
op->o_tag = LDAP_REQ_ADD;
op->ora_e = e;
- rc = be->be_add( op, &rs );
- if ( rc != LDAP_SUCCESS ) {
- if ( rc == LDAP_ALREADY_EXISTS ) {
+ rc = be->be_add( op, &rs_add );
+ if ( rs_add.sr_err != LDAP_SUCCESS ) {
+ if ( rs_add.sr_err == LDAP_ALREADY_EXISTS ) {
goto update_cookie_retry;
- } else if ( rc == LDAP_REFERRAL ||
- rc == LDAP_NO_SUCH_OBJECT ) {
+ } else if ( rs_add.sr_err == LDAP_REFERRAL ||
+ rs_add.sr_err == LDAP_NO_SUCH_OBJECT ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
"cookie will be non-persistent\n",
} else {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
- "be_add failed (%d)\n",
- rc, 0, 0 );
+ "be_add failed (%d)\n", rs_add.sr_err, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
- "be_add failed (%d)\n",
- rc, 0, 0 );
+ "be_add failed (%d)\n", rs_add.sr_err, 0, 0 );
#endif
}
} else {
} else {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
- "be_modify failed (%d)\n", rc, 0, 0 );
+ "be_modify failed (%d)\n", rs_modify.sr_err, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
- "be_modify failed (%d)\n", rc, 0, 0 );
+ "be_modify failed (%d)\n", rs_modify.sr_err, 0, 0 );
#endif
}
}