ITS#9339 slapd-monitor: Add schema arc for overlays

Not directly related to syncrepl, but adds a necessary schema arc.
Also add a convenience function for obtaining an entry with known ndn.
Also fix to ignore outbound connections.
This commit is contained in:
Howard Chu 2020-09-06 13:43:31 +01:00 committed by Quanah Gibson-Mount
parent bf40306581
commit d1283f8161
5 changed files with 30 additions and 3 deletions

View File

@ -314,6 +314,7 @@ typedef struct monitor_extra_t {
struct berval *modify ); struct berval *modify );
monitor_entry_t * (*entrypriv_create)( void ); monitor_entry_t * (*entrypriv_create)( void );
int (*register_subsys_late)( monitor_subsys_t *ms ); int (*register_subsys_late)( monitor_subsys_t *ms );
Entry * (*entry_get_unlocked)( struct berval *ndn );
} monitor_extra_t; } monitor_extra_t;
LDAP_END_DECL LDAP_END_DECL

View File

@ -219,7 +219,7 @@ monitor_subsys_conn_update(
dnRdn( &e->e_nname, &rdn ); dnRdn( &e->e_nname, &rdn );
if ( dn_match( &rdn, &total_bv ) ) { if ( dn_match( &rdn, &total_bv ) ) {
n = connections_nextid(); n = connections_nextid() - SLAPD_SYNC_SYNCCONN_OFFSET;
} else if ( dn_match( &rdn, &current_bv ) ) { } else if ( dn_match( &rdn, &current_bv ) ) {
Connection *c; Connection *c;
@ -229,7 +229,9 @@ monitor_subsys_conn_update(
c != NULL; c != NULL;
n++, c = connection_next( c, &connindex ) ) n++, c = connection_next( c, &connindex ) )
{ {
/* No Op */ ; /* Ignore outbound connections */
if ( c->c_conn_state == SLAP_C_CLIENT )
n--;
} }
connection_done( c ); connection_done( c );
} }
@ -456,6 +458,10 @@ monitor_subsys_conn_create(
{ {
monitor_entry_t *mp; monitor_entry_t *mp;
/* ignore outbound for now, nothing to show */
if ( c->c_conn_state == SLAP_C_CLIENT )
continue;
if ( conn_create( mi, c, &e, ms ) != SLAP_CB_CONTINUE if ( conn_create( mi, c, &e, ms ) != SLAP_CB_CONTINUE
|| e == NULL ) || e == NULL )
{ {

View File

@ -221,3 +221,16 @@ monitor_entry_stub(
} }
return e; return e;
} }
Entry *
monitor_entry_get_unlocked(
struct berval *ndn
)
{
monitor_info_t *mi = ( monitor_info_t * )be_monitor->be_private;
Entry *ret = NULL;
if ( !monitor_cache_get( mi, ndn, &ret ))
monitor_cache_release( mi, ret );
return ret;
}

View File

@ -68,7 +68,8 @@ static const monitor_extra_t monitor_extra = {
monitor_back_entry_stub, monitor_back_entry_stub,
monitor_back_entrypriv_create, monitor_back_entrypriv_create,
monitor_back_register_subsys_late monitor_back_register_subsys_late,
monitor_back_entry_get_unlocked
}; };
@ -1961,6 +1962,7 @@ monitor_back_initialize(
{ "olmSubSystemAttributes", "olmAttributes:0" }, { "olmSubSystemAttributes", "olmAttributes:0" },
{ "olmGenericAttributes", "olmSubSystemAttributes:0" }, { "olmGenericAttributes", "olmSubSystemAttributes:0" },
{ "olmDatabaseAttributes", "olmSubSystemAttributes:1" }, { "olmDatabaseAttributes", "olmSubSystemAttributes:1" },
{ "olmOverlayAttributes", "olmSubSystemAttributes:2" },
/* for example, back-mdb specific attrs /* for example, back-mdb specific attrs
* are in "olmDatabaseAttributes:12" * are in "olmDatabaseAttributes:12"
@ -1972,6 +1974,7 @@ monitor_back_initialize(
{ "olmSubSystemObjectClasses", "olmObjectClasses:0" }, { "olmSubSystemObjectClasses", "olmObjectClasses:0" },
{ "olmGenericObjectClasses", "olmSubSystemObjectClasses:0" }, { "olmGenericObjectClasses", "olmSubSystemObjectClasses:0" },
{ "olmDatabaseObjectClasses", "olmSubSystemObjectClasses:1" }, { "olmDatabaseObjectClasses", "olmSubSystemObjectClasses:1" },
{ "olmOverlayObjectClasses", "olmSubSystemObjectClasses:2" },
/* for example, back-mdb specific objectClasses /* for example, back-mdb specific objectClasses
* are in "olmDatabaseObjectClasses:12" * are in "olmDatabaseObjectClasses:12"

View File

@ -134,9 +134,13 @@ monitor_back_entry_stub LDAP_P((
ObjectClass *oc, ObjectClass *oc,
struct berval *create, struct berval *create,
struct berval *modify )); struct berval *modify ));
extern Entry *
monitor_back_entry_get_unlocked LDAP_P((
struct berval *ndn ));
#define monitor_entrypriv_create monitor_back_entrypriv_create #define monitor_entrypriv_create monitor_back_entrypriv_create
#define monitor_entry_stub monitor_back_entry_stub #define monitor_entry_stub monitor_back_entry_stub
#define monitor_entry_get_unlocked monitor_back_entry_get_unlocked
/* /*
* init * init