return SLAP_CB_CONTINUE;
}
+#if 0 /* uncomment if required */
static int
bdb_monitor_modify(
Operation *op,
{
return SLAP_CB_CONTINUE;
}
+#endif
static int
bdb_monitor_free(
Entry *e,
- void *priv )
+ void **priv )
{
struct berval values[ 2 ];
Modification mod = { 0 };
int i, rc;
/* NOTE: if slap_shutdown != 0, priv might have already been freed */
+ *priv = NULL;
/* Remove objectClass */
mod.sm_op = LDAP_MOD_DELETE;
static int
ldap_back_monitor_free(
Entry *e,
- void *priv )
+ void **priv )
{
- ldapinfo_t *li = (ldapinfo_t *)priv;
+ ldapinfo_t *li = (ldapinfo_t *)(*priv);
+
+ *priv = NULL;
if ( !slapd_shutdown && !BER_BVISNULL( &li->li_monitor_info.lmi_rdn ) ) {
ldap_back_monitor_info_destroy( li );
ldap_back_monitor_initialize( void )
{
int i, code;
- const char *err;
ConfigArgs c;
char *argv[ 3 ];
int (*mc_modify)( Operation *op, SlapReply *rs, Entry *e, void *priv );
/* modify callback
for user-defined entries */
- int (*mc_free)( Entry *e, void *priv );
+ int (*mc_free)( Entry *e, void **priv );
/* delete callback
for user-defined entries */
+ void (*mc_dispose)( void **priv );
+ /* dispose callback
+ to dispose of the callback
+ private data itself */
void *mc_private; /* opaque pointer to
private data */
struct monitor_callback_t *mc_next;
return -1;
}
-done_limbo:;
if ( *elpp != NULL ) {
el.el_next = NULL;
**elpp = el;
monitor_callback_t *next = cb->mc_next;
if ( cb->mc_free ) {
- (void)cb->mc_free( e, cb->mc_private );
+ (void)cb->mc_free( e, &cb->mc_private );
}
ch_free( cb );
for ( cbp = &mp->mp_cb; *cbp != NULL; cbp = &(*cbp)->mc_next ) {
if ( *cbp == target_cb ) {
if ( (*cbp)->mc_free ) {
- (void)(*cbp)->mc_free( e, (*cbp)->mc_private );
+ (void)(*cbp)->mc_free( e, &(*cbp)->mc_private );
}
*cbp = (*cbp)->mc_next;
ch_free( target_cb );
for ( cbp = &mp->mp_cb; *cbp != NULL; cbp = &(*cbp)->mc_next ) {
if ( *cbp == target_cb ) {
if ( (*cbp)->mc_free ) {
- (void)(*cbp)->mc_free( e, (*cbp)->mc_private );
+ (void)(*cbp)->mc_free( e, &(*cbp)->mc_private );
}
*cbp = (*cbp)->mc_next;
ch_free( target_cb );
};
int i, rc;
- const char *text;
monitor_info_t *mi = &monitor_info;
ConfigArgs c;
char *argv[ 3 ];
for ( ; el; ) {
entry_limbo_t *tmp;
+ int rc;
switch ( el->el_type ) {
case LIMBO_ENTRY:
- monitor_back_register_entry(
+ rc = monitor_back_register_entry(
el->el_e,
el->el_cb,
el->el_mss,
break;
case LIMBO_ENTRY_PARENT:
- monitor_back_register_entry_parent(
+ rc = monitor_back_register_entry_parent(
el->el_e,
el->el_cb,
el->el_mss,
case LIMBO_ATTRS:
- monitor_back_register_entry_attrs(
+ rc = monitor_back_register_entry_attrs(
&el->el_ndn,
el->el_a,
el->el_cb,
break;
case LIMBO_CB:
- monitor_back_register_entry_callback(
+ rc = monitor_back_register_entry_callback(
&el->el_ndn,
el->el_cb,
&el->el_nbase,
if ( !BER_BVISNULL( &el->el_filter ) ) {
ber_memfree( el->el_filter.bv_val );
}
+ if ( el->el_cb && rc != 0 ) {
+ if ( el->el_cb->mc_dispose ) {
+ el->el_cb->mc_dispose( &el->el_cb->mc_private );
+ }
+ ch_free( el->el_cb );
+ }
tmp = el;
el = el->el_next;