1 /* database.c - deals with database subsystem */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2001-2005 The OpenLDAP Foundation.
6 * Portions Copyright 2001-2003 Pierangelo Masarati.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted only as authorized by the OpenLDAP
13 * A copy of this license is available in file LICENSE in the
14 * top-level directory of the distribution or, alternatively, at
15 * <http://www.OpenLDAP.org/license.html>.
18 * This work was initially developed by Pierangelo Masarati for inclusion
19 * in OpenLDAP Software.
25 #include <ac/string.h>
26 #include <ac/unistd.h>
29 #include "back-monitor.h"
31 #if defined(LDAP_SLAPI)
33 static int monitor_back_add_plugin( monitor_info_t *mi, Backend *be, Entry *e );
34 #endif /* defined(LDAP_SLAPI) */
36 #if defined(SLAPD_BDB)
37 #include "../back-bdb/back-bdb.h"
38 #endif /* defined(SLAPD_BDB) */
39 #if defined(SLAPD_HDB)
40 #include "../back-hdb/back-bdb.h"
41 #endif /* defined(SLAPD_HDB) */
42 #if defined(SLAPD_LDAP)
43 #include "../back-ldap/back-ldap.h"
44 #endif /* defined(SLAPD_LDAP) */
45 #if 0 && defined(SLAPD_LDBM)
46 #include "../back-ldbm/back-ldbm.h"
47 #endif /* defined(SLAPD_LDBM) */
49 /* for PATH_MAX on some systems (e.g. Solaris) */
52 #endif /* HAVE_LIMITS_H */
55 #endif /* ! PATH_MAX */
57 static struct restricted_ops_t {
60 } restricted_ops[] = {
61 { BER_BVC( "add" ), SLAP_RESTRICT_OP_ADD },
62 { BER_BVC( "bind" ), SLAP_RESTRICT_OP_BIND },
63 { BER_BVC( "compare" ), SLAP_RESTRICT_OP_COMPARE },
64 { BER_BVC( "delete" ), SLAP_RESTRICT_OP_DELETE },
65 { BER_BVC( "extended" ), SLAP_RESTRICT_OP_EXTENDED },
66 { BER_BVC( "modify" ), SLAP_RESTRICT_OP_MODIFY },
67 { BER_BVC( "rename" ), SLAP_RESTRICT_OP_RENAME },
68 { BER_BVC( "search" ), SLAP_RESTRICT_OP_SEARCH },
70 }, restricted_exops[] = {
71 { BER_BVC( LDAP_EXOP_START_TLS ), SLAP_RESTRICT_EXOP_START_TLS },
72 { BER_BVC( LDAP_EXOP_MODIFY_PASSWD ), SLAP_RESTRICT_EXOP_MODIFY_PASSWD },
73 { BER_BVC( LDAP_EXOP_X_WHO_AM_I ), SLAP_RESTRICT_EXOP_WHOAMI },
74 { BER_BVC( LDAP_EXOP_X_CANCEL ), SLAP_RESTRICT_EXOP_CANCEL },
79 init_readOnly( monitor_info_t *mi, Entry *e, slap_mask_t restrictops )
81 struct berval *tf = ( ( restrictops & SLAP_RESTRICT_OP_MASK ) == SLAP_RESTRICT_OP_WRITES ) ?
82 (struct berval *)&slap_true_bv : (struct berval *)&slap_false_bv;
84 return attr_merge_one( e, mi->mi_ad_readOnly, tf, tf );
88 init_restrictedOperation( monitor_info_t *mi, Entry *e, slap_mask_t restrictops )
92 for ( i = 0; restricted_ops[ i ].op.bv_val; i++ ) {
93 if ( restrictops & restricted_ops[ i ].tag ) {
94 rc = attr_merge_one( e, mi->mi_ad_restrictedOperation,
95 &restricted_ops[ i ].op,
96 &restricted_ops[ i ].op );
103 for ( i = 0; restricted_exops[ i ].op.bv_val; i++ ) {
104 if ( restrictops & restricted_exops[ i ].tag ) {
105 rc = attr_merge_one( e, mi->mi_ad_restrictedOperation,
106 &restricted_exops[ i ].op,
107 &restricted_exops[ i ].op );
118 monitor_subsys_database_init(
124 Entry *e_database, **ep;
127 monitor_subsys_t *ms_backend,
130 assert( be != NULL );
132 mi = ( monitor_info_t * )be->be_private;
134 ms_backend = monitor_back_get_subsys( SLAPD_MONITOR_BACKEND_NAME );
135 if ( ms_backend == NULL ) {
136 Debug( LDAP_DEBUG_ANY,
137 "monitor_subsys_database_init: "
139 "\"" SLAPD_MONITOR_BACKEND_NAME "\" "
145 ms_overlay = monitor_back_get_subsys( SLAPD_MONITOR_OVERLAY_NAME );
146 if ( ms_overlay == NULL ) {
147 Debug( LDAP_DEBUG_ANY,
148 "monitor_subsys_database_init: "
150 "\"" SLAPD_MONITOR_OVERLAY_NAME "\" "
156 if ( monitor_cache_get( mi, &ms->mss_ndn, &e_database ) ) {
157 Debug( LDAP_DEBUG_ANY,
158 "monitor_subsys_database_init: "
159 "unable to get entry \"%s\"\n",
160 ms->mss_ndn.bv_val, 0, 0 );
164 (void)init_readOnly( mi, e_database, frontendDB->be_restrictops );
165 (void)init_restrictedOperation( mi, e_database, frontendDB->be_restrictops );
167 mp = ( monitor_entry_t * )e_database->e_private;
168 mp->mp_children = NULL;
169 ep = &mp->mp_children;
172 LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
173 char buf[ BACKMONITOR_BUFSIZE ];
175 slap_overinfo *oi = NULL;
176 BackendInfo *bi, *bi2;
183 if ( overlay_is_over( be ) ) {
184 oi = (slap_overinfo *)be->bd_info->bi_private;
188 /* Subordinates are not exposed as their own naming context */
189 if ( SLAP_GLUE_SUBORDINATE( be ) ) {
193 snprintf( buf, sizeof( buf ),
194 "dn: cn=Database %d,%s\n"
196 "structuralObjectClass: %s\n"
198 "description: This object contains the type of the database.\n"
201 "modifiersName: %s\n"
202 "createTimestamp: %s\n"
203 "modifyTimestamp: %s\n",
206 mi->mi_oc_monitoredObject->soc_cname.bv_val,
207 mi->mi_oc_monitoredObject->soc_cname.bv_val,
209 mi->mi_ad_monitoredInfo->ad_cname.bv_val,
211 mi->mi_creatorsName.bv_val,
212 mi->mi_creatorsName.bv_val,
213 mi->mi_startTime.bv_val,
214 mi->mi_startTime.bv_val );
216 e = str2entry( buf );
218 Debug( LDAP_DEBUG_ANY,
219 "monitor_subsys_database_init: "
220 "unable to create entry \"cn=Database %d,%s\"\n",
221 i, ms->mss_dn.bv_val, 0 );
225 if ( SLAP_MONITOR(be) ) {
226 attr_merge( e, slap_schema.si_ad_monitorContext,
227 be->be_suffix, be->be_nsuffix );
228 attr_merge( e_database, slap_schema.si_ad_monitorContext,
229 be->be_suffix, be->be_nsuffix );
232 if ( be->be_suffix == NULL ) {
233 Debug( LDAP_DEBUG_ANY,
234 "monitor_subsys_database_init: "
235 "missing suffix for database %d\n",
239 attr_merge( e, slap_schema.si_ad_namingContexts,
240 be->be_suffix, be->be_nsuffix );
241 attr_merge( e_database, slap_schema.si_ad_namingContexts,
242 be->be_suffix, be->be_nsuffix );
245 (void)init_readOnly( mi, e, be->be_restrictops );
246 (void)init_restrictedOperation( mi, e, be->be_restrictops );
249 slap_overinst *on = oi->oi_list,
252 for ( ; on; on = on->on_next ) {
256 for ( on2 = on1; on2 != on; on2 = on2->on_next ) {
257 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
266 ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
267 attr_merge_normalize_one( e, mi->mi_ad_monitorOverlay,
270 /* find the overlay number, j */
271 for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
272 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
278 snprintf( buf, sizeof( buf ),
280 j, ms_overlay->mss_dn.bv_val );
281 ber_str2bv( buf, 0, 0, &bv );
282 attr_merge_normalize_one( e, mi->mi_ad_seeAlso,
287 #if defined(SLAPD_BDB) || defined(SLAPD_HDB)
288 if ( strcmp( bi->bi_type, "bdb" ) == 0
289 || strcmp( bi->bi_type, "hdb" ) == 0 )
292 ber_len_t pathlen = 0, len = 0;
293 char path[ PATH_MAX ] = { '\0' };
296 if ( strcmp( bi->bi_type, "bdb" ) == 0
297 || strcmp( bi->bi_type, "hdb" ) == 0 )
299 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
301 fname = bdb->bi_dbenv_home;
303 } else if ( strcmp( bi->bi_type, "ldbm" ) == 0 ) {
304 struct ldbminfo *ldbm = (struct ldbminfo *) be->be_private;
306 /* FIXME: there's a conflict
307 * between back-bdb.h and back.ldbm.h;
308 * anyway, this code will be moved
309 * to the backends as soon as the
310 * issue with filtering on namingContexts
312 fname = ldbm->li_directory;
316 len = strlen( fname );
317 if ( fname[ 0 ] != '/' ) {
318 /* get full path name */
319 getcwd( path, sizeof( path ) );
320 pathlen = strlen( path );
322 if ( fname[ 0 ] == '.' && fname[ 1 ] == '/' ) {
328 bv.bv_len = STRLENOF( "file://" ) + pathlen
329 + STRLENOF( "/" ) + len;
330 bv.bv_val = ch_malloc( bv.bv_len + STRLENOF( "/" ) + 1 );
331 AC_MEMCPY( bv.bv_val, "file://", STRLENOF( "file://" ) );
333 AC_MEMCPY( &bv.bv_val[ STRLENOF( "file://" ) ],
335 bv.bv_val[ STRLENOF( "file://" ) + pathlen ] = '/';
338 AC_MEMCPY( &bv.bv_val[ STRLENOF( "file://" ) + pathlen ],
340 if ( bv.bv_val[ bv.bv_len - 1 ] != '/' ) {
341 bv.bv_val[ bv.bv_len ] = '/';
344 bv.bv_val[ bv.bv_len ] = '\0';
346 attr_merge_normalize_one( e, slap_schema.si_ad_labeledURI,
349 ch_free( bv.bv_val );
351 #endif /* defined(SLAPD_LDAP) || defined(SLAPD_HDB) */
353 #if defined(SLAPD_LDAP)
354 if ( strcmp( bi->bi_type, "ldap" ) == 0 ) {
355 struct ldapinfo *li =
356 (struct ldapinfo *)be->be_private;
359 ber_str2bv( li->url, 0, 0, &bv );
361 attr_merge_normalize_one( e,
362 slap_schema.si_ad_labeledURI,
365 #endif /* defined(SLAPD_LDAP) */
368 LDAP_STAILQ_FOREACH( bi2, &backendInfo, bi_next ) {
370 if ( bi2->bi_type == bi->bi_type ) {
373 snprintf( buf, sizeof( buf ),
375 j, ms_backend->mss_dn.bv_val );
377 bv.bv_len = strlen( buf );
378 attr_merge_normalize_one( e, mi->mi_ad_seeAlso,
383 /* we must find it! */
386 mp = monitor_entrypriv_create();
390 e->e_private = ( void * )mp;
392 mp->mp_flags = ms->mss_flags
395 if ( monitor_cache_add( mi, e ) ) {
396 Debug( LDAP_DEBUG_ANY,
397 "monitor_subsys_database_init: "
398 "unable to add entry \"cn=Database %d,%s\"\n",
399 i, ms->mss_dn.bv_val, 0 );
403 #if defined(LDAP_SLAPI)
404 monitor_back_add_plugin( mi, be, e );
405 #endif /* defined(LDAP_SLAPI) */
408 Entry **ep_overlay = &mp->mp_children;
409 monitor_entry_t *mp_overlay;
410 slap_overinst *on = oi->oi_list;
413 for ( o = 0; on; o++, on = on->on_next ) {
417 /* find the overlay number, j */
418 for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
419 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
425 snprintf( buf, sizeof( buf ),
426 "dn: cn=Overlay %d,cn=Database %d,%s\n"
428 "structuralObjectClass: %s\n"
430 "description: This object contains the type of the overlay.\n"
432 "seeAlso: cn=Overlay %d,%s\n"
434 "modifiersName: %s\n"
435 "createTimestamp: %s\n"
436 "modifyTimestamp: %s\n",
440 mi->mi_oc_monitoredObject->soc_cname.bv_val,
441 mi->mi_oc_monitoredObject->soc_cname.bv_val,
443 mi->mi_ad_monitoredInfo->ad_cname.bv_val,
446 ms_overlay->mss_dn.bv_val,
447 mi->mi_creatorsName.bv_val,
448 mi->mi_creatorsName.bv_val,
449 mi->mi_startTime.bv_val,
450 mi->mi_startTime.bv_val );
452 e_overlay = str2entry( buf );
453 if ( e_overlay == NULL ) {
454 Debug( LDAP_DEBUG_ANY,
455 "monitor_subsys_database_init: "
456 "unable to create entry "
457 "\"cn=Overlay %d,cn=Database %d,%s\"\n",
458 o, i, ms->mss_dn.bv_val );
462 mp_overlay = monitor_entrypriv_create();
463 if ( mp_overlay == NULL ) {
466 e_overlay->e_private = ( void * )mp_overlay;
467 mp_overlay->mp_info = ms;
468 mp_overlay->mp_flags = ms->mss_flags
471 if ( monitor_cache_add( mi, e_overlay ) ) {
472 Debug( LDAP_DEBUG_ANY,
473 "monitor_subsys_database_init: "
474 "unable to add entry "
475 "\"cn=Overlay %d,cn=Database %d,%s\"\n",
476 o, i, ms->mss_dn.bv_val );
480 *ep_overlay = e_overlay;
481 ep_overlay = &mp_overlay->mp_next;
489 monitor_cache_release( mi, e_database );
496 * cur: must not contain the tags corresponding to the values in v
497 * delta: will contain the tags corresponding to the values in v
500 value_mask( BerVarray v, slap_mask_t cur, slap_mask_t *delta )
502 for ( ; !BER_BVISNULL( v ); v++ ) {
503 struct restricted_ops_t *rops;
506 if ( OID_LEADCHAR( v->bv_val[ 0 ] ) ) {
507 rops = restricted_exops;
510 rops = restricted_ops;
513 for ( i = 0; !BER_BVISNULL( &rops[ i ].op ); i++ ) {
514 if ( ber_bvstrcasecmp( v, &rops[ i ].op ) != 0 ) {
518 if ( rops[ i ].tag & *delta ) {
522 if ( rops[ i ].tag & cur ) {
526 cur |= rops[ i ].tag;
527 *delta |= rops[ i ].tag;
532 if ( BER_BVISNULL( &rops[ i ].op ) ) {
533 return LDAP_INVALID_SYNTAX;
541 monitor_subsys_database_modify(
547 monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
549 Attribute *save_attrs, *a;
552 int ro_gotval = 1, i, n;
553 slap_mask_t rp_add = 0, rp_delete = 0, rp_cur;
556 i = sscanf( e->e_nname.bv_val, "cn=database %d,", &n );
558 return SLAP_CB_CONTINUE;
561 if ( n < 0 || n >= nBackendDB ) {
562 rs->sr_text = "invalid database index";
563 return ( rs->sr_err = LDAP_NO_SUCH_OBJECT );
566 LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
572 /* do not allow some changes on back-monitor (needs work)... */
573 if ( SLAP_MONITOR( be ) ) {
574 rs->sr_text = "no modifications allowed to monitor database entry";
575 return ( rs->sr_err = LDAP_UNWILLING_TO_PERFORM );
578 rp_cur = be->be_restrictops;
580 save_attrs = e->e_attrs;
581 e->e_attrs = attrs_dup( e->e_attrs );
583 for ( ml = op->orm_modlist; ml; ml = ml->sml_next ) {
584 Modification *mod = &ml->sml_mod;
586 if ( mod->sm_desc == mi->mi_ad_readOnly ) {
589 if ( mod->sm_values ) {
590 if ( !BER_BVISNULL( &mod->sm_values[ 1 ] ) ) {
591 rs->sr_text = "attempting to modify multiple values of single-valued attribute";
592 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
596 if ( bvmatch( &slap_true_bv, mod->sm_values )) {
599 } else if ( bvmatch( &slap_false_bv, mod->sm_values )) {
604 rc = rs->sr_err = LDAP_INVALID_SYNTAX;
609 switch ( mod->sm_op ) {
610 case LDAP_MOD_DELETE:
611 if ( ro_gotval < 1 ) {
612 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
617 if ( val == 0 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) == SLAP_RESTRICT_OP_WRITES ) {
618 rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
622 if ( val == 1 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) != SLAP_RESTRICT_OP_WRITES ) {
623 rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
629 case LDAP_MOD_REPLACE:
634 if ( ro_gotval > 0 ) {
635 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
641 rp_add |= (~rp_cur) & SLAP_RESTRICT_OP_WRITES;
642 rp_cur |= SLAP_RESTRICT_OP_WRITES;
643 rp_delete &= ~SLAP_RESTRICT_OP_WRITES;
645 } else if ( val == 0 ) {
646 rp_delete |= rp_cur & SLAP_RESTRICT_OP_WRITES;
647 rp_cur &= ~SLAP_RESTRICT_OP_WRITES;
648 rp_add &= ~SLAP_RESTRICT_OP_WRITES;
653 rc = rs->sr_err = LDAP_OTHER;
657 } else if ( mod->sm_desc == mi->mi_ad_restrictedOperation ) {
658 slap_mask_t mask = 0;
660 switch ( mod->sm_op ) {
661 case LDAP_MOD_DELETE:
662 if ( mod->sm_values == NULL ) {
668 rc = value_mask( mod->sm_values, ~rp_cur, &mask );
669 if ( rc == LDAP_SUCCESS ) {
674 } else if ( rc == LDAP_OTHER ) {
675 rc = LDAP_NO_SUCH_ATTRIBUTE;
679 case LDAP_MOD_REPLACE:
686 rc = value_mask( mod->sm_values, rp_cur, &mask );
687 if ( rc == LDAP_SUCCESS ) {
692 } else if ( rc == LDAP_OTHER ) {
693 rc = rs->sr_err = LDAP_TYPE_OR_VALUE_EXISTS;
698 rc = rs->sr_err = LDAP_OTHER;
702 if ( rc != LDAP_SUCCESS ) {
706 } else if ( is_at_operational( mod->sm_desc->ad_type )) {
707 /* accept all operational attributes */
708 attr_delete( &e->e_attrs, mod->sm_desc );
709 rc = attr_merge( e, mod->sm_desc, mod->sm_values,
712 rc = rs->sr_err = LDAP_OTHER;
717 rc = rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
723 if ( ro_gotval < 1 ) {
724 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
728 if ( ( rp_cur & SLAP_RESTRICT_OP_EXTENDED ) && ( rp_cur & SLAP_RESTRICT_EXOP_MASK ) ) {
729 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
733 if ( rp_delete & rp_add ) {
734 rc = rs->sr_err = LDAP_OTHER;
738 /* check current value of readOnly */
739 if ( ( rp_cur & SLAP_RESTRICT_OP_WRITES ) == SLAP_RESTRICT_OP_WRITES ) {
740 tf = (struct berval *)&slap_true_bv;
743 tf = (struct berval *)&slap_false_bv;
746 a = attr_find( e->e_attrs, mi->mi_ad_readOnly );
752 if ( !bvmatch( &a->a_vals[ 0 ], tf ) ) {
753 attr_delete( &e->e_attrs, mi->mi_ad_readOnly );
754 rc = attr_merge_one( e, mi->mi_ad_readOnly, tf, tf );
757 if ( rc == LDAP_SUCCESS ) {
759 if ( rp_delete == be->be_restrictops ) {
760 attr_delete( &e->e_attrs, mi->mi_ad_restrictedOperation );
763 a = attr_find( e->e_attrs, mi->mi_ad_restrictedOperation );
765 rc = rs->sr_err = LDAP_OTHER;
769 for ( i = 0; !BER_BVISNULL( &restricted_ops[ i ].op ); i++ ) {
770 if ( rp_delete & restricted_ops[ i ].tag ) {
773 for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
776 if ( !bvmatch( &a->a_nvals[ j ], &restricted_ops[ i ].op ) ) {
780 ch_free( a->a_vals[ j ].bv_val );
781 ch_free( a->a_nvals[ j ].bv_val );
783 for ( k = j + 1; !BER_BVISNULL( &a->a_nvals[ k ] ); k++ ) {
784 a->a_vals[ k - 1 ] = a->a_vals[ k ];
785 a->a_nvals[ k - 1 ] = a->a_nvals[ k ];
788 BER_BVZERO( &a->a_vals[ k - 1 ] );
789 BER_BVZERO( &a->a_nvals[ k - 1 ] );
794 for ( i = 0; !BER_BVISNULL( &restricted_exops[ i ].op ); i++ ) {
795 if ( rp_delete & restricted_exops[ i ].tag ) {
798 for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
801 if ( !bvmatch( &a->a_nvals[ j ], &restricted_exops[ i ].op ) ) {
805 ch_free( a->a_vals[ j ].bv_val );
806 ch_free( a->a_nvals[ j ].bv_val );
808 for ( k = j + 1; !BER_BVISNULL( &a->a_nvals[ k ] ); k++ ) {
809 a->a_vals[ k - 1 ] = a->a_vals[ k ];
810 a->a_nvals[ k - 1 ] = a->a_nvals[ k ];
813 BER_BVZERO( &a->a_vals[ k - 1 ] );
814 BER_BVZERO( &a->a_nvals[ k - 1 ] );
822 for ( i = 0; !BER_BVISNULL( &restricted_ops[ i ].op ); i++ ) {
823 if ( rp_add & restricted_ops[ i ].tag ) {
824 attr_merge_one( e, mi->mi_ad_restrictedOperation,
825 &restricted_ops[ i ].op,
826 &restricted_ops[ i ].op );
830 for ( i = 0; !BER_BVISNULL( &restricted_exops[ i ].op ); i++ ) {
831 if ( rp_add & restricted_exops[ i ].tag ) {
832 attr_merge_one( e, mi->mi_ad_restrictedOperation,
833 &restricted_exops[ i ].op,
834 &restricted_exops[ i ].op );
840 be->be_restrictops = rp_cur;
843 if ( rc == LDAP_SUCCESS ) {
844 attrs_free( save_attrs );
845 rc = SLAP_CB_CONTINUE;
848 Attribute *tmp = e->e_attrs;
849 e->e_attrs = save_attrs;
855 #if defined(LDAP_SLAPI)
857 monitor_back_add_plugin( monitor_info_t *mi, Backend *be, Entry *e_database )
859 Slapi_PBlock *pCurrentPB;
860 int i, rc = LDAP_SUCCESS;
862 if ( slapi_int_pblock_get_first( be, &pCurrentPB ) != LDAP_SUCCESS ) {
864 * LDAP_OTHER is returned if no plugins are installed
872 Slapi_PluginDesc *srchdesc;
873 char buf[ BACKMONITOR_BUFSIZE ];
876 rc = slapi_pblock_get( pCurrentPB, SLAPI_PLUGIN_DESCRIPTION,
878 if ( rc != LDAP_SUCCESS ) {
882 snprintf( buf, sizeof(buf),
883 "plugin %d name: %s; "
889 srchdesc->spd_vendor,
890 srchdesc->spd_version,
891 srchdesc->spd_description );
893 ber_str2bv( buf, 0, 0, &bv );
894 attr_merge_normalize_one( e_database,
895 mi->mi_ad_monitoredInfo, &bv, NULL );
899 } while ( ( slapi_int_pblock_get_next( &pCurrentPB ) == LDAP_SUCCESS )
900 && ( pCurrentPB != NULL ) );
905 #endif /* defined(LDAP_SLAPI) */