From d1283f81613c087b2b5f95464abe1a378d2330dc Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 6 Sep 2020 13:43:31 +0100 Subject: [PATCH] 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. --- servers/slapd/back-monitor/back-monitor.h | 1 + servers/slapd/back-monitor/conn.c | 10 ++++++++-- servers/slapd/back-monitor/entry.c | 13 +++++++++++++ servers/slapd/back-monitor/init.c | 5 ++++- servers/slapd/back-monitor/proto-back-monitor.h | 4 ++++ 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/servers/slapd/back-monitor/back-monitor.h b/servers/slapd/back-monitor/back-monitor.h index b206ee9d5e..e2d54ad1b9 100644 --- a/servers/slapd/back-monitor/back-monitor.h +++ b/servers/slapd/back-monitor/back-monitor.h @@ -314,6 +314,7 @@ typedef struct monitor_extra_t { struct berval *modify ); monitor_entry_t * (*entrypriv_create)( void ); int (*register_subsys_late)( monitor_subsys_t *ms ); + Entry * (*entry_get_unlocked)( struct berval *ndn ); } monitor_extra_t; LDAP_END_DECL diff --git a/servers/slapd/back-monitor/conn.c b/servers/slapd/back-monitor/conn.c index be4df072f8..79903788d9 100644 --- a/servers/slapd/back-monitor/conn.c +++ b/servers/slapd/back-monitor/conn.c @@ -219,7 +219,7 @@ monitor_subsys_conn_update( dnRdn( &e->e_nname, &rdn ); if ( dn_match( &rdn, &total_bv ) ) { - n = connections_nextid(); + n = connections_nextid() - SLAPD_SYNC_SYNCCONN_OFFSET; } else if ( dn_match( &rdn, ¤t_bv ) ) { Connection *c; @@ -229,7 +229,9 @@ monitor_subsys_conn_update( c != NULL; n++, c = connection_next( c, &connindex ) ) { - /* No Op */ ; + /* Ignore outbound connections */ + if ( c->c_conn_state == SLAP_C_CLIENT ) + n--; } connection_done( c ); } @@ -456,6 +458,10 @@ monitor_subsys_conn_create( { 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 || e == NULL ) { diff --git a/servers/slapd/back-monitor/entry.c b/servers/slapd/back-monitor/entry.c index 13504a2f29..8c1d83f9cb 100644 --- a/servers/slapd/back-monitor/entry.c +++ b/servers/slapd/back-monitor/entry.c @@ -221,3 +221,16 @@ monitor_entry_stub( } 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; +} diff --git a/servers/slapd/back-monitor/init.c b/servers/slapd/back-monitor/init.c index d4e62be229..c541863e0c 100644 --- a/servers/slapd/back-monitor/init.c +++ b/servers/slapd/back-monitor/init.c @@ -68,7 +68,8 @@ static const monitor_extra_t monitor_extra = { monitor_back_entry_stub, 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" }, { "olmGenericAttributes", "olmSubSystemAttributes:0" }, { "olmDatabaseAttributes", "olmSubSystemAttributes:1" }, + { "olmOverlayAttributes", "olmSubSystemAttributes:2" }, /* for example, back-mdb specific attrs * are in "olmDatabaseAttributes:12" @@ -1972,6 +1974,7 @@ monitor_back_initialize( { "olmSubSystemObjectClasses", "olmObjectClasses:0" }, { "olmGenericObjectClasses", "olmSubSystemObjectClasses:0" }, { "olmDatabaseObjectClasses", "olmSubSystemObjectClasses:1" }, + { "olmOverlayObjectClasses", "olmSubSystemObjectClasses:2" }, /* for example, back-mdb specific objectClasses * are in "olmDatabaseObjectClasses:12" diff --git a/servers/slapd/back-monitor/proto-back-monitor.h b/servers/slapd/back-monitor/proto-back-monitor.h index 20084e4229..a0ae00ca5a 100644 --- a/servers/slapd/back-monitor/proto-back-monitor.h +++ b/servers/slapd/back-monitor/proto-back-monitor.h @@ -134,9 +134,13 @@ monitor_back_entry_stub LDAP_P(( ObjectClass *oc, struct berval *create, 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_entry_stub monitor_back_entry_stub +#define monitor_entry_get_unlocked monitor_back_entry_get_unlocked /* * init