/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2003-2014 The OpenLDAP Foundation.
+ * Copyright 2003-2018 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
}
op->o_bd = be;
- op->o_bd->bd_info = bi;
+ if ( SLAP_ISOVERLAY( op->o_bd ) ) {
+ op->o_bd->bd_info = bi;
+ }
return rc;
}
}
op->o_bd = be;
- op->o_bd->bd_info = bi;
+ if ( SLAP_ISOVERLAY( op->o_bd ) ) {
+ op->o_bd->bd_info = bi;
+ }
return rc;
}
}
op->o_bd = be;
- op->o_bd->bd_info = bi;
+ if ( SLAP_ISOVERLAY( op->o_bd ) ) {
+ op->o_bd->bd_info = bi;
+ }
return rc;
}
}
op->o_bd = be;
- op->o_bd->bd_info = bi;
+ if ( SLAP_ISOVERLAY( op->o_bd ) ) {
+ op->o_bd->bd_info = bi;
+ }
return rc;
}
}
op->o_bd = be;
- op->o_bd->bd_info = bi;
+ if ( SLAP_ISOVERLAY( op->o_bd ) ) {
+ op->o_bd->bd_info = bi;
+ }
return rc;
}
}
if ( rc == SLAP_CB_BYPASS )
rc = SLAP_CB_CONTINUE;
+ /* if an overlay halted processing, make sure
+ * any previously set cleanup handlers are run
+ */
+ if ( rc != SLAP_CB_CONTINUE )
+ goto cleanup;
bi = oi->oi_orig;
- if ( (&bi->bi_op_bind)[ which ] && rc == SLAP_CB_CONTINUE ) {
+ if ( (&bi->bi_op_bind)[ which ] ) {
op->o_bd->bd_info = bi;
rc = (&bi->bi_op_bind)[ which ]( op, rs );
}
*/
if ( rc == LDAP_UNWILLING_TO_PERFORM ) {
slap_callback *sc_next;
+cleanup:
for ( ; op->o_callback && op->o_callback->sc_response !=
over_back_response; op->o_callback = sc_next ) {
sc_next = op->o_callback->sc_next;
slap_overinfo *oi;
slap_overinst *on;
BackendDB *be = op->o_bd, db;
- slap_callback cb = {NULL, over_back_response, NULL, NULL}, **sc;
+ slap_callback **sc;
+ slap_callback *cb;
int rc = SLAP_CB_CONTINUE;
/* FIXME: used to happen for instance during abandon
db.be_flags |= SLAP_DBFLAG_OVERLAY;
op->o_bd = &db;
}
- cb.sc_next = op->o_callback;
- cb.sc_private = oi;
- op->o_callback = &cb;
+ if ( op->o_tag != LDAP_REQ_ABANDON && op->o_tag != LDAP_REQ_UNBIND ) {
+ cb = (slap_callback *)op->o_tmpcalloc( 1, sizeof(slap_callback), op->o_tmpmemctx );
+ cb->sc_cleanup = NULL;
+ cb->sc_response = over_back_response;
+ cb->sc_writewait = NULL;
+ cb->sc_next = op->o_callback;
+ cb->sc_private = oi;
+ op->o_callback = cb;
+ }
rc = overlay_op_walk( op, rs, which, oi, on );
- for ( sc = &op->o_callback; *sc; sc = &(*sc)->sc_next ) {
- if ( *sc == &cb ) {
- *sc = cb.sc_next;
- break;
+ if ( rc != SLAPD_ASYNCOP && op->o_tag != LDAP_REQ_ABANDON && op->o_tag != LDAP_REQ_UNBIND ) {
+ for ( sc = &op->o_callback; *sc; sc = &(*sc)->sc_next ) {
+ if ( *sc == cb ) {
+ *sc = cb->sc_next;
+ op->o_tmpfree( cb, op->o_tmpmemctx );
+ break;
+ }
}
}
gotit = 1;
}
- /* overlays can be instanciated multiple times, use
+ /* overlays can be instantiated multiple times, use
* be_ctrls[ cid ] as an instance counter, so that the
* overlay's controls are only really disabled after the
* last instance called overlay_register_control() */
}
if ( !gotit ) {
- /* overlays can be instanciated multiple times, use
+ /* overlays can be instantiated multiple times, use
* be_ctrls[ cid ] as an instance counter, so that the
* overlay's controls are only really unregistered after the
* last instance called overlay_register_control() */
rm_cb->sc_cleanup = overlay_remove_cb;
rm_cb->sc_response = NULL;
rm_cb->sc_private = (void*) rm_ctx;
+ rm_cb->sc_writewait = NULL;
/* Append callback to the end of the list */
if ( !op->o_callback ) {