ITS#6133: Handlers for Abandon, Cancel, connection init/destroy

should not exist.  Catch coredump.  Fix error/result code handling.
This commit is contained in:
Hallvard Furuseth 2009-05-21 00:09:30 +00:00
parent 18905416c9
commit 23a726395f
2 changed files with 22 additions and 32 deletions

View File

@ -158,20 +158,12 @@ relay_back_initialize( BackendInfo *bi )
bi->bi_op_modrdn = relay_back_op_modrdn; bi->bi_op_modrdn = relay_back_op_modrdn;
bi->bi_op_add = relay_back_op_add; bi->bi_op_add = relay_back_op_add;
bi->bi_op_delete = relay_back_op_delete; bi->bi_op_delete = relay_back_op_delete;
bi->bi_op_abandon = relay_back_op_abandon;
bi->bi_op_cancel = relay_back_op_cancel;
bi->bi_extended = relay_back_op_extended; bi->bi_extended = relay_back_op_extended;
bi->bi_entry_release_rw = relay_back_entry_release_rw; bi->bi_entry_release_rw = relay_back_entry_release_rw;
bi->bi_entry_get_rw = relay_back_entry_get_rw; bi->bi_entry_get_rw = relay_back_entry_get_rw;
#if 0 /* see comment in op.c */
bi->bi_chk_referrals = relay_back_chk_referrals;
#endif
bi->bi_operational = relay_back_operational; bi->bi_operational = relay_back_operational;
bi->bi_has_subordinates = relay_back_has_subordinates; bi->bi_has_subordinates = relay_back_has_subordinates;
bi->bi_connection_init = relay_back_connection_init;
bi->bi_connection_destroy = relay_back_connection_destroy;
bi->bi_cf_ocs = relayocs; bi->bi_cf_ocs = relayocs;
return config_register_schema( relaycfg, relayocs ); return config_register_schema( relaycfg, relayocs );

View File

