} retcode_t;
static int
-retcode_entry_response( Operation *op, SlapReply *rs, Entry *e );
+retcode_entry_response( Operation *op, SlapReply *rs, BackendInfo *bi, Entry *e );
static int
retcode_cleanup_cb( Operation *op, SlapReply *rs )
retcode_item_t *rdi;
for ( rdi = rd->rd_item; rdi != NULL; rdi = rdi->rdi_next ) {
- int rc;
-
if ( op->o_abandon ) {
return rs->sr_err = SLAPD_ABANDON;
}
rs->sr_err = LDAP_SUCCESS;
rs->sr_entry = &rdi->rdi_e;
- rc = send_search_entry( op, rs );
+ rs->sr_err = send_search_entry( op, rs );
+ rs->sr_entry = NULL;
- switch ( rc ) {
- case 0: /* entry sent ok */
- break;
- case 1: /* entry not sent */
- break;
- case -1: /* connection closed */
- rs->sr_entry = NULL;
+ switch ( rs->sr_err ) {
+ case LDAP_UNAVAILABLE: /* connection closed */
rs->sr_err = LDAP_OTHER;
+ /* fallthru */
+ case LDAP_SIZELIMIT_EXCEEDED:
goto done;
}
}
static int
retcode_op_add( Operation *op, SlapReply *rs )
{
- return retcode_entry_response( op, rs, op->ora_e );
+ return retcode_entry_response( op, rs, NULL, op->ora_e );
}
typedef struct retcode_cb_t {
+ BackendInfo *rdc_info;
unsigned rdc_flags;
ber_tag_t rdc_tag;
AttributeName *rdc_attrs;
if ( op->o_tag == LDAP_REQ_SEARCH ) {
rs->sr_attrs = rdc->rdc_attrs;
}
- rc = retcode_entry_response( op, rs, rs->sr_entry );
+ rc = retcode_entry_response( op, rs, rdc->rdc_info, rs->sr_entry );
op->o_tag = o_tag;
return rc;
db.bd_info = on->on_info->oi_orig;
op2.o_bd = &db;
+ rdc.rdc_info = on->on_info->oi_orig;
rdc.rdc_flags = RETCODE_FINDIR;
if ( op->o_tag == LDAP_REQ_SEARCH ) {
rdc.rdc_attrs = op->ors_attrs;
}
static int
-retcode_entry_response( Operation *op, SlapReply *rs, Entry *e )
+retcode_entry_response( Operation *op, SlapReply *rs, BackendInfo *bi, Entry *e )
{
- slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
-
Attribute *a;
int err;
char *next;
}
if ( rs->sr_err != LDAP_SUCCESS ) {
- BackendDB db = *op->o_bd;
+ BackendDB db = *op->o_bd,
+ *o_bd = op->o_bd;
void *o_callback = op->o_callback;
/* message text */
rs->sr_matched = a->a_vals[ 0 ].bv_val;
}
- db.bd_info = on->on_info->oi_orig;
+ if ( bi == NULL ) {
+ slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
+
+ bi = on->on_info->oi_orig;
+ }
+
+ db.bd_info = bi;
op->o_bd = &db;
op->o_callback = NULL;
rs->sr_text = NULL;
rs->sr_matched = NULL;
+ op->o_bd = o_bd;
op->o_callback = o_callback;
}
return SLAP_CB_CONTINUE;
}
- return retcode_entry_response( op, rs, rs->sr_entry );
+ return retcode_entry_response( op, rs, NULL, rs->sr_entry );
}
static int
ber_memfree( rdi->rdi_matched.bv_val );
}
+ if ( rdi->rdi_ref ) {
+ ber_bvarray_free( rdi->rdi_ref );
+ }
+
BER_BVZERO( &rdi->rdi_e.e_name );
BER_BVZERO( &rdi->rdi_e.e_nname );
ch_free( rdi );
}
+ if ( !BER_BVISNULL( &rd->rd_pdn ) ) {
+ ber_memfree( rd->rd_pdn.bv_val );
+ }
+
+ if ( !BER_BVISNULL( &rd->rd_npdn ) ) {
+ ber_memfree( rd->rd_npdn.bv_val );
+ }
+
ber_memfree( rd );
}
static
#endif /* SLAPD_OVER_RETCODE == SLAPD_MOD_DYNAMIC */
int
-retcode_init( void )
+retcode_initialize( void )
{
int i, code;
const char *err;
int
init_module( int argc, char *argv[] )
{
- return retcode_init();
+ return retcode_initialize();
}
#endif /* SLAPD_OVER_RETCODE == SLAPD_MOD_DYNAMIC */