#undef MONITOR_DEFINE_LABELEDURI
typedef struct monitor_callback_t {
- int (*mc_update)( Operation *op, Entry *e, void *priv );
+ int (*mc_update)( Operation *op, SlapReply *rs, Entry *e, void *priv );
/* update callback
for user-defined entries */
- int (*mc_modify)( Operation *op, Entry *e, void *priv );
+ 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 );
/* update callback
for user-defined entries */
- void *mc_private; /* opaque pointer to
+ void *mc_private; /* opaque pointer to
private data */
struct monitor_callback_t *mc_next;
} monitor_callback_t;
/* initialize entry and subentries */
int ( *mss_open )( BackendDB *, struct monitor_subsys_t *ms );
/* update existing dynamic entry and subentries */
- int ( *mss_update )( Operation *, Entry * );
+ int ( *mss_update )( Operation *, SlapReply *, Entry * );
/* create new dynamic subentries */
- int ( *mss_create )( Operation *,
+ int ( *mss_create )( Operation *, SlapReply *,
struct berval *ndn, Entry *, Entry ** );
/* modify entry and subentries */
- int ( *mss_modify )( Operation *, Entry * );
+ int ( *mss_modify )( Operation *, SlapReply *, Entry * );
} monitor_subsys_t;
extern BackendDB *be_monitor;
/* increase this bufsize if entries in string form get too big */
#define BACKMONITOR_BUFSIZE 8192
-extern int
-monitor_back_register_entry(
- Entry *e,
- monitor_callback_t *cb );
-
-extern int
-monitor_back_register_entry_parent(
- Entry *e,
- monitor_callback_t *cb,
- struct berval *base,
- int scope,
- struct berval *filter );
-
-extern int
-monitor_filter2ndn(
- struct berval *base,
- int scope,
- struct berval *filter,
- struct berval *ndn );
-
-extern int
-monitor_back_register_entry_attrs(
- struct berval *ndn_in,
- Attribute *a,
- monitor_callback_t *cb,
- struct berval *base,
- int scope,
- struct berval *filter );
-
-extern int
-monitor_back_register_entry_callback(
- struct berval *ndn,
- monitor_callback_t *cb,
- struct berval *base,
- int scope,
- struct berval *filter );
-
LDAP_END_DECL
#include "proto-back-monitor.h"
int
monitor_cache_dn2entry(
Operation *op,
+ SlapReply *rs,
struct berval *ndn,
Entry **ep,
Entry **matched
dnParent( ndn, &p_ndn );
}
- rc = monitor_cache_dn2entry( op, &p_ndn, &e_parent, matched );
+ rc = monitor_cache_dn2entry( op, rs, &p_ndn, &e_parent, matched );
if ( rc || e_parent == NULL ) {
return( -1 );
}
rc = -1;
if ( mp->mp_flags & MONITOR_F_VOLATILE_CH ) {
/* parent entry generates volatile children */
- rc = monitor_entry_create( op, ndn, e_parent, ep );
+ rc = monitor_entry_create( op, rs, ndn, e_parent, ep );
}
if ( !rc ) {
int rc;
/* get entry with reader lock */
- monitor_cache_dn2entry( op, &op->o_req_ndn, &e, &matched );
+ monitor_cache_dn2entry( op, rs, &op->o_req_ndn, &e, &matched );
if ( e == NULL ) {
rs->sr_err = LDAP_NO_SUCH_OBJECT;
if ( matched ) {
int
monitor_subsys_conn_update(
Operation *op,
+ SlapReply *rs,
Entry *e
)
{
/* FIXME: touch modifyTimestamp? */
}
- return( 0 );
+ return SLAP_CB_CONTINUE;
}
static int
)
{
monitor_entry_t *mp;
- struct tm *ltm;
- char buf[ BACKMONITOR_BUFSIZE ];
- char buf2[ LDAP_LUTIL_GENTIME_BUFSIZE ];
- char buf3[ LDAP_LUTIL_GENTIME_BUFSIZE ];
-
- struct berval bv;
+ struct tm *ltm;
+ char buf[ BACKMONITOR_BUFSIZE ];
+ char buf2[ LDAP_LUTIL_GENTIME_BUFSIZE ];
+ char buf3[ LDAP_LUTIL_GENTIME_BUFSIZE ];
- Entry *e;
+ Entry *e;
struct tm *ctm;
char ctmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
mp = monitor_entrypriv_create();
if ( mp == NULL ) {
- return -1;
+ return LDAP_OTHER;
}
e->e_private = ( void * )mp;
mp->mp_info = ms;
*ep = e;
- return( 0 );
+ return SLAP_CB_CONTINUE;
}
int
monitor_subsys_conn_create(
Operation *op,
+ SlapReply *rs,
struct berval *ndn,
Entry *e_parent,
Entry **ep
Connection *c;
int connindex;
monitor_entry_t *mp;
- int rc = 0;
+ int rc = SLAP_CB_CONTINUE;
monitor_subsys_t *ms;
assert( mi != NULL );
e_tmp = e;
}
- rc = -1;
+ rc = rs->sr_err = LDAP_OTHER;
break;
}
mp = ( monitor_entry_t * )e->e_private;
connid = strtol( &ndn->bv_val[ nconn_bv.bv_len ], &next, 10 );
if ( next[ 0 ] != ',' ) {
- return -1;
+ return ( rs->sr_err = LDAP_OTHER );
}
for ( c = connection_first( &connindex );
c != NULL;
- c = connection_next( c, &connindex )) {
+ c = connection_next( c, &connindex ) )
+ {
if ( c->c_connid == connid ) {
- if ( conn_create( mi, c, ep, ms ) || *ep == NULL ) {
- rc = -1;
+ rc = conn_create( mi, c, ep, ms );
+ if ( rc != SLAP_CB_CONTINUE ) {
+ rs->sr_err = rc;
+
+ } else if ( *ep == NULL ) {
+ rc = rs->sr_err = LDAP_OTHER;
}
break;
}
}
- connection_done(c);
+ connection_done( c );
}
return rc;
int
monitor_subsys_database_modify(
Operation *op,
+ SlapReply *rs,
Entry *e
)
{
monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
int rc = LDAP_OTHER;
Attribute *save_attrs, *a;
- Modifications *modlist = op->oq_modify.rs_modlist;
Modifications *ml;
Backend *be;
int ro_gotval = 1, i, n;
struct berval *tf;
i = sscanf( e->e_nname.bv_val, "cn=database %d,", &n );
- if ( i != 1 )
- return /* LDAP_UNWILLING_TO_PERFORM */ 0;
+ if ( i != 1 ) {
+ return SLAP_CB_CONTINUE;
+ }
- if ( n < 0 || n >= nBackendDB )
- return LDAP_NO_SUCH_OBJECT;
+ if ( n < 0 || n >= nBackendDB ) {
+ rs->sr_text = "invalid database index";
+ return ( rs->sr_err = LDAP_NO_SUCH_OBJECT );
+ }
LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
- if ( n == 0 ) break;
+ if ( n == 0 ) {
+ break;
+ }
n--;
}
/* do not allow some changes on back-monitor (needs work)... */
- if ( SLAP_MONITOR( be ) )
- return LDAP_UNWILLING_TO_PERFORM;
+ if ( SLAP_MONITOR( be ) ) {
+ rs->sr_text = "no modifications allowed to monitor database entry";
+ return ( rs->sr_err = LDAP_UNWILLING_TO_PERFORM );
+ }
rp_cur = be->be_restrictops;
save_attrs = e->e_attrs;
e->e_attrs = attrs_dup( e->e_attrs );
- for ( ml=modlist; ml; ml=ml->sml_next ) {
+ for ( ml = op->orm_modlist; ml; ml = ml->sml_next ) {
Modification *mod = &ml->sml_mod;
if ( mod->sm_desc == mi->mi_ad_readOnly ) {
if ( mod->sm_values ) {
if ( !BER_BVISNULL( &mod->sm_values[ 1 ] ) ) {
- rc = LDAP_CONSTRAINT_VIOLATION;
+ rs->sr_text = "attempting to modify multiple values of single-valued attribute";
+ rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
goto done;
}
val = 0;
} else {
- rc = LDAP_INVALID_SYNTAX;
+ assert( 0 );
+ rc = rs->sr_err = LDAP_INVALID_SYNTAX;
goto done;
}
}
switch ( mod->sm_op ) {
case LDAP_MOD_DELETE:
if ( ro_gotval < 1 ) {
- rc = LDAP_CONSTRAINT_VIOLATION;
+ rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
goto done;
}
ro_gotval--;
if ( val == 0 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) == SLAP_RESTRICT_OP_WRITES ) {
- rc = LDAP_NO_SUCH_ATTRIBUTE;
+ rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
goto done;
}
if ( val == 1 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) != SLAP_RESTRICT_OP_WRITES ) {
- rc = LDAP_NO_SUCH_ATTRIBUTE;
+ rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
goto done;
}
case LDAP_MOD_ADD:
if ( ro_gotval > 0 ) {
- rc = LDAP_CONSTRAINT_VIOLATION;
+ rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
goto done;
}
ro_gotval++;
break;
default:
- rc = LDAP_OTHER;
+ rc = rs->sr_err = LDAP_OTHER;
goto done;
}
rp_delete &= ~mask;
} else if ( rc == LDAP_OTHER ) {
- rc = LDAP_TYPE_OR_VALUE_EXISTS;
+ rc = rs->sr_err = LDAP_TYPE_OR_VALUE_EXISTS;
}
break;
default:
- rc = LDAP_OTHER;
+ rc = rs->sr_err = LDAP_OTHER;
break;
}
rc = attr_merge( e, mod->sm_desc, mod->sm_values,
mod->sm_nvalues );
if ( rc ) {
- rc = LDAP_OTHER;
+ rc = rs->sr_err = LDAP_OTHER;
break;
}
} else {
- rc = LDAP_UNWILLING_TO_PERFORM;
+ rc = rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
break;
}
}
/* sanity checks: */
if ( ro_gotval < 1 ) {
- rc = LDAP_CONSTRAINT_VIOLATION;
+ rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
goto done;
}
if ( ( rp_cur & SLAP_RESTRICT_OP_EXTENDED ) && ( rp_cur & SLAP_RESTRICT_EXOP_MASK ) ) {
- rc = LDAP_CONSTRAINT_VIOLATION;
+ rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
goto done;
}
if ( rp_delete & rp_add ) {
- rc = LDAP_OTHER;
+ rc = rs->sr_err = LDAP_OTHER;
goto done;
}
} else {
a = attr_find( e->e_attrs, mi->mi_ad_restrictedOperation );
if ( a == NULL ) {
- rc = LDAP_OTHER;
+ rc = rs->sr_err = LDAP_OTHER;
goto done;
}
done:;
if ( rc == LDAP_SUCCESS ) {
attrs_free( save_attrs );
+ rc = SLAP_CB_CONTINUE;
} else {
Attribute *tmp = e->e_attrs;
int
monitor_entry_update(
Operation *op,
+ SlapReply *rs,
Entry *e
)
{
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
monitor_entry_t *mp;
- int rc = 0;
+
+ int rc = SLAP_CB_CONTINUE;
assert( mi != NULL );
assert( e != NULL );
mp = ( monitor_entry_t * )e->e_private;
if ( mp->mp_info && mp->mp_info->mss_update ) {
- rc = ( *mp->mp_info->mss_update )( op, e );
+ rc = mp->mp_info->mss_update( op, rs, e );
}
- if ( rc == 0 && mp->mp_cb ) {
+ if ( rc == SLAP_CB_CONTINUE && mp->mp_cb ) {
struct monitor_callback_t *mc;
for ( mc = mp->mp_cb; mc; mc = mc->mc_next ) {
- rc = ( *mc->mc_update )( op, e, mc->mc_private );
- if ( rc != 0 ) {
- break;
+ if ( mc->mc_update ) {
+ rc = mc->mc_update( op, rs, e, mc->mc_private );
+ if ( rc != SLAP_CB_CONTINUE ) {
+ break;
+ }
}
}
}
+ if ( rc == SLAP_CB_CONTINUE ) {
+ rc = LDAP_SUCCESS;
+ }
+
return rc;
}
int
monitor_entry_create(
Operation *op,
+ SlapReply *rs,
struct berval *ndn,
Entry *e_parent,
- Entry **ep
-)
+ Entry **ep )
{
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
monitor_entry_t *mp;
+ int rc = SLAP_CB_CONTINUE;
+
assert( mi != NULL );
assert( e_parent != NULL );
assert( e_parent->e_private != NULL );
mp = ( monitor_entry_t * )e_parent->e_private;
if ( mp->mp_info && mp->mp_info->mss_create ) {
- return ( *mp->mp_info->mss_create )( op, ndn, e_parent, ep );
+ rc = mp->mp_info->mss_create( op, rs, ndn, e_parent, ep );
+ }
+
+ if ( rc == SLAP_CB_CONTINUE ) {
+ rc = LDAP_SUCCESS;
}
- return( 0 );
+ return rc;
}
int
monitor_entry_modify(
Operation *op,
+ SlapReply *rs,
Entry *e
)
{
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
monitor_entry_t *mp;
- int rc = 0;
+
+ int rc = SLAP_CB_CONTINUE;
assert( mi != NULL );
assert( e != NULL );
mp = ( monitor_entry_t * )e->e_private;
if ( mp->mp_info && mp->mp_info->mss_modify ) {
- rc = ( *mp->mp_info->mss_modify )( op, e );
+ rc = mp->mp_info->mss_modify( op, rs, e );
}
- if ( rc == 0 && mp->mp_cb ) {
+ if ( rc == SLAP_CB_CONTINUE && mp->mp_cb ) {
struct monitor_callback_t *mc;
for ( mc = mp->mp_cb; mc; mc = mc->mc_next ) {
- rc = ( *mc->mc_modify )( op, e, mc->mc_private );
- if ( rc != 0 ) {
- break;
+ if ( mc->mc_modify ) {
+ rc = mc->mc_modify( op, rs, e, mc->mc_private );
+ if ( rc != SLAP_CB_CONTINUE ) {
+ break;
+ }
}
}
}
+ if ( rc == SLAP_CB_CONTINUE ) {
+ rc = LDAP_SUCCESS;
+ }
+
return rc;
}
};
int
-monitor_back_register_subsys( monitor_subsys_t *ms )
+monitor_back_register_subsys(
+ monitor_subsys_t *ms )
{
int i = 0;
int
monitor_back_register_entry(
- Entry *e,
- monitor_callback_t *cb )
+ Entry *e,
+ monitor_callback_t *cb )
{
monitor_info_t *mi = ( monitor_info_t * )be_monitor->be_private;
int
monitor_back_register_entry_parent(
- Entry *e,
- monitor_callback_t *cb,
- struct berval *base,
- int scope,
- struct berval *filter )
+ Entry *e,
+ monitor_callback_t *cb,
+ struct berval *base,
+ int scope,
+ struct berval *filter )
{
monitor_info_t *mi = ( monitor_info_t * )be_monitor->be_private;
struct berval ndn = BER_BVNULL;
}
int
-monitor_filter2ndn( struct berval *base, int scope, struct berval *filter,
- struct berval *ndn )
+monitor_filter2ndn(
+ struct berval *base,
+ int scope,
+ struct berval *filter,
+ struct berval *ndn )
{
Connection conn = { 0 };
char opbuf[OPERATION_BUFFER_SIZE];
int
monitor_back_register_entry_attrs(
- struct berval *ndn_in,
- Attribute *a,
- monitor_callback_t *cb,
- struct berval *base,
- int scope,
- struct berval *filter )
+ struct berval *ndn_in,
+ Attribute *a,
+ monitor_callback_t *cb,
+ struct berval *base,
+ int scope,
+ struct berval *filter )
{
monitor_info_t *mi = ( monitor_info_t * )be_monitor->be_private;
struct berval ndn = BER_BVNULL;
int
monitor_back_register_entry_callback(
- struct berval *ndn,
- monitor_callback_t *cb,
- struct berval *base,
- int scope,
- struct berval *filter )
+ struct berval *ndn,
+ monitor_callback_t *cb,
+ struct berval *base,
+ int scope,
+ struct berval *filter )
{
return monitor_back_register_entry_attrs( ndn, NULL, cb,
base, scope, filter );
}
monitor_subsys_t *
-monitor_back_get_subsys_by_dn( struct berval *ndn, int sub )
+monitor_back_get_subsys_by_dn(
+ struct berval *ndn,
+ int sub )
{
if ( monitor_subsys != NULL ) {
int i;
int
monitor_back_initialize(
- BackendInfo *bi
-)
+ BackendInfo *bi )
{
monitor_subsys_t *ms;
static char *controls[] = {
int
monitor_back_db_init(
- BackendDB *be
-)
+ BackendDB *be )
{
monitor_info_t *mi;
int i, rc;
int
monitor_back_db_open(
- BackendDB *be
-)
+ BackendDB *be )
{
monitor_info_t *mi = (monitor_info_t *)be->be_private;
struct monitor_subsys_t **ms;
const char *fname,
int lineno,
int argc,
- char **argv
-)
+ char **argv )
{
/*
* eventually, will hold backend specific configuration parameters
const char *fname,
int lineno,
int argc,
- char **argv
-)
+ char **argv )
{
monitor_info_t *mi = ( monitor_info_t * )be->be_private;
int
monitor_back_db_destroy(
- BackendDB *be
-)
+ BackendDB *be )
{
/*
* FIXME: destroys all the data
int
monitor_subsys_log_init(
BackendDB *be,
- monitor_subsys_t *ms
-)
+ monitor_subsys_t *ms )
{
monitor_info_t *mi;
Entry *e;
int
monitor_subsys_log_modify(
Operation *op,
- Entry *e
-)
+ SlapReply *rs,
+ Entry *e )
{
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
int rc = LDAP_OTHER;
*/
if ( is_at_operational( mod->sm_desc->ad_type ) ) {
( void ) attr_delete( &e->e_attrs, mod->sm_desc );
- rc = attr_merge( e, mod->sm_desc, mod->sm_values, mod->sm_nvalues );
- if ( rc != 0 ) {
- rc = LDAP_OTHER;
+ rc = rs->sr_err = attr_merge( e, mod->sm_desc, mod->sm_values, mod->sm_nvalues );
+ if ( rc != LDAP_SUCCESS ) {
break;
}
continue;
/*
* only the monitor description attribute can be modified
*/
- } else if ( mod->sm_desc != mi->mi_ad_managedInfo) {
- rc = LDAP_UNWILLING_TO_PERFORM;
+ } else if ( mod->sm_desc != mi->mi_ad_managedInfo ) {
+ rc = rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
break;
}
}
if ( rc != LDAP_SUCCESS ) {
+ rs->sr_err = rc;
break;
}
}
/* check for abandon */
if ( op->o_abandon ) {
- rc = SLAPD_ABANDON;
+ rc = rs->sr_err = SLAPD_ABANDON;
goto cleanup;
}
rc = entry_schema_check( be_monitor, e, save_attrs,
&text, textbuf, sizeof( textbuf ) );
if ( rc != LDAP_SUCCESS ) {
+ rs->sr_err = rc;
goto cleanup;
}
ldap_pvt_thread_mutex_unlock( &monitor_log_mutex );
- return( rc );
+ if ( rc == LDAP_SUCCESS ) {
+ rc = SLAP_CB_CONTINUE;
+ }
+
+ return rc;
}
static int
Debug(LDAP_DEBUG_ARGS, "monitor_back_modify:\n", 0, 0, 0);
/* acquire and lock entry */
- monitor_cache_dn2entry( op, &op->o_req_ndn, &e, &matched );
+ monitor_cache_dn2entry( op, rs, &op->o_req_ndn, &e, &matched );
if ( e == NULL ) {
rs->sr_err = LDAP_NO_SUCH_OBJECT;
if ( matched ) {
rc = LDAP_INSUFFICIENT_ACCESS;
} else {
- rc = monitor_entry_modify( op, e );
+ rc = monitor_entry_modify( op, rs, e );
}
#ifdef SLAP_ACL_HONOR_DISCLOSE
int
monitor_subsys_ops_update(
Operation *op,
+ SlapReply *rs,
Entry *e
)
{
/* FIXME: touch modifyTimestamp? */
- return( 0 );
+ return SLAP_CB_CONTINUE;
}
/*
* backends
*/
-int monitor_subsys_backend_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
+int
+monitor_subsys_backend_init LDAP_P((
+ BackendDB *be,
+ monitor_subsys_t *ms ));
/*
* cache
*/
-extern int monitor_cache_cmp LDAP_P(( const void *c1, const void *c2 ));
-extern int monitor_cache_dup LDAP_P(( void *c1, void *c2 ));
-extern int monitor_cache_add LDAP_P(( monitor_info_t *mi, Entry *e ));
-extern int monitor_cache_get LDAP_P(( monitor_info_t *mi, struct berval *ndn, Entry **ep ));
-extern int monitor_cache_dn2entry LDAP_P(( Operation *op, struct berval *ndn, Entry **ep, Entry **matched ));
-extern int monitor_cache_lock LDAP_P(( Entry *e ));
-extern int monitor_cache_release LDAP_P(( monitor_info_t *mi, Entry *e ));
+extern int
+monitor_cache_cmp LDAP_P((
+ const void *c1,
+ const void *c2 ));
+extern int
+monitor_cache_dup LDAP_P((
+ void *c1,
+ void *c2 ));
+extern int
+monitor_cache_add LDAP_P((
+ monitor_info_t *mi,
+ Entry *e ));
+extern int
+monitor_cache_get LDAP_P((
+ monitor_info_t *mi,
+ struct berval *ndn,
+ Entry **ep ));
+extern int
+monitor_cache_dn2entry LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ struct berval *ndn,
+ Entry **ep,
+ Entry **matched ));
+extern int
+monitor_cache_lock LDAP_P((
+ Entry *e ));
+extern int
+monitor_cache_release LDAP_P((
+ monitor_info_t *mi,
+ Entry *e ));
/*
* connections
*/
-int monitor_subsys_conn_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
-int monitor_subsys_conn_update LDAP_P(( Operation *op, Entry *e ));
-int monitor_subsys_conn_create LDAP_P(( Operation *op, struct berval *ndn,
- Entry *e_parent, Entry **ep ));
+extern int
+monitor_subsys_conn_init LDAP_P((
+ BackendDB *be,
+ monitor_subsys_t *ms ));
+extern int
+monitor_subsys_conn_update LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ Entry *e ));
+extern int
+monitor_subsys_conn_create LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ struct berval *ndn,
+ Entry *e_parent,
+ Entry **ep ));
/*
* databases
*/
-int monitor_subsys_database_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
-int monitor_subsys_database_modify LDAP_P(( Operation *op, Entry *e ));
+extern int
+monitor_subsys_database_init LDAP_P((
+ BackendDB *be,
+ monitor_subsys_t *ms ));
+extern int
+monitor_subsys_database_modify LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ Entry *e ));
/*
* entry
*/
-extern int monitor_entry_update LDAP_P(( Operation *op, Entry *e ));
-extern int monitor_entry_create LDAP_P(( Operation *op, struct berval *ndn,
- Entry *e_parent, Entry **ep ));
-extern int monitor_entry_modify LDAP_P(( Operation *op, Entry *e ));
-int monitor_entry_test_flags LDAP_P(( monitor_entry_t *mp, int cond ));
-extern monitor_entry_t * monitor_entrypriv_create LDAP_P(( void ));
+extern int
+monitor_entry_update LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ Entry *e ));
+extern int
+monitor_entry_create LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ struct berval *ndn,
+ Entry *e_parent,
+ Entry **ep ));
+extern int
+monitor_entry_modify LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ Entry *e ));
+extern int
+monitor_entry_test_flags LDAP_P((
+ monitor_entry_t *mp,
+ int cond ));
+extern monitor_entry_t *
+monitor_entrypriv_create LDAP_P((
+ void ));
/*
* init
*/
-extern int monitor_back_register_subsys LDAP_P(( monitor_subsys_t *ms ));
-extern monitor_subsys_t * monitor_back_get_subsys LDAP_P(( const char *name ));
-extern monitor_subsys_t * monitor_back_get_subsys_by_dn LDAP_P(( struct berval *ndn, int sub ));
-extern int monitor_back_register_entry LDAP_P(( Entry *e, monitor_callback_t *cb ));
-extern int monitor_filter2ndn LDAP_P(( struct berval *base, int scope, struct berval *filter, struct berval *ndn ));
-extern int monitor_back_register_entry_attrs LDAP_P(( struct berval *ndn, Attribute *a, monitor_callback_t *cb, struct berval *base, int scope, struct berval *filter ));
-extern int monitor_back_register_entry_callback LDAP_P(( struct berval *ndn, monitor_callback_t *cb, struct berval *base, int scope, struct berval *filter ));
+extern int
+monitor_back_register_subsys LDAP_P((
+ monitor_subsys_t *ms ));
+extern monitor_subsys_t *
+monitor_back_get_subsys LDAP_P((
+ const char *name ));
+extern monitor_subsys_t *
+monitor_back_get_subsys_by_dn LDAP_P((
+ struct berval *ndn,
+ int sub ));
+extern int
+monitor_back_register_entry LDAP_P((
+ Entry *e,
+ monitor_callback_t *cb ));
+extern int
+monitor_back_register_entry_parent LDAP_P((
+ Entry *e,
+ monitor_callback_t *cb,
+ struct berval *base,
+ int scope,
+ struct berval *filter ));
+extern int
+monitor_filter2ndn LDAP_P((
+ struct berval *base,
+ int scope,
+ struct berval *filter,
+ struct berval *ndn ));
+extern int
+monitor_back_register_entry_attrs LDAP_P((
+ struct berval *ndn,
+ Attribute *a,
+ monitor_callback_t *cb,
+ struct berval *base,
+ int scope,
+ struct berval *filter ));
+extern int
+monitor_back_register_entry_callback LDAP_P((
+ struct berval *ndn,
+ monitor_callback_t *cb,
+ struct berval *base,
+ int scope,
+ struct berval *filter ));
/*
* listener
*/
-int monitor_subsys_listener_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
+extern int
+monitor_subsys_listener_init LDAP_P((
+ BackendDB *be,
+ monitor_subsys_t *ms ));
/*
* log
*/
-int monitor_subsys_log_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
-int monitor_subsys_log_modify LDAP_P(( Operation *op, Entry *e ));
+extern int
+monitor_subsys_log_init LDAP_P((
+ BackendDB *be,
+ monitor_subsys_t *ms ));
+extern int
+monitor_subsys_log_modify LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ Entry *e ));
/*
* operations
*/
-int monitor_subsys_ops_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
-int monitor_subsys_ops_update LDAP_P(( Operation *op, Entry *e ));
+extern int
+monitor_subsys_ops_init LDAP_P((
+ BackendDB *be,
+ monitor_subsys_t *ms ));
+extern int
+monitor_subsys_ops_update LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ Entry *e ));
/*
* overlay
*/
-int monitor_subsys_overlay_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
+extern int
+monitor_subsys_overlay_init LDAP_P((
+ BackendDB *be,
+ monitor_subsys_t *ms ));
/*
* sent
*/
-int monitor_subsys_sent_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
-int monitor_subsys_sent_update LDAP_P(( Operation *op, Entry *e ));
+extern int
+monitor_subsys_sent_init LDAP_P((
+ BackendDB *be,
+ monitor_subsys_t *ms ));
+extern int
+monitor_subsys_sent_update LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ Entry *e ));
/*
* threads
*/
-int monitor_subsys_thread_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
-int monitor_subsys_thread_update LDAP_P(( Operation *op, Entry *e ));
+extern int
+monitor_subsys_thread_init LDAP_P((
+ BackendDB *be,
+ monitor_subsys_t *ms ));
+extern int
+monitor_subsys_thread_update LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ Entry *e ));
/*
* time
*/
-int monitor_subsys_time_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
-int monitor_subsys_time_update LDAP_P(( Operation *op, Entry *e ));
+extern int monitor_subsys_time_init LDAP_P((
+ BackendDB *be,
+ monitor_subsys_t *ms ));
+extern int
+monitor_subsys_time_update LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ Entry *e ));
/*
* waiters
*/
-int monitor_subsys_rww_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
-int monitor_subsys_rww_update LDAP_P(( Operation *op, Entry *e ));
+extern int
+monitor_subsys_rww_init LDAP_P((
+ BackendDB *be,
+ monitor_subsys_t *ms ));
+extern int
+monitor_subsys_rww_update LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ Entry *e ));
/* NOTE: this macro assumes that bv has been allocated
* by ber_* malloc functions or is { 0L, NULL } */
int
monitor_subsys_rww_update(
Operation *op,
+ SlapReply *rs,
Entry *e
)
{
}
if ( i == MONITOR_RWW_LAST ) {
- return 0;
+ return SLAP_CB_CONTINUE;
}
nconns = nwritewaiters = nreadwaiters = 0;
a->a_vals[ 0 ].bv_val = ber_memrealloc( a->a_vals[ 0 ].bv_val, len + 1 );
if ( BER_BVISNULL( &a->a_vals[ 0 ] ) ) {
BER_BVZERO( &a->a_vals[ 0 ] );
- return( 0 );
+ return SLAP_CB_CONTINUE;
}
}
AC_MEMCPY( a->a_vals[ 0 ].bv_val, buf, len + 1 );
/* FIXME: touch modifyTimestamp? */
- return( 0 );
+ return SLAP_CB_CONTINUE;
}
e_ch = NULL;
if ( MONITOR_HAS_VOLATILE_CH( mp ) ) {
- monitor_entry_create( op, NULL, e_parent, &e_ch );
+ monitor_entry_create( op, rs, NULL, e_parent, &e_ch );
}
monitor_cache_release( mi, e_parent );
for ( ; e != NULL; ) {
mp = ( monitor_entry_t * )e->e_private;
- monitor_entry_update( op, e );
+ monitor_entry_update( op, rs, e );
if ( op->o_abandon ) {
monitor_cache_release( mi, e );
/* get entry with reader lock */
- monitor_cache_dn2entry( op, &op->o_req_ndn, &e, &matched );
+ monitor_cache_dn2entry( op, rs, &op->o_req_ndn, &e, &matched );
if ( e == NULL ) {
rs->sr_err = LDAP_NO_SUCH_OBJECT;
if ( matched ) {
rs->sr_attrs = op->oq_search.rs_attrs;
switch ( op->oq_search.rs_scope ) {
case LDAP_SCOPE_BASE:
- monitor_entry_update( op, e );
+ monitor_entry_update( op, rs, e );
rc = test_filter( op, e, op->oq_search.rs_filter );
if ( rc == LDAP_COMPARE_TRUE ) {
rs->sr_entry = e;
break;
case LDAP_SCOPE_SUBTREE:
- monitor_entry_update( op, e );
+ monitor_entry_update( op, rs, e );
rc = test_filter( op, e, op->oq_search.rs_filter );
if ( rc == LDAP_COMPARE_TRUE ) {
rs->sr_entry = e;
int
monitor_subsys_sent_update(
Operation *op,
- Entry *e
-)
+ SlapReply *rs,
+ Entry *e )
{
monitor_info_t *mi = ( monitor_info_t *)op->o_bd->be_private;
}
if ( i == MONITOR_SENT_LAST ) {
- return 0;
+ return SLAP_CB_CONTINUE;
}
ldap_pvt_thread_mutex_lock(&slap_counters.sc_sent_mutex);
/* FIXME: touch modifyTimestamp? */
- return 0;
+ return SLAP_CB_CONTINUE;
}
int
monitor_subsys_thread_update(
Operation *op,
+ SlapReply *rs,
Entry *e
)
{
assert( mi != NULL );
dnRdn( &e->e_nname, &rdn );
- if ( dn_match( &rdn, &backload_bv ))
+ if ( dn_match( &rdn, &backload_bv ) ) {
which = 1;
- else if ( dn_match( &rdn, &runqueue_bv ))
+
+ } else if ( dn_match( &rdn, &runqueue_bv ) ) {
which = 2;
- else
- return 0;
+
+ } else {
+ return SLAP_CB_CONTINUE;
+ }
a = attr_find( e->e_attrs, mi->mi_ad_monitoredInfo );
if ( a == NULL ) {
- return -1;
+ return rs->sr_err = LDAP_OTHER;
}
- switch( which ) {
+ switch ( which ) {
case 1:
snprintf( buf, sizeof( buf ), "%d",
ldap_pvt_thread_pool_backload( &connection_pool ) );
a->a_vals[ 0 ].bv_len = len;
AC_MEMCPY( a->a_vals[ 0 ].bv_val, buf, len + 1 );
break;
+
case 2:
- for (i=0; !BER_BVISNULL( a->a_vals+i ); i++) {
+ for ( i = 0; !BER_BVISNULL( a->a_vals + i ); i++) {
ch_free( a->a_vals[i].bv_val );
- BER_BVZERO( a->a_vals+i );
+ BER_BVZERO( a->a_vals + i );
}
bv.bv_val = buf;
ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
/* FIXME: touch modifyTimestamp? */
- return( 0 );
+ return SLAP_CB_CONTINUE;
}
int
monitor_subsys_time_update(
Operation *op,
- Entry *e
-)
+ SlapReply *rs,
+ Entry *e )
{
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
static struct berval bv_current = BER_BVC( "cn=current" );
a = attr_find( e->e_attrs, mi->mi_ad_monitorTimestamp );
if ( a == NULL ) {
- return( -1 );
+ return rs->sr_err = LDAP_OTHER;
}
assert( len == a->a_vals[ 0 ].bv_len );
/* FIXME: touch modifyTimestamp? */
}
- return( 0 );
+ return SLAP_CB_CONTINUE;
}