@ -74,24 +74,18 @@ relay_back_select_backend( Operation *op, SlapReply *rs, slap_mask_t fail_mode )
if ( bd == NULL && !BER_BVISNULL( &op->o_req_ndn ) ) { if ( bd == NULL && !BER_BVISNULL( &op->o_req_ndn ) ) {
bd = select_backend( &op->o_req_ndn, 1 ); bd = select_backend( &op->o_req_ndn, 1 );
if ( bd->be_private == op->o_bd->be_private ) { }
if ( bd != NULL ) {
if ( bd->be_private != op->o_bd->be_private ) {
return bd;
}
Debug( LDAP_DEBUG_ANY, Debug( LDAP_DEBUG_ANY,
"%s: back-relay for DN=\"%s\" would call self.\n", "%s: back-relay for DN=\"%s\" would call self.\n",
op->o_log_prefix, op->o_req_dn.bv_val, 0 ); op->o_log_prefix, op->o_req_dn.bv_val, 0 );
if ( fail_mode & RB_ERR ) {
rs->sr_err = rc;
if ( fail_mode & RB_SEND ) {
send_ldap_result( op, rs );
}
}
return NULL; } else if ( ( fail_mode & RB_REFERRAL_SEND ) == RB_REFERRAL_SEND
}
}
if ( bd == NULL ) {
if ( ( fail_mode & RB_REFERRAL )
&& ( fail_mode & RB_SEND )
&& !BER_BVISNULL( &op->o_req_ndn ) && !BER_BVISNULL( &op->o_req_ndn )
&& default_referral ) && default_referral )
{ {
@ -116,16 +110,14 @@ relay_back_select_backend( Operation *op, SlapReply *rs, slap_mask_t fail_mode )
return NULL; return NULL;
} }
/* NOTE: err is LDAP_INVALID_CREDENTIALS for bind, if ( fail_mode & RB_ERR ) {
* LDAP_NO_SUCH_OBJECT for other operations.
* noSuchObject cannot be returned by bind */
rs->sr_err = rc; rs->sr_err = rc;
if ( fail_mode & RB_SEND ) { if ( fail_mode & RB_SEND ) {
send_ldap_result( op, rs ); send_ldap_result( op, rs );
} }
} }
return bd; return NULL;
} }
static int static int
@ -294,6 +286,7 @@ relay_back_op_delete( Operation *op, SlapReply *rs )
RB_UNSUPPORTED_SEND ); RB_UNSUPPORTED_SEND );
} }
#if 0 /* Should not exist - see ITS#6133 */
int int
relay_back_op_abandon( Operation *op, SlapReply *rs ) relay_back_op_abandon( Operation *op, SlapReply *rs )
{ {
@ -331,6 +324,7 @@ relay_back_op_cancel( Operation *op, SlapReply *rs )
return rc; return rc;
} }
#endif /*0*/
int int
relay_back_op_extended( Operation *op, SlapReply *rs ) relay_back_op_extended( Operation *op, SlapReply *rs )
@ -402,6 +396,7 @@ relay_back_entry_get_rw( Operation *op, struct berval *ndn,
} }
#if 0
/* /*
* NOTE: even the existence of this function is questionable: we cannot * NOTE: even the existence of this function is questionable: we cannot
* pass the bi_chk_referrals() call thru the rwm overlay because there * pass the bi_chk_referrals() call thru the rwm overlay because there
@ -414,6 +409,7 @@ relay_back_chk_referrals( Operation *op, SlapReply *rs )
{ {
BackendDB *bd; BackendDB *bd;
/* FIXME: Can send success on failure. Should send referral or nothing. */
bd = relay_back_select_backend( op, rs, bd = relay_back_select_backend( op, rs,
( LDAP_SUCCESS | RB_ERR_REFERRAL_SEND ) ); ( LDAP_SUCCESS | RB_ERR_REFERRAL_SEND ) );
/* FIXME: this test only works if there are no overlays, so /* FIXME: this test only works if there are no overlays, so
@ -434,22 +430,22 @@ relay_back_chk_referrals( Operation *op, SlapReply *rs )
return relay_back_op( op, rs, bd, bd->be_chk_referrals, LDAP_SUCCESS ); return relay_back_op( op, rs, bd, bd->be_chk_referrals, LDAP_SUCCESS );
} }
#endif /*0*/
int int
relay_back_operational( Operation *op, SlapReply *rs ) relay_back_operational( Operation *op, SlapReply *rs )
{ {
BackendDB *bd; BackendDB *bd;
bd = relay_back_select_backend( op, rs, bd = relay_back_select_backend( op, rs, LDAP_SUCCESS );
( LDAP_SUCCESS | RB_ERR ) );
/* FIXME: this test only works if there are no overlays, so /* FIXME: this test only works if there are no overlays, so
* it is nearly useless; if made stricter, no nested back-relays * it is nearly useless; if made stricter, no nested back-relays
* can be instantiated... too bad. */ * can be instantiated... too bad. */
if ( bd == NULL || bd == op->o_bd ) { if ( bd == NULL || bd == op->o_bd ) {
return 0; return LDAP_SUCCESS;
} }
return relay_back_op( op, rs, bd, bd->be_operational, 0 ); return relay_back_op( op, rs, bd, bd->be_operational, LDAP_SUCCESS );
} }
int int
@ -478,6 +474,7 @@ relay_back_has_subordinates( Operation *op, Entry *e, int *hasSubs )
return rc; return rc;
} }
#if 0 /* Should not exist - see ITS#6133 */
int int
relay_back_connection_init( BackendDB *bd, Connection *c ) relay_back_connection_init( BackendDB *bd, Connection *c )
{ {
@ -512,6 +509,7 @@ relay_back_connection_destroy( BackendDB *bd, Connection *c )
return 0; return 0;
} }
#endif /*0*/
/* /*
* FIXME: must implement tools as well * FIXME: must implement tools as well