dncookie dc;
int msgid;
int do_retry = 1;
+ int maperr = 1;
Debug(LDAP_DEBUG_ARGS, "==> meta_back_add: %s\n",
op->o_req_dn.bv_val, 0, 0 );
}
rs->sr_err = LDAP_OTHER;
+ maperr = 0;
rc = ldap_result( mc->mc_conns[ candidate ].msc_ld,
msgid, LDAP_MSG_ALL, tvp, &res );
switch ( rc ) {
case -1:
- send_ldap_result( op, rs );
- goto cleanup;
+ break;
case 0:
ldap_abandon_ext( mc->mc_conns[ candidate ].msc_ld,
msgid, NULL, NULL );
rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
LDAP_ADMINLIMIT_EXCEEDED : LDAP_OPERATIONS_ERROR;
- send_ldap_result( op, rs );
- goto cleanup;
+ break;
case LDAP_RES_ADD:
rc = ldap_parse_result( mc->mc_conns[ candidate ].msc_ld,
if ( rc != LDAP_SUCCESS ) {
rs->sr_err = rc;
}
+ maperr = 1;
break;
default:
}
}
- (void)meta_back_op_result( mc, op, rs, candidate );
+ if ( maperr ) {
+ rs->sr_err = meta_back_op_result( mc, op, rs, candidate );
+
+ } else {
+ send_ldap_result( op, rs );
+ }
cleanup:;
for ( --i; i >= 0; --i ) {
dncookie dc;
int msgid;
int do_retry = 1;
+ int maperr = 1;
mc = meta_back_getconn( op, rs, &candidate, LDAP_BACK_SENDERR );
if ( !mc || !meta_back_dobind( op, rs, mc, LDAP_BACK_SENDERR ) ) {
}
rs->sr_err = LDAP_OTHER;
+ maperr = 0;
rc = ldap_result( mc->mc_conns[ candidate ].msc_ld,
msgid, LDAP_MSG_ALL, tvp, &res );
switch ( rc ) {
case -1:
rs->sr_err = LDAP_OTHER;
- send_ldap_result( op, rs );
- goto cleanup;
+ break;
case 0:
ldap_abandon_ext( mc->mc_conns[ candidate ].msc_ld,
msgid, NULL, NULL );
rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
LDAP_ADMINLIMIT_EXCEEDED : LDAP_OPERATIONS_ERROR;
- send_ldap_result( op, rs );
- goto cleanup;
+ break;
case LDAP_RES_DELETE:
rc = ldap_parse_result( mc->mc_conns[ candidate ].msc_ld,
if ( rc != LDAP_SUCCESS ) {
rs->sr_err = rc;
}
+ maperr = 1;
break;
default:
}
}
- rs->sr_err = meta_back_op_result( mc, op, rs, candidate );
+ if ( maperr ) {
+ rs->sr_err = meta_back_op_result( mc, op, rs, candidate );
+
+ } else {
+ send_ldap_result( op, rs );
+ }
cleanup:;
if ( mdn.bv_val != op->o_req_dn.bv_val ) {
if ( mt->mt_uri ) {
free( mt->mt_uri );
}
+ if ( mt->mt_subtree_exclude ) {
+ ber_bvarray_free( mt->mt_subtree_exclude );
+ }
if ( !BER_BVISNULL( &mt->mt_psuffix ) ) {
free( mt->mt_psuffix.bv_val );
}
metainfo_t *mi = ( metainfo_t * )op->o_bd->be_private;
metaconn_t *mc;
int rc = 0;
+ int maperr = 1;
LDAPMod **modv = NULL;
LDAPMod *mods = NULL;
Modifications *ml;
dc.ctx = "modifyDN";
if ( ldap_back_dn_massage( &dc, &op->o_req_dn, &mdn ) ) {
- rc = -1;
+ maperr = 0;
goto cleanup;
}
mods = ch_malloc( sizeof( LDAPMod )*i );
if ( mods == NULL ) {
rs->sr_err = LDAP_NO_MEMORY;
- rc = -1;
+ maperr = 0;
goto cleanup;
}
modv = ( LDAPMod ** )ch_malloc( ( i + 1 )*sizeof( LDAPMod * ) );
if ( modv == NULL ) {
rs->sr_err = LDAP_NO_MEMORY;
- rc = -1;
+ maperr = 0;
goto cleanup;
}
msgid, LDAP_MSG_ALL, tvp, &res );
switch ( rc ) {
case -1:
- rc = -1;
+ maperr = 0;
break;
case 0:
msgid, NULL, NULL );
rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
LDAP_ADMINLIMIT_EXCEEDED : LDAP_OPERATIONS_ERROR;
- rc = -1;
+ maperr = 0;
break;
case LDAP_RES_MODIFY:
if ( rc != LDAP_SUCCESS ) {
rs->sr_err = rc;
}
- rc = 0;
+ maperr = 1;
break;
default:
- rc = -1;
+ maperr = 0;
ldap_msgfree( res );
break;
}
free( mods );
free( modv );
- if ( rc != -1 ) {
+ if ( maperr ) {
rc = meta_back_op_result( mc, op, rs, candidate );
} else {
send_ldap_result( op, rs );
- rc = 0;
}
meta_back_release_conn( op, mc );
- return rc;
+ return rs->sr_err;
}
dncookie dc;
int msgid;
int do_retry = 1;
+ int maperr = 1;
mc = meta_back_getconn( op, rs, &candidate, LDAP_BACK_SENDERR );
if ( !mc || !meta_back_dobind( op, rs, mc, LDAP_BACK_SENDERR ) ) {
dc.ctx = "newSuperiorDN";
if ( ldap_back_dn_massage( &dc, op->orr_newSup, &mnewSuperior ) ) {
rs->sr_err = LDAP_OTHER;
+ maperr = 0;
goto cleanup;
}
}
dc.ctx = "modrDN";
if ( ldap_back_dn_massage( &dc, &op->o_req_dn, &mdn ) ) {
rs->sr_err = LDAP_OTHER;
+ maperr = 0;
goto cleanup;
}
rs->sr_err = LDAP_OTHER;
rc = ldap_result( mc->mc_conns[ candidate ].msc_ld,
msgid, LDAP_MSG_ALL, tvp, &res );
+ maperr = 0;
switch ( rc ) {
case -1:
break;
if ( rc != LDAP_SUCCESS ) {
rs->sr_err = rc;
}
+ maperr = 1;
break;
default:
BER_BVZERO( &mnewSuperior );
}
- if ( rs->sr_err == LDAP_SUCCESS ) {
+ if ( maperr ) {
meta_back_op_result( mc, op, rs, candidate );
+
} else {
send_ldap_result( op, rs );
}