ldapinfo_t *li = (ldapinfo_t *)op->o_bd->be_private;
char *match = NULL;
- LDAPMessage *res = NULL;
char *text = NULL;
char **refs = NULL;
LDAPControl **ctrls = NULL;
if ( ERR_OK( rs->sr_err ) ) {
int rc;
struct timeval tv;
+ LDAPMessage *res = NULL;
if ( timeout ) {
tv.tv_sec = timeout;
int msgid;
int do_retry = 1;
LDAPControl **ctrls = NULL;
- int maperr = 1;
Debug(LDAP_DEBUG_ARGS, "==> meta_back_add: %s\n",
op->o_req_dn.bv_val, 0, 0 );
if ( ldap_back_proxy_authz_ctrl( &mc->mc_conns[ candidate ].msc_bound_ndn,
mt->mt_version, &mt->mt_idassert, op, rs, &ctrls ) != LDAP_SUCCESS )
{
- maperr = 0;
- goto sendres;
+ send_ldap_result( op, rs );
+ goto cleanup;
}
retry:;
rs->sr_err = ldap_add_ext( mc->mc_conns[ candidate ].msc_ld, mdn.bv_val,
attrs, ctrls, NULL, &msgid );
+ rs->sr_err = meta_back_op_result( mc, op, rs, candidate, msgid,
+ mt->mt_timeout[ LDAP_BACK_OP_ADD ], LDAP_BACK_SENDRESULT );
if ( rs->sr_err == LDAP_UNAVAILABLE && do_retry ) {
do_retry = 0;
if ( meta_back_retry( op, rs, &mc, candidate, LDAP_BACK_SENDERR ) ) {
goto retry;
}
- goto cleanup;
-
- } else if ( rs->sr_err == LDAP_SUCCESS ) {
- struct timeval tv, *tvp = NULL;
- LDAPMessage *res = NULL;
- int rc;
-
- if ( mt->mt_timeout[ LDAP_BACK_OP_ADD ] != 0 ) {
- tv.tv_sec = mt->mt_timeout[ LDAP_BACK_OP_ADD ];
- tv.tv_usec = 0;
- tvp = &tv;
- }
-
- 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:
- break;
-
- case 0:
- (void)meta_back_cancel( mc, op, rs, msgid, candidate, LDAP_BACK_DONTSEND );
- rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
- LDAP_ADMINLIMIT_EXCEEDED : LDAP_OPERATIONS_ERROR;
- break;
-
- case LDAP_RES_ADD:
- /* FIXME: matched? referrals? response controls? */
- rc = ldap_parse_result( mc->mc_conns[ candidate ].msc_ld,
- res, &rs->sr_err, NULL, NULL, NULL, NULL, 1 );
- if ( rc != LDAP_SUCCESS ) {
- rs->sr_err = rc;
- }
- maperr = 1;
- break;
-
- default:
- ldap_msgfree( res );
- break;
- }
}
-sendres:;
+cleanup:;
(void)ldap_back_proxy_authz_ctrl_free( op, &ctrls );
- if ( maperr ) {
- rs->sr_err = meta_back_op_result( mc, op, rs, candidate );
-
- } else {
- send_ldap_result( op, rs );
-
- if ( META_BACK_TGT_QUARANTINE( mt ) ) {
- meta_back_quarantine( op, rs, candidate );
- }
- }
-
-cleanup:;
for ( --i; i >= 0; --i ) {
free( attrs[ i ]->mod_bvalues );
free( attrs[ i ] );
#define META_RETRY_UNDEFINED (-2)
#define META_RETRY_FOREVER (-1)
#define META_RETRY_NEVER (0)
-#define META_RETRY_DEFAULT (3)
+#define META_RETRY_DEFAULT (10)
struct ldaprwmap mt_rwmap;
metaconn_t *mc,
Operation *op,
SlapReply *rs,
- int candidate );
+ int candidate,
+ ber_int_t msgid,
+ time_t timeout,
+ ldap_back_send_t sendok );
extern int
back_meta_LTX_init_module(
*/
int
meta_back_op_result(
- metaconn_t *mc,
- Operation *op,
- SlapReply *rs,
- int candidate )
+ metaconn_t *mc,
+ Operation *op,
+ SlapReply *rs,
+ int candidate,
+ ber_int_t msgid,
+ time_t timeout,
+ ldap_back_send_t sendok )
{
- metainfo_t *mi = ( metainfo_t * )op->o_bd->be_private;
+ metainfo_t *mi = ( metainfo_t * )op->o_bd->be_private;
+
+ const char *save_text = rs->sr_text,
+ *save_matched = rs->sr_matched;
+ BerVarray save_ref = rs->sr_ref;
+ LDAPControl **save_ctrls = rs->sr_ctrls;
+ void *matched_ctx = NULL;
- int i,
- rerr = LDAP_SUCCESS;
- char *rmsg = NULL,
- *rmatch = NULL;
- const char *save_rmsg = NULL,
- *save_rmatch = NULL;
- void *rmatch_ctx = NULL;
+ char *matched = NULL;
+ char *text = NULL;
+ char **refs = NULL;
+ LDAPControl **ctrls = NULL;
assert( mc != NULL );
+ rs->sr_text = NULL;
+ rs->sr_matched = NULL;
+ rs->sr_ref = NULL;
+ rs->sr_ctrls = NULL;
+
if ( candidate != META_TARGET_NONE ) {
+ metatarget_t *mt = mi->mi_targets[ candidate ];
metasingleconn_t *msc = &mc->mc_conns[ candidate ];
- rs->sr_err = LDAP_SUCCESS;
+#define ERR_OK(err) ((err) == LDAP_SUCCESS || (err) == LDAP_COMPARE_FALSE || (err) == LDAP_COMPARE_TRUE)
- ldap_get_option( msc->msc_ld, LDAP_OPT_ERROR_NUMBER, &rs->sr_err );
- if ( rs->sr_err != LDAP_SUCCESS ) {
- /*
- * better check the type of error. In some cases
- * (search ?) it might be better to return a
- * success if at least one of the targets gave
- * positive result ...
- */
- ldap_get_option( msc->msc_ld,
- LDAP_OPT_ERROR_STRING, &rmsg );
- if ( rmsg != NULL && rmsg[ 0 ] == '\0' ) {
- ldap_memfree( rmsg );
- rmsg = NULL;
+ if ( ERR_OK( rs->sr_err ) ) {
+ int rc;
+ struct timeval tv;
+ LDAPMessage *res = NULL;
+
+ if ( timeout ) {
+ tv.tv_sec = timeout;
+ tv.tv_usec = 0;
+
+ } else {
+ LDAP_BACK_TV_SET( &tv );
}
- ldap_get_option( msc->msc_ld,
- LDAP_OPT_MATCHED_DN, &rmatch );
- if ( rmatch != NULL && rmatch[ 0 ] == '\0' ) {
- ldap_memfree( rmatch );
- rmatch = NULL;
+retry:;
+ rc = ldap_result( msc->msc_ld, msgid, LDAP_MSG_ALL, &tv, &res );
+ switch ( rc ) {
+ case 0:
+ if ( timeout ) {
+ (void)meta_back_cancel( mc, op, rs, msgid, candidate, sendok );
+ rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
+ LDAP_ADMINLIMIT_EXCEEDED : LDAP_OPERATIONS_ERROR;
+ rs->sr_text = "Operation timed out";
+ break;
+ }
+
+ LDAP_BACK_TV_SET( &tv );
+ ldap_pvt_thread_yield();
+ goto retry;
+
+ case -1:
+ ldap_get_option( msc->msc_ld, LDAP_OPT_ERROR_NUMBER,
+ &rs->sr_err );
+ break;
+
+
+ /* otherwise get the result; if it is not
+ * LDAP_SUCCESS, record it in the reply
+ * structure (this includes
+ * LDAP_COMPARE_{TRUE|FALSE}) */
+ default:
+ rc = ldap_parse_result( msc->msc_ld, res, &rs->sr_err,
+ &matched, &text, &refs, &ctrls, 1 );
+ res = NULL;
+ rs->sr_text = text;
+ if ( rc != LDAP_SUCCESS ) {
+ rs->sr_err = rc;
+ }
+ if ( refs != NULL ) {
+ int i;
+
+ for ( i = 0; refs[ i ] != NULL; i++ )
+ /* count */ ;
+ rs->sr_ref = op->o_tmpalloc( sizeof( struct berval ) * ( i + 1 ),
+ op->o_tmpmemctx );
+ for ( i = 0; refs[ i ] != NULL; i++ ) {
+ ber_str2bv( refs[ i ], 0, 0, &rs->sr_ref[ i ] );
+ }
+ BER_BVZERO( &rs->sr_ref[ i ] );
+ }
+ if ( ctrls != NULL ) {
+ rs->sr_ctrls = ctrls;
+ }
}
- rerr = rs->sr_err = slap_map_api2result( rs );
+ assert( res == NULL );
+ }
+
+ /* if the error in the reply structure is not
+ * LDAP_SUCCESS, try to map it from client
+ * to server error */
+ if ( !ERR_OK( rs->sr_err ) ) {
+ rs->sr_err = slap_map_api2result( rs );
- if ( LogTest( LDAP_DEBUG_ANY ) ) {
- char buf[ SLAP_TEXT_BUFLEN ];
+ /* internal ops ( op->o_conn == NULL )
+ * must not reply to client */
+ if ( op->o_conn && !op->o_do_not_cache && matched ) {
- snprintf( buf, sizeof( buf ),
- "meta_back_op_result[%d] "
- "err=%d text=\"%s\" matched=\"%s\"",
- candidate, rs->sr_err,
- ( rmsg ? rmsg : "" ),
- ( rmatch ? rmatch : "" ) );
- Debug( LDAP_DEBUG_ANY, "%s %s.\n",
- op->o_log_prefix, buf, 0 );
+ /* record the (massaged) matched
+ * DN into the reply structure */
+ rs->sr_matched = matched;
}
}
- if ( META_BACK_TGT_QUARANTINE( mi->mi_targets[ candidate ] ) ) {
+ if ( META_BACK_TGT_QUARANTINE( mt ) ) {
meta_back_quarantine( op, rs, candidate );
}
} else {
+ int i,
+ err = rs->sr_err;
+
for ( i = 0; i < mi->mi_ntargets; i++ ) {
metasingleconn_t *msc = &mc->mc_conns[ i ];
- char *msg = NULL;
- char *match = NULL;
+ char *xtext = NULL;
+ char *xmatched = NULL;
rs->sr_err = LDAP_SUCCESS;
* positive result ...
*/
ldap_get_option( msc->msc_ld,
- LDAP_OPT_ERROR_STRING, &msg );
- if ( msg != NULL && msg[ 0 ] == '\0' ) {
- ldap_memfree( msg );
- msg = NULL;
+ LDAP_OPT_ERROR_STRING, &xtext );
+ if ( xtext != NULL && xtext [ 0 ] == '\0' ) {
+ ldap_memfree( xtext );
+ xtext = NULL;
}
ldap_get_option( msc->msc_ld,
- LDAP_OPT_MATCHED_DN, &match );
- if ( match != NULL && match[ 0 ] == '\0' ) {
- ldap_memfree( match );
- match = NULL;
+ LDAP_OPT_MATCHED_DN, &xmatched );
+ if ( xmatched != NULL && xmatched[ 0 ] == '\0' ) {
+ ldap_memfree( xmatched );
+ xmatched = NULL;
}
rs->sr_err = slap_map_api2result( rs );
"meta_back_op_result[%d] "
"err=%d text=\"%s\" matched=\"%s\"",
i, rs->sr_err,
- ( rmsg ? rmsg : "" ),
- ( rmatch ? rmatch : "" ) );
+ ( xtext ? xtext : "" ),
+ ( xmatched ? xmatched : "" ) );
Debug( LDAP_DEBUG_ANY, "%s %s.\n",
op->o_log_prefix, buf, 0 );
}
-
+
/*
* FIXME: need to rewrite "match" (need rwinfo)
*/
switch ( rs->sr_err ) {
default:
- rerr = rs->sr_err;
- if ( msg != NULL ) {
- if ( rmsg ) {
- ldap_memfree( rmsg );
+ err = rs->sr_err;
+ if ( xtext != NULL ) {
+ if ( text ) {
+ ldap_memfree( text );
}
- rmsg = msg;
- msg = NULL;
+ text = xtext;
+ xtext = NULL;
}
- if ( match != NULL ) {
- if ( rmatch ) {
- ldap_memfree( rmatch );
+ if ( xmatched != NULL ) {
+ if ( matched ) {
+ ldap_memfree( matched );
}
- rmatch = match;
- match = NULL;
+ matched = xmatched;
+ xmatched = NULL;
}
break;
}
- if ( msg ) {
- ldap_memfree( msg );
+ if ( xtext ) {
+ ldap_memfree( xtext );
}
- if ( match ) {
- ldap_memfree( match );
+ if ( xmatched ) {
+ ldap_memfree( xmatched );
}
}
meta_back_quarantine( op, rs, i );
}
}
+
+ if ( err != LDAP_SUCCESS ) {
+ rs->sr_err = err;
+ }
}
-
- rs->sr_err = rerr;
- if ( rmsg != NULL ) {
- save_rmsg = rs->sr_text;
- rs->sr_text = rmsg;
- }
- if ( rmatch != NULL ) {
+
+ if ( matched != NULL ) {
struct berval dn, pdn;
- ber_str2bv( rmatch, 0, 0, &dn );
+ ber_str2bv( matched, 0, 0, &dn );
if ( dnPretty( NULL, &dn, &pdn, op->o_tmpmemctx ) == LDAP_SUCCESS ) {
- ldap_memfree( rmatch );
- rmatch_ctx = op->o_tmpmemctx;
- rmatch = pdn.bv_val;
+ ldap_memfree( matched );
+ matched_ctx = op->o_tmpmemctx;
+ matched = pdn.bv_val;
}
- save_rmatch = rs->sr_matched;
- rs->sr_matched = rmatch;
+ rs->sr_matched = matched;
+ }
+
+ if ( op->o_conn &&
+ ( ( sendok & LDAP_BACK_SENDOK )
+ || ( ( sendok & LDAP_BACK_SENDERR ) && rs->sr_err != LDAP_SUCCESS ) ) )
+ {
+ send_ldap_result( op, rs );
}
- send_ldap_result( op, rs );
- if ( rmsg != NULL ) {
- ber_memfree( rmsg );
- rs->sr_text = save_rmsg;
+ if ( matched ) {
+ op->o_tmpfree( (char *)rs->sr_matched, matched_ctx );
}
- if ( rmatch != NULL ) {
- ber_memfree_x( rmatch, rmatch_ctx );
- rs->sr_matched = save_rmatch;
+ if ( text ) {
+ ldap_memfree( text );
}
+ if ( rs->sr_ref ) {
+ assert( refs != NULL );
+ ber_memvfree( (void **)refs );
+ op->o_tmpfree( rs->sr_ref, op->o_tmpmemctx );
+ }
+ if ( ctrls ) {
+ assert( rs->sr_ctrls != NULL );
+ ldap_controls_free( ctrls );
+ }
+
+ rs->sr_text = save_text;
+ rs->sr_matched = save_matched;
+ rs->sr_ref = save_ref;
+ rs->sr_ctrls = save_ctrls;
- return ( ( rerr == LDAP_SUCCESS ) ? 0 : -1 );
+ return( ERR_OK( rs->sr_err ) ? LDAP_SUCCESS : rs->sr_err );
}
/*
dncookie dc;
int msgid;
int do_retry = 1;
- int maperr = 1;
LDAPControl **ctrls = NULL;
mc = meta_back_getconn( op, rs, &candidate, LDAP_BACK_SENDERR );
if ( ldap_back_dn_massage( &dc, &op->o_req_dn, &mdn ) ) {
send_ldap_result( op, rs );
- goto done;
+ goto cleanup;
}
ctrls = op->o_ctrls;
if ( ldap_back_proxy_authz_ctrl( &mc->mc_conns[ candidate ].msc_bound_ndn,
mt->mt_version, &mt->mt_idassert, op, rs, &ctrls ) != LDAP_SUCCESS )
{
- maperr = 0;
- goto sendres;
+ send_ldap_result( op, rs );
+ goto cleanup;
}
retry:;
rs->sr_err = ldap_delete_ext( mc->mc_conns[ candidate ].msc_ld,
mdn.bv_val, ctrls, NULL, &msgid );
+ rs->sr_err = meta_back_op_result( mc, op, rs, candidate, msgid,
+ mt->mt_timeout[ LDAP_BACK_OP_DELETE ], LDAP_BACK_SENDRESULT );
if ( rs->sr_err == LDAP_UNAVAILABLE && do_retry ) {
do_retry = 0;
if ( meta_back_retry( op, rs, &mc, candidate, LDAP_BACK_SENDERR ) ) {
goto retry;
}
- goto cleanup;
-
- } else if ( rs->sr_err == LDAP_SUCCESS ) {
- struct timeval tv, *tvp = NULL;
- LDAPMessage *res = NULL;
- int rc;
-
- if ( mt->mt_timeout[ LDAP_BACK_OP_DELETE ] != 0 ) {
- tv.tv_sec = mt->mt_timeout[ LDAP_BACK_OP_DELETE ];
- tv.tv_usec = 0;
- tvp = &tv;
- }
-
- 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;
- break;
-
- case 0:
- (void)meta_back_cancel( mc, op, rs, msgid, candidate, LDAP_BACK_DONTSEND );
- rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
- LDAP_ADMINLIMIT_EXCEEDED : LDAP_OPERATIONS_ERROR;
- break;
-
- case LDAP_RES_DELETE:
- /* FIXME: matched? referrals? response controls? */
- rc = ldap_parse_result( mc->mc_conns[ candidate ].msc_ld,
- res, &rs->sr_err, NULL, NULL, NULL, NULL, 1 );
- if ( rc != LDAP_SUCCESS ) {
- rs->sr_err = rc;
- }
- maperr = 1;
- break;
-
- default:
- ldap_msgfree( res );
- break;
- }
}
-sendres:;
+cleanup:;
(void)ldap_back_proxy_authz_ctrl_free( op, &ctrls );
- if ( maperr ) {
- rs->sr_err = meta_back_op_result( mc, op, rs, candidate );
-
- } else {
- send_ldap_result( op, rs );
-
- if ( META_BACK_TGT_QUARANTINE( mt ) ) {
- meta_back_quarantine( op, rs, candidate );
- }
- }
-
-cleanup:;
if ( mdn.bv_val != op->o_req_dn.bv_val ) {
free( mdn.bv_val );
BER_BVZERO( &mdn );
}
-done:;
if ( mc ) {
meta_back_release_conn( op, mc );
}
metatarget_t *mt;
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 ) ) {
- maperr = 0;
+ send_ldap_result( op, rs );
goto cleanup;
}
mods = ch_malloc( sizeof( LDAPMod )*i );
if ( mods == NULL ) {
- rs->sr_err = LDAP_NO_MEMORY;
- maperr = 0;
+ rs->sr_err = LDAP_OTHER;
+ send_ldap_result( op, rs );
goto cleanup;
}
modv = ( LDAPMod ** )ch_malloc( ( i + 1 )*sizeof( LDAPMod * ) );
if ( modv == NULL ) {
- rs->sr_err = LDAP_NO_MEMORY;
- maperr = 0;
+ rs->sr_err = LDAP_OTHER;
+ send_ldap_result( op, rs );
goto cleanup;
}
rc = ldap_back_proxy_authz_ctrl( &mc->mc_conns[ candidate ].msc_bound_ndn,
mt->mt_version, &mt->mt_idassert, op, rs, &ctrls );
if ( rc != LDAP_SUCCESS ) {
- maperr = 0;
+ send_ldap_result( op, rs );
goto cleanup;
}
retry:;
rs->sr_err = ldap_modify_ext( mc->mc_conns[ candidate ].msc_ld, mdn.bv_val,
modv, ctrls, NULL, &msgid );
+ rs->sr_err = meta_back_op_result( mc, op, rs, candidate, msgid,
+ mt->mt_timeout[ LDAP_BACK_OP_MODIFY ], LDAP_BACK_SENDRESULT );
if ( rs->sr_err == LDAP_UNAVAILABLE && do_retry ) {
do_retry = 0;
if ( meta_back_retry( op, rs, &mc, candidate, LDAP_BACK_SENDERR ) ) {
goto retry;
}
- goto done;
-
- } else if ( rs->sr_err == LDAP_SUCCESS ) {
- struct timeval tv, *tvp = NULL;
- LDAPMessage *res = NULL;
-
- if ( mt->mt_timeout[ LDAP_BACK_OP_MODIFY ] != 0 ) {
- tv.tv_sec = mt->mt_timeout[ LDAP_BACK_OP_MODIFY ];
- tv.tv_usec = 0;
- tvp = &tv;
- }
-
- rs->sr_err = LDAP_OTHER;
- rc = ldap_result( mc->mc_conns[ candidate ].msc_ld,
- msgid, LDAP_MSG_ALL, tvp, &res );
- switch ( rc ) {
- case -1:
- maperr = 0;
- break;
-
- case 0:
- (void)meta_back_cancel( mc, op, rs, msgid, candidate, LDAP_BACK_DONTSEND );
- rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
- LDAP_ADMINLIMIT_EXCEEDED : LDAP_OPERATIONS_ERROR;
- maperr = 0;
- break;
-
- case LDAP_RES_MODIFY:
- /* FIXME: matched? referrals? response controls? */
- rc = ldap_parse_result( mc->mc_conns[ candidate ].msc_ld,
- res, &rs->sr_err, NULL, NULL, NULL, NULL, 1 );
- if ( rc != LDAP_SUCCESS ) {
- rs->sr_err = rc;
- }
- maperr = 1;
- break;
-
- default:
- maperr = 0;
- ldap_msgfree( res );
- break;
- }
}
cleanup:;
(void)ldap_back_proxy_authz_ctrl_free( op, &ctrls );
- if ( maperr ) {
- rc = meta_back_op_result( mc, op, rs, candidate );
-
- } else {
- send_ldap_result( op, rs );
-
- if ( META_BACK_TGT_QUARANTINE( mt ) ) {
- meta_back_quarantine( op, rs, candidate );
- }
- }
-
-done:;
if ( mdn.bv_val != op->o_req_dn.bv_val ) {
free( mdn.bv_val );
BER_BVZERO( &mdn );
dncookie dc;
int msgid;
int do_retry = 1;
- int maperr = 1;
LDAPControl **ctrls = NULL;
mc = meta_back_getconn( op, rs, &candidate, LDAP_BACK_SENDERR );
/* op->o_protocol cannot be anything but LDAPv3,
* otherwise wouldn't be here */
rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
- maperr = 0;
+ send_ldap_result( op, rs );
goto cleanup;
}
dc.ctx = "newSuperiorDN";
if ( ldap_back_dn_massage( &dc, op->orr_newSup, &mnewSuperior ) ) {
rs->sr_err = LDAP_OTHER;
- maperr = 0;
+ send_ldap_result( op, rs );
goto cleanup;
}
}
dc.ctx = "modrDN";
if ( ldap_back_dn_massage( &dc, &op->o_req_dn, &mdn ) ) {
rs->sr_err = LDAP_OTHER;
- maperr = 0;
+ send_ldap_result( op, rs );
goto cleanup;
}
if ( ldap_back_proxy_authz_ctrl( &mc->mc_conns[ candidate ].msc_bound_ndn,
mt->mt_version, &mt->mt_idassert, op, rs, &ctrls ) != LDAP_SUCCESS )
{
- maperr = 0;
+ send_ldap_result( op, rs );
goto cleanup;
}
mdn.bv_val, op->orr_newrdn.bv_val,
mnewSuperior.bv_val, op->orr_deleteoldrdn,
ctrls, NULL, &msgid );
+ rs->sr_err = meta_back_op_result( mc, op, rs, candidate, msgid,
+ mt->mt_timeout[ LDAP_BACK_OP_MODRDN ], LDAP_BACK_SENDRESULT );
if ( rs->sr_err == LDAP_UNAVAILABLE && do_retry ) {
do_retry = 0;
if ( meta_back_retry( op, rs, &mc, candidate, LDAP_BACK_SENDERR ) ) {
goto retry;
}
- goto done;
-
- } else if ( rs->sr_err == LDAP_SUCCESS ) {
- struct timeval tv, *tvp = NULL;
- LDAPMessage *res = NULL;
- int rc;
-
- if ( mt->mt_timeout[ LDAP_BACK_OP_MODRDN ] != 0 ) {
- tv.tv_sec = mt->mt_timeout[ LDAP_BACK_OP_MODRDN ];
- tv.tv_usec = 0;
- tvp = &tv;
- }
-
- 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;
-
- case 0:
- (void)meta_back_cancel( mc, op, rs, msgid, candidate, LDAP_BACK_DONTSEND );
- rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
- LDAP_ADMINLIMIT_EXCEEDED : LDAP_OPERATIONS_ERROR;
- break;
-
- case LDAP_RES_RENAME:
- /* FIXME: matched? referrals? response controls? */
- rc = ldap_parse_result( mc->mc_conns[ candidate ].msc_ld,
- res, &rs->sr_err, NULL, NULL, NULL, NULL, 1 );
- if ( rc != LDAP_SUCCESS ) {
- rs->sr_err = rc;
- }
- maperr = 1;
- break;
-
- default:
- ldap_msgfree( res );
- break;
- }
}
cleanup:;
(void)ldap_back_proxy_authz_ctrl_free( op, &ctrls );
- if ( maperr ) {
- meta_back_op_result( mc, op, rs, candidate );
-
- } else {
- send_ldap_result( op, rs );
-
- if ( META_BACK_TGT_QUARANTINE( mt ) ) {
- meta_back_quarantine( op, rs, candidate );
- }
- }
-
-done:;
if ( mdn.bv_val != op->o_req_dn.bv_val ) {
free( mdn.bv_val );
BER_BVZERO( &mdn );
* FIXME: need a better strategy to handle errors
*/
if ( mc ) {
- rc = meta_back_op_result( mc, op, rs, META_TARGET_NONE );
+ rc = meta_back_op_result( mc, op, rs, META_TARGET_NONE,
+ -1, stoptime != -1 ? (stoptime - slap_get_time()) : 0,
+ LDAP_BACK_SENDERR );
} else {
rc = rs->sr_err;
}