mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
refactor ABI for arbitrary attribute/entry/callback registration; propagate pointers to Operation and SlapReply structures to entry create/update/modify callbacks; cleanup
This commit is contained in:
parent
2a5d65de02
commit
cb291bb940
@ -33,16 +33,16 @@ LDAP_BEGIN_DECL
|
||||
#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;
|
||||
@ -256,12 +256,12 @@ typedef struct monitor_subsys_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;
|
||||
@ -269,43 +269,6 @@ 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"
|
||||
|
@ -170,6 +170,7 @@ monitor_cache_get(
|
||||
int
|
||||
monitor_cache_dn2entry(
|
||||
Operation *op,
|
||||
SlapReply *rs,
|
||||
struct berval *ndn,
|
||||
Entry **ep,
|
||||
Entry **matched
|
||||
@ -205,7 +206,7 @@ monitor_cache_dn2entry(
|
||||
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 );
|
||||
}
|
||||
@ -214,7 +215,7 @@ monitor_cache_dn2entry(
|
||||
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 ) {
|
||||
|
@ -35,7 +35,7 @@ monitor_back_compare( struct slap_op *op, struct slap_rep *rs)
|
||||
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 ) {
|
||||
|
@ -174,6 +174,7 @@ monitor_subsys_conn_init(
|
||||
int
|
||||
monitor_subsys_conn_update(
|
||||
Operation *op,
|
||||
SlapReply *rs,
|
||||
Entry *e
|
||||
)
|
||||
{
|
||||
@ -225,7 +226,7 @@ monitor_subsys_conn_update(
|
||||
/* FIXME: touch modifyTimestamp? */
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
return SLAP_CB_CONTINUE;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -237,14 +238,12 @@ conn_create(
|
||||
)
|
||||
{
|
||||
monitor_entry_t *mp;
|
||||
struct tm *ltm;
|
||||
char buf[ BACKMONITOR_BUFSIZE ];
|
||||
char buf2[ LDAP_LUTIL_GENTIME_BUFSIZE ];
|
||||
char buf3[ LDAP_LUTIL_GENTIME_BUFSIZE ];
|
||||
struct tm *ltm;
|
||||
char buf[ BACKMONITOR_BUFSIZE ];
|
||||
char buf2[ LDAP_LUTIL_GENTIME_BUFSIZE ];
|
||||
char buf3[ LDAP_LUTIL_GENTIME_BUFSIZE ];
|
||||
|
||||
struct berval bv;
|
||||
|
||||
Entry *e;
|
||||
Entry *e;
|
||||
|
||||
struct tm *ctm;
|
||||
char ctmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
|
||||
@ -461,7 +460,7 @@ conn_create(
|
||||
|
||||
mp = monitor_entrypriv_create();
|
||||
if ( mp == NULL ) {
|
||||
return -1;
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
e->e_private = ( void * )mp;
|
||||
mp->mp_info = ms;
|
||||
@ -469,12 +468,13 @@ conn_create(
|
||||
|
||||
*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
|
||||
@ -485,7 +485,7 @@ monitor_subsys_conn_create(
|
||||
Connection *c;
|
||||
int connindex;
|
||||
monitor_entry_t *mp;
|
||||
int rc = 0;
|
||||
int rc = SLAP_CB_CONTINUE;
|
||||
monitor_subsys_t *ms;
|
||||
|
||||
assert( mi != NULL );
|
||||
@ -516,7 +516,7 @@ monitor_subsys_conn_create(
|
||||
|
||||
e_tmp = e;
|
||||
}
|
||||
rc = -1;
|
||||
rc = rs->sr_err = LDAP_OTHER;
|
||||
break;
|
||||
}
|
||||
mp = ( monitor_entry_t * )e->e_private;
|
||||
@ -544,22 +544,27 @@ monitor_subsys_conn_create(
|
||||
|
||||
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;
|
||||
|
@ -540,13 +540,13 @@ value_mask( BerVarray v, slap_mask_t cur, slap_mask_t *delta )
|
||||
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;
|
||||
@ -554,26 +554,33 @@ monitor_subsys_database_modify(
|
||||
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 ) {
|
||||
@ -581,7 +588,8 @@ monitor_subsys_database_modify(
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -592,7 +600,8 @@ monitor_subsys_database_modify(
|
||||
val = 0;
|
||||
|
||||
} else {
|
||||
rc = LDAP_INVALID_SYNTAX;
|
||||
assert( 0 );
|
||||
rc = rs->sr_err = LDAP_INVALID_SYNTAX;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@ -600,18 +609,18 @@ monitor_subsys_database_modify(
|
||||
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;
|
||||
}
|
||||
|
||||
@ -623,7 +632,7 @@ monitor_subsys_database_modify(
|
||||
|
||||
case LDAP_MOD_ADD:
|
||||
if ( ro_gotval > 0 ) {
|
||||
rc = LDAP_CONSTRAINT_VIOLATION;
|
||||
rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
|
||||
goto done;
|
||||
}
|
||||
ro_gotval++;
|
||||
@ -641,7 +650,7 @@ monitor_subsys_database_modify(
|
||||
break;
|
||||
|
||||
default:
|
||||
rc = LDAP_OTHER;
|
||||
rc = rs->sr_err = LDAP_OTHER;
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -681,12 +690,12 @@ monitor_subsys_database_modify(
|
||||
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;
|
||||
}
|
||||
|
||||
@ -700,29 +709,29 @@ monitor_subsys_database_modify(
|
||||
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;
|
||||
}
|
||||
|
||||
@ -753,7 +762,7 @@ monitor_subsys_database_modify(
|
||||
} 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;
|
||||
}
|
||||
|
||||
@ -833,6 +842,7 @@ monitor_subsys_database_modify(
|
||||
done:;
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
attrs_free( save_attrs );
|
||||
rc = SLAP_CB_CONTINUE;
|
||||
|
||||
} else {
|
||||
Attribute *tmp = e->e_attrs;
|
||||
|
@ -27,12 +27,14 @@
|
||||
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 );
|
||||
@ -41,34 +43,42 @@ monitor_entry_update(
|
||||
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 );
|
||||
@ -77,21 +87,27 @@ monitor_entry_create(
|
||||
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 );
|
||||
@ -100,20 +116,26 @@ monitor_entry_modify(
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,8 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
|
||||
};
|
||||
|
||||
int
|
||||
monitor_back_register_subsys( monitor_subsys_t *ms )
|
||||
monitor_back_register_subsys(
|
||||
monitor_subsys_t *ms )
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@ -220,8 +221,8 @@ typedef struct entry_limbo_t {
|
||||
|
||||
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;
|
||||
|
||||
@ -364,11 +365,11 @@ done:;
|
||||
|
||||
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;
|
||||
@ -564,8 +565,11 @@ monitor_filter2ndn_cb( Operation *op, SlapReply *rs )
|
||||
}
|
||||
|
||||
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];
|
||||
@ -652,12 +656,12 @@ monitor_filter2ndn( struct berval *base, int scope, struct berval *filter,
|
||||
|
||||
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;
|
||||
@ -809,11 +813,11 @@ done:;
|
||||
|
||||
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 );
|
||||
@ -836,7 +840,9 @@ monitor_back_get_subsys( const char *name )
|
||||
}
|
||||
|
||||
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;
|
||||
@ -862,8 +868,7 @@ monitor_back_get_subsys_by_dn( struct berval *ndn, int sub )
|
||||
|
||||
int
|
||||
monitor_back_initialize(
|
||||
BackendInfo *bi
|
||||
)
|
||||
BackendInfo *bi )
|
||||
{
|
||||
monitor_subsys_t *ms;
|
||||
static char *controls[] = {
|
||||
@ -930,8 +935,7 @@ monitor_back_initialize(
|
||||
|
||||
int
|
||||
monitor_back_db_init(
|
||||
BackendDB *be
|
||||
)
|
||||
BackendDB *be )
|
||||
{
|
||||
monitor_info_t *mi;
|
||||
int i, rc;
|
||||
@ -1396,8 +1400,7 @@ monitor_back_db_init(
|
||||
|
||||
int
|
||||
monitor_back_db_open(
|
||||
BackendDB *be
|
||||
)
|
||||
BackendDB *be )
|
||||
{
|
||||
monitor_info_t *mi = (monitor_info_t *)be->be_private;
|
||||
struct monitor_subsys_t **ms;
|
||||
@ -1708,8 +1711,7 @@ monitor_back_config(
|
||||
const char *fname,
|
||||
int lineno,
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
char **argv )
|
||||
{
|
||||
/*
|
||||
* eventually, will hold backend specific configuration parameters
|
||||
@ -1723,8 +1725,7 @@ monitor_back_db_config(
|
||||
const char *fname,
|
||||
int lineno,
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
char **argv )
|
||||
{
|
||||
monitor_info_t *mi = ( monitor_info_t * )be->be_private;
|
||||
|
||||
@ -1747,8 +1748,7 @@ monitor_back_db_config(
|
||||
|
||||
int
|
||||
monitor_back_db_destroy(
|
||||
BackendDB *be
|
||||
)
|
||||
BackendDB *be )
|
||||
{
|
||||
/*
|
||||
* FIXME: destroys all the data
|
||||
|
@ -71,8 +71,7 @@ static int replace_values( Entry *e, Modification *mod, int *newlevel );
|
||||
int
|
||||
monitor_subsys_log_init(
|
||||
BackendDB *be,
|
||||
monitor_subsys_t *ms
|
||||
)
|
||||
monitor_subsys_t *ms )
|
||||
{
|
||||
monitor_info_t *mi;
|
||||
Entry *e;
|
||||
@ -129,8 +128,8 @@ monitor_subsys_log_init(
|
||||
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;
|
||||
@ -154,9 +153,8 @@ monitor_subsys_log_modify(
|
||||
*/
|
||||
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;
|
||||
@ -164,8 +162,8 @@ monitor_subsys_log_modify(
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
@ -188,6 +186,7 @@ monitor_subsys_log_modify(
|
||||
}
|
||||
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
rs->sr_err = rc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -199,7 +198,7 @@ monitor_subsys_log_modify(
|
||||
|
||||
/* check for abandon */
|
||||
if ( op->o_abandon ) {
|
||||
rc = SLAPD_ABANDON;
|
||||
rc = rs->sr_err = SLAPD_ABANDON;
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
@ -208,6 +207,7 @@ monitor_subsys_log_modify(
|
||||
rc = entry_schema_check( be_monitor, e, save_attrs,
|
||||
&text, textbuf, sizeof( textbuf ) );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
rs->sr_err = rc;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -236,7 +236,11 @@ cleanup:;
|
||||
|
||||
ldap_pvt_thread_mutex_unlock( &monitor_log_mutex );
|
||||
|
||||
return( rc );
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
rc = SLAP_CB_CONTINUE;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -41,7 +41,7 @@ monitor_back_modify( Operation *op, SlapReply *rs )
|
||||
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 ) {
|
||||
@ -69,7 +69,7 @@ monitor_back_modify( Operation *op, SlapReply *rs )
|
||||
rc = LDAP_INSUFFICIENT_ACCESS;
|
||||
|
||||
} else {
|
||||
rc = monitor_entry_modify( op, e );
|
||||
rc = monitor_entry_modify( op, rs, e );
|
||||
}
|
||||
|
||||
#ifdef SLAP_ACL_HONOR_DISCLOSE
|
||||
|
@ -155,6 +155,7 @@ monitor_subsys_ops_init(
|
||||
int
|
||||
monitor_subsys_ops_update(
|
||||
Operation *op,
|
||||
SlapReply *rs,
|
||||
Entry *e
|
||||
)
|
||||
{
|
||||
@ -217,6 +218,6 @@ monitor_subsys_ops_update(
|
||||
|
||||
/* FIXME: touch modifyTimestamp? */
|
||||
|
||||
return( 0 );
|
||||
return SLAP_CB_CONTINUE;
|
||||
}
|
||||
|
||||
|
@ -28,99 +28,245 @@ LDAP_BEGIN_DECL
|
||||
/*
|
||||
* 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 } */
|
||||
|
@ -142,6 +142,7 @@ monitor_subsys_rww_init(
|
||||
int
|
||||
monitor_subsys_rww_update(
|
||||
Operation *op,
|
||||
SlapReply *rs,
|
||||
Entry *e
|
||||
)
|
||||
{
|
||||
@ -170,7 +171,7 @@ monitor_subsys_rww_update(
|
||||
}
|
||||
|
||||
if ( i == MONITOR_RWW_LAST ) {
|
||||
return 0;
|
||||
return SLAP_CB_CONTINUE;
|
||||
}
|
||||
|
||||
nconns = nwritewaiters = nreadwaiters = 0;
|
||||
@ -211,7 +212,7 @@ monitor_subsys_rww_update(
|
||||
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 );
|
||||
@ -219,6 +220,6 @@ monitor_subsys_rww_update(
|
||||
|
||||
/* FIXME: touch modifyTimestamp? */
|
||||
|
||||
return( 0 );
|
||||
return SLAP_CB_CONTINUE;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ monitor_send_children(
|
||||
|
||||
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 );
|
||||
|
||||
@ -86,7 +86,7 @@ monitor_send_children(
|
||||
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 );
|
||||
@ -134,7 +134,7 @@ monitor_back_search( Operation *op, SlapReply *rs )
|
||||
|
||||
|
||||
/* 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 ) {
|
||||
@ -184,7 +184,7 @@ monitor_back_search( Operation *op, SlapReply *rs )
|
||||
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;
|
||||
@ -201,7 +201,7 @@ monitor_back_search( Operation *op, SlapReply *rs )
|
||||
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;
|
||||
|
@ -146,8 +146,8 @@ monitor_subsys_sent_init(
|
||||
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;
|
||||
|
||||
@ -168,7 +168,7 @@ monitor_subsys_sent_update(
|
||||
}
|
||||
|
||||
if ( i == MONITOR_SENT_LAST ) {
|
||||
return 0;
|
||||
return SLAP_CB_CONTINUE;
|
||||
}
|
||||
|
||||
ldap_pvt_thread_mutex_lock(&slap_counters.sc_sent_mutex);
|
||||
@ -203,6 +203,6 @@ monitor_subsys_sent_update(
|
||||
|
||||
/* FIXME: touch modifyTimestamp? */
|
||||
|
||||
return 0;
|
||||
return SLAP_CB_CONTINUE;
|
||||
}
|
||||
|
||||
|
@ -219,6 +219,7 @@ monitor_subsys_thread_init(
|
||||
int
|
||||
monitor_subsys_thread_update(
|
||||
Operation *op,
|
||||
SlapReply *rs,
|
||||
Entry *e
|
||||
)
|
||||
{
|
||||
@ -235,19 +236,22 @@ monitor_subsys_thread_update(
|
||||
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 ) );
|
||||
@ -258,10 +262,11 @@ monitor_subsys_thread_update(
|
||||
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 );
|
||||
@ -276,6 +281,6 @@ monitor_subsys_thread_update(
|
||||
|
||||
/* FIXME: touch modifyTimestamp? */
|
||||
|
||||
return( 0 );
|
||||
return SLAP_CB_CONTINUE;
|
||||
}
|
||||
|
||||
|
@ -169,8 +169,8 @@ monitor_subsys_time_init(
|
||||
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" );
|
||||
@ -219,7 +219,7 @@ monitor_subsys_time_update(
|
||||
|
||||
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 );
|
||||
@ -228,6 +228,6 @@ monitor_subsys_time_update(
|
||||
/* FIXME: touch modifyTimestamp? */
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
return SLAP_CB_CONTINUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user