103
monitor_subsys_overlay_init_one(
106
monitor_subsys_t *ms,
107
monitor_subsys_t *ms_overlay,
112
char buf[ BACKMONITOR_BUFSIZE ];
116
slap_overinfo *oi = NULL;
118
monitor_entry_t *mp_overlay;
121
assert( overlay_is_over( be ) );
123
oi = (slap_overinfo *)be->bd_info->bi_private;
126
/* find the overlay number, o */
127
for ( o = 0, on2 = oi->oi_list; on2 && on2 != on; on2 = on2->on_next, o++ )
134
/* find the overlay type number, j */
135
for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
136
if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
140
assert( on2 != NULL );
142
bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Overlay %d", o );
145
e_overlay = monitor_entry_stub( &e_database->e_name, &e_database->e_nname, &bv,
146
mi->mi_oc_monitoredObject, mi, NULL, NULL );
148
if ( e_overlay == NULL ) {
149
Debug( LDAP_DEBUG_ANY,
150
"monitor_subsys_overlay_init_one: "
151
"unable to create entry "
152
"\"cn=Overlay %d,%s\"\n",
153
o, e_database->e_name.bv_val, 0 );
156
ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
157
attr_merge_normalize_one( e_overlay, mi->mi_ad_monitoredInfo, &bv, NULL );
159
bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Overlay %d,%s",
160
j, ms_overlay->mss_dn.bv_val );
162
attr_merge_normalize_one( e_overlay, slap_schema.si_ad_seeAlso,
165
if ( SLAP_MONITOR( be ) ) {
166
attr_merge( e_overlay, slap_schema.si_ad_monitorContext,
167
be->be_suffix, be->be_nsuffix );
170
attr_merge( e_overlay, slap_schema.si_ad_namingContexts,
171
be->be_suffix, NULL );
174
mp_overlay = monitor_entrypriv_create();
175
if ( mp_overlay == NULL ) {
178
e_overlay->e_private = ( void * )mp_overlay;
179
mp_overlay->mp_info = ms;
180
mp_overlay->mp_flags = ms->mss_flags | MONITOR_F_SUB;
182
if ( monitor_cache_add( mi, e_overlay ) ) {
183
Debug( LDAP_DEBUG_ANY,
184
"monitor_subsys_overlay_init_one: "
185
"unable to add entry "
186
"\"cn=Overlay %d,%s\"\n",
187
o, e_database->e_name.bv_val, 0 );
191
*ep_overlay = e_overlay;
192
ep_overlay = &mp_overlay->mp_next;
103
198
monitor_subsys_database_init_one(
104
199
monitor_info_t *mi,
126
221
bi = oi->oi_orig;
129
/* Subordinates are not exposed as their own naming context */
130
if ( SLAP_GLUE_SUBORDINATE( be ) ) {
134
224
e = monitor_entry_stub( &ms->mss_dn, &ms->mss_ndn, rdn,
135
225
mi->mi_oc_monitoredObject, mi, NULL, NULL );
137
227
if ( e == NULL ) {
138
228
Debug( LDAP_DEBUG_ANY,
139
"monitor_subsys_database_init: "
229
"monitor_subsys_database_init_one: "
140
230
"unable to create entry \"%s,%s\"\n",
141
231
rdn->bv_val, ms->mss_dn.bv_val, 0 );
166
256
attr_merge( e_database, slap_schema.si_ad_namingContexts,
167
257
be->be_suffix, NULL );
260
if ( SLAP_GLUE_SUBORDINATE( be ) ) {
261
BackendDB *sup_be = select_backend( &be->be_nsuffix[ 0 ], 1 );
262
if ( sup_be == NULL ) {
263
Debug( LDAP_DEBUG_ANY,
264
"monitor_subsys_database_init: "
265
"unable to get superior for %s\n",
266
be->be_suffix[ 0 ].bv_val, 0, 0 );
269
attr_merge( e, mi->mi_ad_monitorSuperiorDN,
270
sup_be->be_suffix, sup_be->be_nsuffix );
171
275
(void)init_readOnly( mi, e, be->be_restrictops );
257
361
if ( oi != NULL ) {
258
362
Entry **ep_overlay = &mp->mp_children;
259
monitor_entry_t *mp_overlay;
260
363
slap_overinst *on = oi->oi_list;
263
for ( o = 0; on; o++, on = on->on_next ) {
267
/* find the overlay number, j */
268
for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
269
if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
273
assert( on2 != NULL );
275
bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Overlay %d", o );
278
e_overlay = monitor_entry_stub( &e->e_name, &e->e_nname, &bv,
279
mi->mi_oc_monitoredObject, mi, NULL, NULL );
281
if ( e_overlay == NULL ) {
282
Debug( LDAP_DEBUG_ANY,
283
"monitor_subsys_database_init: "
284
"unable to create entry "
285
"\"cn=Overlay %d,%s,%s\"\n",
286
o, rdn->bv_val, ms->mss_dn.bv_val );
289
ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
290
attr_merge_normalize_one( e_overlay, mi->mi_ad_monitoredInfo, &bv, NULL );
292
bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Overlay %d,%s",
293
j, ms_overlay->mss_dn.bv_val );
295
attr_merge_normalize_one( e_overlay, slap_schema.si_ad_seeAlso,
298
if ( SLAP_MONITOR( be ) ) {
299
attr_merge( e_overlay, slap_schema.si_ad_monitorContext,
300
be->be_suffix, be->be_nsuffix );
303
attr_merge( e_overlay, slap_schema.si_ad_namingContexts,
304
be->be_suffix, NULL );
307
mp_overlay = monitor_entrypriv_create();
308
if ( mp_overlay == NULL ) {
311
e_overlay->e_private = ( void * )mp_overlay;
312
mp_overlay->mp_info = ms;
313
mp_overlay->mp_flags = ms->mss_flags
316
if ( monitor_cache_add( mi, e_overlay ) ) {
317
Debug( LDAP_DEBUG_ANY,
318
"monitor_subsys_database_init: "
319
"unable to add entry "
320
"\"cn=Overlay %d,%s,%s\"\n",
321
o, rdn->bv_val, ms->mss_dn.bv_val );
325
*ep_overlay = e_overlay;
326
ep_overlay = &mp_overlay->mp_next;
365
for ( ; on; on = on->on_next ) {
366
monitor_subsys_overlay_init_one( mi, be,
367
ms, ms_overlay, on, e, ep_overlay );
448
495
monitor_cache_release( mi, e_database );
449
if ( rc == 0 && ndn && ep && *ep ) {
450
*ndn = (*ep)->e_nname;
496
if ( rc == 0 && ndn_out && ep && *ep ) {
499
struct berval ov_type;
501
ber_str2bv( on->on_bi.bi_type, 0, 0, &ov_type );
503
mp = ( monitor_entry_t * ) (*ep)->e_private;
504
for ( e_ov = mp->mp_children; e_ov; ) {
505
Attribute *a = attr_find( e_ov->e_attrs, mi->mi_ad_monitoredInfo );
507
if ( a != NULL && bvmatch( &a->a_nvals[ 0 ], &ov_type ) ) {
508
*ndn_out = e_ov->e_nname;
512
mp = ( monitor_entry_t * ) e_ov->e_private;
517
*ndn_out = (*ep)->e_nname;
525
monitor_back_register_database(
527
struct berval *ndn_out )
529
return monitor_back_register_database_and_overlay( be, NULL, ndn_out );
533
monitor_back_register_overlay(
535
struct slap_overinst *on,
536
struct berval *ndn_out )
538
return monitor_back_register_database_and_overlay( be, on, ndn_out );
457
542
monitor_subsys_database_init(
459
544
monitor_subsys_t *ms )