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"
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_ad_monitorIsShadow->ad_cname.bv_val,
212 SLAP_SHADOW( be ) ? slap_true_bv.bv_val : slap_false_bv.bv_val,
213 mi->mi_creatorsName.bv_val,
214 mi->mi_creatorsName.bv_val,
215 mi->mi_startTime.bv_val,
216 mi->mi_startTime.bv_val );
218 e = str2entry( buf );
220 Debug( LDAP_DEBUG_ANY,
221 "monitor_subsys_database_init: "
222 "unable to create entry \"cn=Database %d,%s\"\n",
223 i, ms->mss_dn.bv_val, 0 );
227 if ( SLAP_MONITOR( be ) ) {
228 attr_merge( e, slap_schema.si_ad_monitorContext,
229 be->be_suffix, be->be_nsuffix );
230 attr_merge( e_database, slap_schema.si_ad_monitorContext,
231 be->be_suffix, be->be_nsuffix );
234 if ( be->be_suffix == NULL ) {
235 Debug( LDAP_DEBUG_ANY,
236 "monitor_subsys_database_init: "
237 "missing suffix for database %d\n",
241 attr_merge( e, slap_schema.si_ad_namingContexts,
242 be->be_suffix, be->be_nsuffix );
243 attr_merge( e_database, slap_schema.si_ad_namingContexts,
244 be->be_suffix, be->be_nsuffix );
247 (void)init_readOnly( mi, e, be->be_restrictops );
248 (void)init_restrictedOperation( mi, e, be->be_restrictops );
250 if ( SLAP_SHADOW( be ) && be->be_update_refs ) {
251 attr_merge_normalize( e, mi->mi_ad_monitorUpdateRef,
252 be->be_update_refs, NULL );
256 slap_overinst *on = oi->oi_list,
259 for ( ; on; on = on->on_next ) {
263 for ( on2 = on1; on2 != on; on2 = on2->on_next ) {
264 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
273 ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
274 attr_merge_normalize_one( e, mi->mi_ad_monitorOverlay,
277 /* find the overlay number, j */
278 for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
279 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
285 snprintf( buf, sizeof( buf ),
287 j, ms_overlay->mss_dn.bv_val );
288 ber_str2bv( buf, 0, 0, &bv );
289 attr_merge_normalize_one( e,
290 slap_schema.si_ad_seeAlso,
295 #if defined(SLAPD_BDB) || defined(SLAPD_HDB)
296 if ( strcmp( bi->bi_type, "bdb" ) == 0
297 || strcmp( bi->bi_type, "hdb" ) == 0 )
300 ber_len_t pathlen = 0, len = 0;
301 char path[ PATH_MAX ] = { '\0' };
304 if ( strcmp( bi->bi_type, "bdb" ) == 0
305 || strcmp( bi->bi_type, "hdb" ) == 0 )
307 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
309 fname = bdb->bi_dbenv_home;
311 } else if ( strcmp( bi->bi_type, "ldbm" ) == 0 ) {
312 struct ldbminfo *ldbm = (struct ldbminfo *) be->be_private;
314 /* FIXME: there's a conflict
315 * between back-bdb.h and back.ldbm.h;
316 * anyway, this code will be moved
317 * to the backends as soon as the
318 * issue with filtering on namingContexts
320 fname = ldbm->li_directory;
324 len = strlen( fname );
325 if ( fname[ 0 ] != '/' ) {
326 /* get full path name */
327 getcwd( path, sizeof( path ) );
328 pathlen = strlen( path );
330 if ( fname[ 0 ] == '.' && fname[ 1 ] == '/' ) {
336 bv.bv_len = STRLENOF( "file://" ) + pathlen
337 + STRLENOF( "/" ) + len;
338 bv.bv_val = ch_malloc( bv.bv_len + STRLENOF( "/" ) + 1 );
339 AC_MEMCPY( bv.bv_val, "file://", STRLENOF( "file://" ) );
341 AC_MEMCPY( &bv.bv_val[ STRLENOF( "file://" ) ],
343 bv.bv_val[ STRLENOF( "file://" ) + pathlen ] = '/';
346 AC_MEMCPY( &bv.bv_val[ STRLENOF( "file://" ) + pathlen ],
348 if ( bv.bv_val[ bv.bv_len - 1 ] != '/' ) {
349 bv.bv_val[ bv.bv_len ] = '/';
352 bv.bv_val[ bv.bv_len ] = '\0';
354 attr_merge_normalize_one( e, slap_schema.si_ad_labeledURI,
357 ch_free( bv.bv_val );
359 #endif /* defined(SLAPD_LDAP) || defined(SLAPD_HDB) */
361 #if defined(SLAPD_LDAP)
362 if ( strcmp( bi->bi_type, "ldap" ) == 0 ) {
363 struct ldapinfo *li =
364 (struct ldapinfo *)be->be_private;
367 ber_str2bv( li->url, 0, 0, &bv );
369 attr_merge_normalize_one( e,
370 slap_schema.si_ad_labeledURI,
373 #endif /* defined(SLAPD_LDAP) */
376 LDAP_STAILQ_FOREACH( bi2, &backendInfo, bi_next ) {
378 if ( bi2->bi_type == bi->bi_type ) {
381 snprintf( buf, sizeof( buf ),
383 j, ms_backend->mss_dn.bv_val );
385 bv.bv_len = strlen( buf );
386 attr_merge_normalize_one( e,
387 slap_schema.si_ad_seeAlso,
392 /* we must find it! */
395 mp = monitor_entrypriv_create();
399 e->e_private = ( void * )mp;
401 mp->mp_flags = ms->mss_flags
404 if ( monitor_cache_add( mi, e ) ) {
405 Debug( LDAP_DEBUG_ANY,
406 "monitor_subsys_database_init: "
407 "unable to add entry \"cn=Database %d,%s\"\n",
408 i, ms->mss_dn.bv_val, 0 );
412 #if defined(LDAP_SLAPI)
413 monitor_back_add_plugin( mi, be, e );
414 #endif /* defined(LDAP_SLAPI) */
417 Entry **ep_overlay = &mp->mp_children;
418 monitor_entry_t *mp_overlay;
419 slap_overinst *on = oi->oi_list;
422 for ( o = 0; on; o++, on = on->on_next ) {
426 /* find the overlay number, j */
427 for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
428 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
434 snprintf( buf, sizeof( buf ),
435 "dn: cn=Overlay %d,cn=Database %d,%s\n"
437 "structuralObjectClass: %s\n"
440 "seeAlso: cn=Overlay %d,%s\n"
442 "modifiersName: %s\n"
443 "createTimestamp: %s\n"
444 "modifyTimestamp: %s\n",
448 mi->mi_oc_monitoredObject->soc_cname.bv_val,
449 mi->mi_oc_monitoredObject->soc_cname.bv_val,
451 mi->mi_ad_monitoredInfo->ad_cname.bv_val,
454 ms_overlay->mss_dn.bv_val,
455 mi->mi_creatorsName.bv_val,
456 mi->mi_creatorsName.bv_val,
457 mi->mi_startTime.bv_val,
458 mi->mi_startTime.bv_val );
460 e_overlay = str2entry( buf );
461 if ( e_overlay == NULL ) {
462 Debug( LDAP_DEBUG_ANY,
463 "monitor_subsys_database_init: "
464 "unable to create entry "
465 "\"cn=Overlay %d,cn=Database %d,%s\"\n",
466 o, i, ms->mss_dn.bv_val );
470 mp_overlay = monitor_entrypriv_create();
471 if ( mp_overlay == NULL ) {
474 e_overlay->e_private = ( void * )mp_overlay;
475 mp_overlay->mp_info = ms;
476 mp_overlay->mp_flags = ms->mss_flags
479 if ( monitor_cache_add( mi, e_overlay ) ) {
480 Debug( LDAP_DEBUG_ANY,
481 "monitor_subsys_database_init: "
482 "unable to add entry "
483 "\"cn=Overlay %d,cn=Database %d,%s\"\n",
484 o, i, ms->mss_dn.bv_val );
488 *ep_overlay = e_overlay;
489 ep_overlay = &mp_overlay->mp_next;
497 monitor_cache_release( mi, e_database );
504 * cur: must not contain the tags corresponding to the values in v
505 * delta: will contain the tags corresponding to the values in v
508 value_mask( BerVarray v, slap_mask_t cur, slap_mask_t *delta )
510 for ( ; !BER_BVISNULL( v ); v++ ) {
511 struct restricted_ops_t *rops;
514 if ( OID_LEADCHAR( v->bv_val[ 0 ] ) ) {
515 rops = restricted_exops;
518 rops = restricted_ops;
521 for ( i = 0; !BER_BVISNULL( &rops[ i ].op ); i++ ) {
522 if ( ber_bvstrcasecmp( v, &rops[ i ].op ) != 0 ) {
526 if ( rops[ i ].tag & *delta ) {
530 if ( rops[ i ].tag & cur ) {
534 cur |= rops[ i ].tag;
535 *delta |= rops[ i ].tag;
540 if ( BER_BVISNULL( &rops[ i ].op ) ) {
541 return LDAP_INVALID_SYNTAX;
549 monitor_subsys_database_modify(
555 monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
557 Attribute *save_attrs, *a;
560 int ro_gotval = 1, i, n;
561 slap_mask_t rp_add = 0, rp_delete = 0, rp_cur;
564 i = sscanf( e->e_nname.bv_val, "cn=database %d,", &n );
566 return SLAP_CB_CONTINUE;
569 if ( n < 0 || n >= nBackendDB ) {
570 rs->sr_text = "invalid database index";
571 return ( rs->sr_err = LDAP_NO_SUCH_OBJECT );
574 LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
580 /* do not allow some changes on back-monitor (needs work)... */
581 if ( SLAP_MONITOR( be ) ) {
582 rs->sr_text = "no modifications allowed to monitor database entry";
583 return ( rs->sr_err = LDAP_UNWILLING_TO_PERFORM );
586 rp_cur = be->be_restrictops;
588 save_attrs = e->e_attrs;
589 e->e_attrs = attrs_dup( e->e_attrs );
591 for ( ml = op->orm_modlist; ml; ml = ml->sml_next ) {
592 Modification *mod = &ml->sml_mod;
594 if ( mod->sm_desc == mi->mi_ad_readOnly ) {
597 if ( mod->sm_values ) {
598 if ( !BER_BVISNULL( &mod->sm_values[ 1 ] ) ) {
599 rs->sr_text = "attempting to modify multiple values of single-valued attribute";
600 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
604 if ( bvmatch( &slap_true_bv, mod->sm_values )) {
607 } else if ( bvmatch( &slap_false_bv, mod->sm_values )) {
612 rc = rs->sr_err = LDAP_INVALID_SYNTAX;
617 switch ( mod->sm_op ) {
618 case LDAP_MOD_DELETE:
619 if ( ro_gotval < 1 ) {
620 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
625 if ( val == 0 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) == SLAP_RESTRICT_OP_WRITES ) {
626 rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
630 if ( val == 1 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) != SLAP_RESTRICT_OP_WRITES ) {
631 rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
637 case LDAP_MOD_REPLACE:
642 if ( ro_gotval > 0 ) {
643 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
649 rp_add |= (~rp_cur) & SLAP_RESTRICT_OP_WRITES;
650 rp_cur |= SLAP_RESTRICT_OP_WRITES;
651 rp_delete &= ~SLAP_RESTRICT_OP_WRITES;
653 } else if ( val == 0 ) {
654 rp_delete |= rp_cur & SLAP_RESTRICT_OP_WRITES;
655 rp_cur &= ~SLAP_RESTRICT_OP_WRITES;
656 rp_add &= ~SLAP_RESTRICT_OP_WRITES;
661 rc = rs->sr_err = LDAP_OTHER;
665 } else if ( mod->sm_desc == mi->mi_ad_restrictedOperation ) {
666 slap_mask_t mask = 0;
668 switch ( mod->sm_op ) {
669 case LDAP_MOD_DELETE:
670 if ( mod->sm_values == NULL ) {
676 rc = value_mask( mod->sm_values, ~rp_cur, &mask );
677 if ( rc == LDAP_SUCCESS ) {
682 } else if ( rc == LDAP_OTHER ) {
683 rc = LDAP_NO_SUCH_ATTRIBUTE;
687 case LDAP_MOD_REPLACE:
694 rc = value_mask( mod->sm_values, rp_cur, &mask );
695 if ( rc == LDAP_SUCCESS ) {
700 } else if ( rc == LDAP_OTHER ) {
701 rc = rs->sr_err = LDAP_TYPE_OR_VALUE_EXISTS;
706 rc = rs->sr_err = LDAP_OTHER;
710 if ( rc != LDAP_SUCCESS ) {
714 } else if ( is_at_operational( mod->sm_desc->ad_type )) {
715 /* accept all operational attributes */
716 attr_delete( &e->e_attrs, mod->sm_desc );
717 rc = attr_merge( e, mod->sm_desc, mod->sm_values,
720 rc = rs->sr_err = LDAP_OTHER;
725 rc = rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
731 if ( ro_gotval < 1 ) {
732 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
736 if ( ( rp_cur & SLAP_RESTRICT_OP_EXTENDED ) && ( rp_cur & SLAP_RESTRICT_EXOP_MASK ) ) {
737 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
741 if ( rp_delete & rp_add ) {
742 rc = rs->sr_err = LDAP_OTHER;
746 /* check current value of readOnly */
747 if ( ( rp_cur & SLAP_RESTRICT_OP_WRITES ) == SLAP_RESTRICT_OP_WRITES ) {
748 tf = (struct berval *)&slap_true_bv;
751 tf = (struct berval *)&slap_false_bv;
754 a = attr_find( e->e_attrs, mi->mi_ad_readOnly );
760 if ( !bvmatch( &a->a_vals[ 0 ], tf ) ) {
761 attr_delete( &e->e_attrs, mi->mi_ad_readOnly );
762 rc = attr_merge_one( e, mi->mi_ad_readOnly, tf, tf );
765 if ( rc == LDAP_SUCCESS ) {
767 if ( rp_delete == be->be_restrictops ) {
768 attr_delete( &e->e_attrs, mi->mi_ad_restrictedOperation );
771 a = attr_find( e->e_attrs, mi->mi_ad_restrictedOperation );
773 rc = rs->sr_err = LDAP_OTHER;
777 for ( i = 0; !BER_BVISNULL( &restricted_ops[ i ].op ); i++ ) {
778 if ( rp_delete & restricted_ops[ i ].tag ) {
781 for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
784 if ( !bvmatch( &a->a_nvals[ j ], &restricted_ops[ i ].op ) ) {
788 ch_free( a->a_vals[ j ].bv_val );
789 ch_free( a->a_nvals[ j ].bv_val );
791 for ( k = j + 1; !BER_BVISNULL( &a->a_nvals[ k ] ); k++ ) {
792 a->a_vals[ k - 1 ] = a->a_vals[ k ];
793 a->a_nvals[ k - 1 ] = a->a_nvals[ k ];
796 BER_BVZERO( &a->a_vals[ k - 1 ] );
797 BER_BVZERO( &a->a_nvals[ k - 1 ] );
802 for ( i = 0; !BER_BVISNULL( &restricted_exops[ i ].op ); i++ ) {
803 if ( rp_delete & restricted_exops[ i ].tag ) {
806 for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
809 if ( !bvmatch( &a->a_nvals[ j ], &restricted_exops[ i ].op ) ) {
813 ch_free( a->a_vals[ j ].bv_val );
814 ch_free( a->a_nvals[ j ].bv_val );
816 for ( k = j + 1; !BER_BVISNULL( &a->a_nvals[ k ] ); k++ ) {
817 a->a_vals[ k - 1 ] = a->a_vals[ k ];
818 a->a_nvals[ k - 1 ] = a->a_nvals[ k ];
821 BER_BVZERO( &a->a_vals[ k - 1 ] );
822 BER_BVZERO( &a->a_nvals[ k - 1 ] );
830 for ( i = 0; !BER_BVISNULL( &restricted_ops[ i ].op ); i++ ) {
831 if ( rp_add & restricted_ops[ i ].tag ) {
832 attr_merge_one( e, mi->mi_ad_restrictedOperation,
833 &restricted_ops[ i ].op,
834 &restricted_ops[ i ].op );
838 for ( i = 0; !BER_BVISNULL( &restricted_exops[ i ].op ); i++ ) {
839 if ( rp_add & restricted_exops[ i ].tag ) {
840 attr_merge_one( e, mi->mi_ad_restrictedOperation,
841 &restricted_exops[ i ].op,
842 &restricted_exops[ i ].op );
848 be->be_restrictops = rp_cur;
851 if ( rc == LDAP_SUCCESS ) {
852 attrs_free( save_attrs );
853 rc = SLAP_CB_CONTINUE;
856 Attribute *tmp = e->e_attrs;
857 e->e_attrs = save_attrs;
863 #if defined(LDAP_SLAPI)
865 monitor_back_add_plugin( monitor_info_t *mi, Backend *be, Entry *e_database )
867 Slapi_PBlock *pCurrentPB;
868 int i, rc = LDAP_SUCCESS;
870 if ( slapi_int_pblock_get_first( be, &pCurrentPB ) != LDAP_SUCCESS ) {
872 * LDAP_OTHER is returned if no plugins are installed
880 Slapi_PluginDesc *srchdesc;
881 char buf[ BACKMONITOR_BUFSIZE ];
884 rc = slapi_pblock_get( pCurrentPB, SLAPI_PLUGIN_DESCRIPTION,
886 if ( rc != LDAP_SUCCESS ) {
890 snprintf( buf, sizeof(buf),
891 "plugin %d name: %s; "
897 srchdesc->spd_vendor,
898 srchdesc->spd_version,
899 srchdesc->spd_description );
901 ber_str2bv( buf, 0, 0, &bv );
902 attr_merge_normalize_one( e_database,
903 mi->mi_ad_monitoredInfo, &bv, NULL );
907 } while ( ( slapi_int_pblock_get_next( &pCurrentPB ) == LDAP_SUCCESS )
908 && ( pCurrentPB != NULL ) );
913 #endif /* defined(LDAP_SLAPI) */