LDAP_BEGIN_DECL
-#define MONITOR_DEVEL
-
/*
* The cache maps DNs to Entries.
* Each entry, on turn, holds the list of its children in the e_private field.
int ( *mss_create )( Operation *,
struct berval *ndn, Entry *, Entry ** );
/* modify entry and subentries */
- int ( *mss_modify )( Operation *, Entry *,
- Modifications *modlist );
+ int ( *mss_modify )( Operation *, Entry * );
};
extern struct monitorsubsys monitor_subsys[];
extern int monitor_cache_dup LDAP_P(( void *c1, void *c2 ));
extern int monitor_cache_add LDAP_P(( struct monitorinfo *mi, Entry *e ));
extern int monitor_cache_get LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry **ep ));
-extern int monitor_cache_dn2entry LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry **ep, Entry **matched ));
+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(( struct monitorinfo *mi, Entry *e ));
*/
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, Modifications *modlist ));
+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 ));
LDAP_END_DECL
*/
int
monitor_cache_dn2entry(
- struct monitorinfo *mi,
+ Operation *op,
struct berval *ndn,
Entry **ep,
Entry **matched
)
{
- int rc;
-
+ struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
+ int rc;
struct berval p_ndn = { 0L, NULL };
Entry *e_parent;
struct monitorentrypriv *mp;
- ( ber_len_t ) ( p_ndn.bv_val - ndn->bv_val );
}
- rc = monitor_cache_dn2entry( mi, &p_ndn, &e_parent, matched );
+ rc = monitor_cache_dn2entry( op, &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( mi, ndn, e_parent, ep );
+ rc = monitor_entry_create( op, ndn, e_parent, ep );
}
if ( !rc ) {
Attribute *a;
/* get entry with reader lock */
- monitor_cache_dn2entry( mi, &op->o_req_ndn, &e, &matched );
+ monitor_cache_dn2entry( op, &op->o_req_ndn, &e, &matched );
if ( e == NULL ) {
rs->sr_err = LDAP_NO_SUCH_OBJECT;
if ( matched ) {
int
monitor_entry_modify(
Operation *op,
- Entry *e,
- Modifications *modlist
+ Entry *e
)
{
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
mp = ( struct monitorentrypriv * )e->e_private;
if ( mp->mp_info && mp->mp_info->mss_modify ) {
- return ( *mp->mp_info->mss_modify )( op, e, modlist );
+ return ( *mp->mp_info->mss_modify )( op, e );
}
return( 0 );
/*
* used by many functions to add description to entries
*/
-AttributeDescription *monitor_ad_desc = NULL;
BackendDB *be_monitor = NULL;
/*
char *schema;
int offset;
} moc[] = {
+#ifdef MONITOR_DEVEL
{ "monitorServer", "( 1.3.6.1.4.1.4203.666.XXX "
"NAME 'monitorServer' "
"DESC 'Server monitoring root entry' "
"DESC 'monitor monitored entity class' "
"SUP monitor STRUCTURAL)",
offsetof(struct monitorinfo, monitor_oc_monitoredObject) },
+#endif /* MONITOR_DEVEL */
{ NULL, NULL, -1 }
}, mat[] = {
+#ifdef MONITOR_DEVEL
{ "monitoredInfo", "( 1.3.6.1.4.1.4203.666.XXX"
"NAME 'monitoredInfo' "
"DESC 'monitored info' "
"DESC 'monitor connection peer address' "
"SUP monitoredInfo)",
offsetof(struct monitorinfo, monitor_ad_monitorConnectionPeerAddress) },
+#endif /* MONITOR_DEVEL */
{ NULL, NULL, -1 }
};
mi = ( struct monitorinfo * )ch_calloc( sizeof( struct monitorinfo ), 1 );
if ( mi == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "unable to initialize monitor backend\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "unable to initialize monitor backend\n", 0, 0, 0 );
+#endif
return -1;
}
if ( !oc ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, CRIT,
- "unable to parse monitor objectclass '%s' "
- "(%s before %s)\n" , moc[i].name,
+ "unable to parse monitor objectclass '%s': "
+ "%s before %s\n" , moc[i].name,
ldap_scherr2str(code), err );
#else
Debug( LDAP_DEBUG_ANY,
- "unable to parse monitor objectclass '%s' "
- "(%s before %s)\n" , moc[i].name,
+ "unable to parse monitor objectclass '%s': "
+ "%s before %s\n" , moc[i].name,
ldap_scherr2str(code), err );
#endif
return -1;
if ( code ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, CRIT,
- "objectclass '%s' (%s before %s)\n" ,
+ "objectclass '%s': %s before %s\n" ,
moc[i].name, scherr2str(code), err );
#else
Debug( LDAP_DEBUG_ANY,
- "objectclass '%s' (%s before %s)\n" ,
+ "objectclass '%s': %s before %s\n" ,
moc[i].name, scherr2str(code), err );
#endif
return -1;
at = ldap_str2attributetype( mat[i].schema, &code,
&err, LDAP_SCHEMA_ALLOW_ALL );
- if ( !at ) {
- return 1;
- }
-
- if ( at->at_oid == NULL ) {
+ if ( !at || at->at_oid == NULL ) {
return 1;
}
- /* operational attributes should be defined internally
- if ( at->at_usage ) {
- fprintf( stderr, "%s: line %d: attribute type \"%s\" is operational\n",
- fname, lineno, at->at_oid );
- return 1;
- } */
-
code = at_add(at,&err);
if ( code ) {
return 1;
"monitor_back_db_init: %s\n", text, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
- "monitor_subsys_backend_init: %s\n%s%s",
- text, "", "" );
+ "monitor_back_db_init: %s\n", text, 0, 0 );
#endif
return -1;
}
"monitor_back_db_init: %s\n", text, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
- "monitor_subsys_backend_init: %s\n%s%s",
- text, "", "" );
+ "monitor_back_db_init: %s\n", text, 0, 0 );
#endif
return( -1 );
}
} else {
bv.bv_len = strlen( Versionstr );
}
- if ( attr_merge_normalize_one( e, monitor_ad_desc, &bv, NULL ) ) {
+ if ( attr_merge_normalize_one( e, mi->monitor_ad_description,
+ &bv, NULL ) ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, CRIT,
"unable to add description to '%s' entry\n",
int
monitor_subsys_log_modify(
Operation *op,
- Entry *e,
- Modifications *modlist
+ Entry *e
)
{
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
int rc = LDAP_OTHER;
int newlevel = ldap_syslog;
Attribute *save_attrs;
+ Modifications *modlist = op->oq_modify.rs_modlist;
Modifications *ml;
ldap_pvt_thread_mutex_lock( &monitor_log_mutex );
#endif
/* acquire and lock entry */
- monitor_cache_dn2entry( mi, &op->o_req_ndn, &e, &matched );
+ monitor_cache_dn2entry( op, &op->o_req_ndn, &e, &matched );
if ( e == NULL ) {
rs->sr_err = LDAP_NO_SUCH_OBJECT;
if ( matched ) {
if ( !acl_check_modlist( op, e, op->oq_modify.rs_modlist )) {
rc = LDAP_INSUFFICIENT_ACCESS;
} else {
- rc = monitor_entry_modify( op, e, op->oq_modify.rs_modlist );
+ rc = monitor_entry_modify( op, e );
}
rs->sr_err = rc;
* log
*/
int monitor_subsys_log_init LDAP_P(( BackendDB *be ));
-int monitor_subsys_log_modify LDAP_P(( Operation *op, Entry *e,
- Modifications *modlist ));
+int monitor_subsys_log_modify LDAP_P(( Operation *op, Entry *e ));
/*
* operations
/* get entry with reader lock */
- monitor_cache_dn2entry( mi, &op->o_req_ndn, &e, &matched );
+ monitor_cache_dn2entry( op, &op->o_req_ndn, &e, &matched );
if ( e == NULL ) {
rs->sr_err = LDAP_NO_SUCH_OBJECT;
if ( matched ) {