1 /* database.c - deals with database subsystem */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2001-2006 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) */
48 #if defined(SLAPD_META)
49 #include "../back-meta/back-meta.h"
50 #endif /* defined(SLAPD_META) */
52 /* for PATH_MAX on some systems (e.g. Solaris) */
55 #endif /* HAVE_LIMITS_H */
58 #endif /* ! PATH_MAX */
61 monitor_subsys_database_modify(
66 static struct restricted_ops_t {
69 } restricted_ops[] = {
70 { BER_BVC( "add" ), SLAP_RESTRICT_OP_ADD },
71 { BER_BVC( "bind" ), SLAP_RESTRICT_OP_BIND },
72 { BER_BVC( "compare" ), SLAP_RESTRICT_OP_COMPARE },
73 { BER_BVC( "delete" ), SLAP_RESTRICT_OP_DELETE },
74 { BER_BVC( "extended" ), SLAP_RESTRICT_OP_EXTENDED },
75 { BER_BVC( "modify" ), SLAP_RESTRICT_OP_MODIFY },
76 { BER_BVC( "rename" ), SLAP_RESTRICT_OP_RENAME },
77 { BER_BVC( "search" ), SLAP_RESTRICT_OP_SEARCH },
79 }, restricted_exops[] = {
80 { BER_BVC( LDAP_EXOP_START_TLS ), SLAP_RESTRICT_EXOP_START_TLS },
81 { BER_BVC( LDAP_EXOP_MODIFY_PASSWD ), SLAP_RESTRICT_EXOP_MODIFY_PASSWD },
82 { BER_BVC( LDAP_EXOP_X_WHO_AM_I ), SLAP_RESTRICT_EXOP_WHOAMI },
83 { BER_BVC( LDAP_EXOP_X_CANCEL ), SLAP_RESTRICT_EXOP_CANCEL },
88 init_readOnly( monitor_info_t *mi, Entry *e, slap_mask_t restrictops )
90 struct berval *tf = ( ( restrictops & SLAP_RESTRICT_OP_MASK ) == SLAP_RESTRICT_OP_WRITES ) ?
91 (struct berval *)&slap_true_bv : (struct berval *)&slap_false_bv;
93 return attr_merge_one( e, mi->mi_ad_readOnly, tf, tf );
97 init_restrictedOperation( monitor_info_t *mi, Entry *e, slap_mask_t restrictops )
101 for ( i = 0; restricted_ops[ i ].op.bv_val; i++ ) {
102 if ( restrictops & restricted_ops[ i ].tag ) {
103 rc = attr_merge_one( e, mi->mi_ad_restrictedOperation,
104 &restricted_ops[ i ].op,
105 &restricted_ops[ i ].op );
112 for ( i = 0; restricted_exops[ i ].op.bv_val; i++ ) {
113 if ( restrictops & restricted_exops[ i ].tag ) {
114 rc = attr_merge_one( e, mi->mi_ad_restrictedOperation,
115 &restricted_exops[ i ].op,
116 &restricted_exops[ i ].op );
127 monitor_subsys_database_init(
133 Entry *e_database, **ep;
136 monitor_subsys_t *ms_backend,
139 assert( be != NULL );
141 ms->mss_modify = monitor_subsys_database_modify;
143 mi = ( monitor_info_t * )be->be_private;
145 ms_backend = monitor_back_get_subsys( SLAPD_MONITOR_BACKEND_NAME );
146 if ( ms_backend == NULL ) {
147 Debug( LDAP_DEBUG_ANY,
148 "monitor_subsys_database_init: "
150 "\"" SLAPD_MONITOR_BACKEND_NAME "\" "
156 ms_overlay = monitor_back_get_subsys( SLAPD_MONITOR_OVERLAY_NAME );
157 if ( ms_overlay == NULL ) {
158 Debug( LDAP_DEBUG_ANY,
159 "monitor_subsys_database_init: "
161 "\"" SLAPD_MONITOR_OVERLAY_NAME "\" "
167 if ( monitor_cache_get( mi, &ms->mss_ndn, &e_database ) ) {
168 Debug( LDAP_DEBUG_ANY,
169 "monitor_subsys_database_init: "
170 "unable to get entry \"%s\"\n",
171 ms->mss_ndn.bv_val, 0, 0 );
175 (void)init_readOnly( mi, e_database, frontendDB->be_restrictops );
176 (void)init_restrictedOperation( mi, e_database, frontendDB->be_restrictops );
178 mp = ( monitor_entry_t * )e_database->e_private;
179 mp->mp_children = NULL;
180 ep = &mp->mp_children;
183 LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
184 char buf[ BACKMONITOR_BUFSIZE ];
186 slap_overinfo *oi = NULL;
187 BackendInfo *bi, *bi2;
195 if ( overlay_is_over( be ) ) {
196 oi = (slap_overinfo *)be->bd_info->bi_private;
200 /* Subordinates are not exposed as their own naming context */
201 if ( SLAP_GLUE_SUBORDINATE( be ) ) {
205 bv.bv_len = snprintf( buf, sizeof( buf ),
206 "cn=Database %d", i );
208 e = monitor_entry_stub( &ms->mss_dn, &ms->mss_ndn, &bv,
209 mi->mi_oc_monitoredObject, mi, NULL, NULL );
212 Debug( LDAP_DEBUG_ANY,
213 "monitor_subsys_database_init: "
214 "unable to create entry \"cn=Database %d,%s\"\n",
215 i, ms->mss_dn.bv_val, 0 );
219 ber_str2bv( bi->bi_type, 0, 0, &bv );
220 attr_merge_one( e, mi->mi_ad_monitoredInfo, &bv, NULL );
221 attr_merge_one( e, mi->mi_ad_monitorIsShadow,
222 SLAP_SHADOW( be ) ? (struct berval *)&slap_true_bv :
223 (struct berval *)&slap_false_bv, NULL );
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 );
248 if ( SLAP_SHADOW( be ) && be->be_update_refs ) {
249 attr_merge_normalize( e, mi->mi_ad_monitorUpdateRef,
250 be->be_update_refs, NULL );
254 slap_overinst *on = oi->oi_list,
257 for ( ; on; on = on->on_next ) {
261 for ( on2 = on1; on2 != on; on2 = on2->on_next ) {
262 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
271 ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
272 attr_merge_normalize_one( e, mi->mi_ad_monitorOverlay,
275 /* find the overlay number, j */
276 for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
277 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
281 assert( on2 != NULL );
283 snprintf( buf, sizeof( buf ),
285 j, ms_overlay->mss_dn.bv_val );
286 ber_str2bv( buf, 0, 0, &bv );
287 attr_merge_normalize_one( e,
288 slap_schema.si_ad_seeAlso,
297 #if defined(SLAPD_BDB) || defined(SLAPD_HDB)
298 } else if ( strcmp( bi->bi_type, "bdb" ) == 0
299 || strcmp( bi->bi_type, "hdb" ) == 0 )
302 ber_len_t pathlen = 0, len = 0;
303 char path[ PATH_MAX ] = { '\0' };
304 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
305 char *fname = bdb->bi_dbenv_home;
307 len = strlen( fname );
308 if ( fname[ 0 ] != '/' ) {
309 /* get full path name */
310 getcwd( path, sizeof( path ) );
311 pathlen = strlen( path );
313 if ( fname[ 0 ] == '.' && fname[ 1 ] == '/' ) {
319 bv.bv_len = STRLENOF( "file://" ) + pathlen
320 + STRLENOF( "/" ) + len;
321 bv.bv_val = ch_malloc( bv.bv_len + STRLENOF( "/" ) + 1 );
322 AC_MEMCPY( bv.bv_val, "file://", STRLENOF( "file://" ) );
324 AC_MEMCPY( &bv.bv_val[ STRLENOF( "file://" ) ],
326 bv.bv_val[ STRLENOF( "file://" ) + pathlen ] = '/';
329 AC_MEMCPY( &bv.bv_val[ STRLENOF( "file://" ) + pathlen ],
331 if ( bv.bv_val[ bv.bv_len - 1 ] != '/' ) {
332 bv.bv_val[ bv.bv_len ] = '/';
335 bv.bv_val[ bv.bv_len ] = '\0';
337 attr_merge_normalize_one( e, slap_schema.si_ad_labeledURI,
340 ch_free( bv.bv_val );
342 #endif /* defined(SLAPD_BDB) || defined(SLAPD_HDB) */
343 #if defined(SLAPD_LDAP)
344 } else if ( strcmp( bi->bi_type, "ldap" ) == 0 ) {
345 ldapinfo_t *li = (ldapinfo_t *)be->be_private;
347 attr_merge_normalize( e, slap_schema.si_ad_labeledURI,
348 li->li_bvuri, NULL );
350 char **urls = ldap_str2charray( li->li_uri, " " );
352 if ( urls != NULL ) {
355 for ( u = 0; urls[ u ] != NULL; u++ ) {
358 ber_str2bv( urls[ u ], 0, 0, &bv );
360 attr_merge_normalize_one( e,
361 slap_schema.si_ad_labeledURI,
365 ldap_charray_free( urls );
369 #endif /* defined(SLAPD_LDAP) */
370 #if defined(SLAPD_META)
371 } else if ( strcmp( bi->bi_type, "meta" ) == 0 ) {
372 metainfo_t *mi = (metainfo_t *)be->be_private;
375 for ( t = 0; t < mi->mi_ntargets; t++ ) {
376 char **urls = ldap_str2charray( mi->mi_targets[ t ].mt_uri, " " );
378 if ( urls != NULL ) {
381 for ( u = 0; urls[ u ] != NULL; u++ ) {
384 ber_str2bv( urls[ u ], 0, 0, &bv );
386 attr_merge_normalize_one( e,
387 slap_schema.si_ad_labeledURI,
390 ldap_charray_free( urls );
393 #endif /* defined(SLAPD_META) */
397 LDAP_STAILQ_FOREACH( bi2, &backendInfo, bi_next ) {
399 if ( bi2->bi_type == bi->bi_type ) {
402 snprintf( buf, sizeof( buf ),
404 j, ms_backend->mss_dn.bv_val );
406 bv.bv_len = strlen( buf );
407 attr_merge_normalize_one( e,
408 slap_schema.si_ad_seeAlso,
413 /* we must find it! */
416 mp = monitor_entrypriv_create();
420 e->e_private = ( void * )mp;
422 mp->mp_flags = ms->mss_flags
425 if ( monitor_cache_add( mi, e ) ) {
426 Debug( LDAP_DEBUG_ANY,
427 "monitor_subsys_database_init: "
428 "unable to add entry \"cn=Database %d,%s\"\n",
429 i, ms->mss_dn.bv_val, 0 );
433 #if defined(LDAP_SLAPI)
434 monitor_back_add_plugin( mi, be, e );
435 #endif /* defined(LDAP_SLAPI) */
438 Entry **ep_overlay = &mp->mp_children;
439 monitor_entry_t *mp_overlay;
440 slap_overinst *on = oi->oi_list;
443 for ( o = 0; on; o++, on = on->on_next ) {
447 /* find the overlay number, j */
448 for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
449 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
453 assert( on2 != NULL );
455 bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Overlay %d", o );
458 e_overlay = monitor_entry_stub( &e->e_name, &e->e_nname, &bv,
459 mi->mi_oc_monitoredObject, mi, NULL, NULL );
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 );
469 ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
470 attr_merge_one( e, mi->mi_ad_monitoredInfo, &bv, NULL );
472 bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Overlay %d,%s",
473 j, ms_overlay->mss_dn.bv_val );
475 attr_merge_normalize_one( e, slap_schema.si_ad_seeAlso,
478 mp_overlay = monitor_entrypriv_create();
479 if ( mp_overlay == NULL ) {
482 e_overlay->e_private = ( void * )mp_overlay;
483 mp_overlay->mp_info = ms;
484 mp_overlay->mp_flags = ms->mss_flags
487 if ( monitor_cache_add( mi, e_overlay ) ) {
488 Debug( LDAP_DEBUG_ANY,
489 "monitor_subsys_database_init: "
490 "unable to add entry "
491 "\"cn=Overlay %d,cn=Database %d,%s\"\n",
492 o, i, ms->mss_dn.bv_val );
496 *ep_overlay = e_overlay;
497 ep_overlay = &mp_overlay->mp_next;
505 monitor_cache_release( mi, e_database );
512 * cur: must not contain the tags corresponding to the values in v
513 * delta: will contain the tags corresponding to the values in v
516 value_mask( BerVarray v, slap_mask_t cur, slap_mask_t *delta )
518 for ( ; !BER_BVISNULL( v ); v++ ) {
519 struct restricted_ops_t *rops;
522 if ( OID_LEADCHAR( v->bv_val[ 0 ] ) ) {
523 rops = restricted_exops;
526 rops = restricted_ops;
529 for ( i = 0; !BER_BVISNULL( &rops[ i ].op ); i++ ) {
530 if ( ber_bvstrcasecmp( v, &rops[ i ].op ) != 0 ) {
534 if ( rops[ i ].tag & *delta ) {
538 if ( rops[ i ].tag & cur ) {
542 cur |= rops[ i ].tag;
543 *delta |= rops[ i ].tag;
548 if ( BER_BVISNULL( &rops[ i ].op ) ) {
549 return LDAP_INVALID_SYNTAX;
557 monitor_subsys_database_modify(
562 monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
564 Attribute *save_attrs, *a;
567 int ro_gotval = 1, i, n;
568 slap_mask_t rp_add = 0, rp_delete = 0, rp_cur;
571 i = sscanf( e->e_nname.bv_val, "cn=database %d,", &n );
573 return SLAP_CB_CONTINUE;
576 if ( n < 0 || n >= nBackendDB ) {
577 rs->sr_text = "invalid database index";
578 return ( rs->sr_err = LDAP_NO_SUCH_OBJECT );
581 LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
587 /* do not allow some changes on back-monitor (needs work)... */
588 if ( SLAP_MONITOR( be ) ) {
589 rs->sr_text = "no modifications allowed to monitor database entry";
590 return ( rs->sr_err = LDAP_UNWILLING_TO_PERFORM );
593 rp_cur = be->be_restrictops;
595 save_attrs = e->e_attrs;
596 e->e_attrs = attrs_dup( e->e_attrs );
598 for ( ml = op->orm_modlist; ml; ml = ml->sml_next ) {
599 Modification *mod = &ml->sml_mod;
601 if ( mod->sm_desc == mi->mi_ad_readOnly ) {
604 if ( mod->sm_values ) {
605 if ( !BER_BVISNULL( &mod->sm_values[ 1 ] ) ) {
606 rs->sr_text = "attempting to modify multiple values of single-valued attribute";
607 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
611 if ( bvmatch( &slap_true_bv, mod->sm_values )) {
614 } else if ( bvmatch( &slap_false_bv, mod->sm_values )) {
619 rc = rs->sr_err = LDAP_INVALID_SYNTAX;
624 switch ( mod->sm_op ) {
625 case LDAP_MOD_DELETE:
626 if ( ro_gotval < 1 ) {
627 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
632 if ( val == 0 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) == SLAP_RESTRICT_OP_WRITES ) {
633 rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
637 if ( val == 1 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) != SLAP_RESTRICT_OP_WRITES ) {
638 rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
644 case LDAP_MOD_REPLACE:
649 if ( ro_gotval > 0 ) {
650 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
656 rp_add |= (~rp_cur) & SLAP_RESTRICT_OP_WRITES;
657 rp_cur |= SLAP_RESTRICT_OP_WRITES;
658 rp_delete &= ~SLAP_RESTRICT_OP_WRITES;
660 } else if ( val == 0 ) {
661 rp_delete |= rp_cur & SLAP_RESTRICT_OP_WRITES;
662 rp_cur &= ~SLAP_RESTRICT_OP_WRITES;
663 rp_add &= ~SLAP_RESTRICT_OP_WRITES;
668 rc = rs->sr_err = LDAP_OTHER;
672 } else if ( mod->sm_desc == mi->mi_ad_restrictedOperation ) {
673 slap_mask_t mask = 0;
675 switch ( mod->sm_op ) {
676 case LDAP_MOD_DELETE:
677 if ( mod->sm_values == NULL ) {
683 rc = value_mask( mod->sm_values, ~rp_cur, &mask );
684 if ( rc == LDAP_SUCCESS ) {
689 } else if ( rc == LDAP_OTHER ) {
690 rc = LDAP_NO_SUCH_ATTRIBUTE;
694 case LDAP_MOD_REPLACE:
701 rc = value_mask( mod->sm_values, rp_cur, &mask );
702 if ( rc == LDAP_SUCCESS ) {
707 } else if ( rc == LDAP_OTHER ) {
708 rc = rs->sr_err = LDAP_TYPE_OR_VALUE_EXISTS;
713 rc = rs->sr_err = LDAP_OTHER;
717 if ( rc != LDAP_SUCCESS ) {
721 } else if ( is_at_operational( mod->sm_desc->ad_type )) {
722 /* accept all operational attributes */
723 attr_delete( &e->e_attrs, mod->sm_desc );
724 rc = attr_merge( e, mod->sm_desc, mod->sm_values,
727 rc = rs->sr_err = LDAP_OTHER;
732 rc = rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
738 if ( ro_gotval < 1 ) {
739 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
743 if ( ( rp_cur & SLAP_RESTRICT_OP_EXTENDED ) && ( rp_cur & SLAP_RESTRICT_EXOP_MASK ) ) {
744 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
748 if ( rp_delete & rp_add ) {
749 rc = rs->sr_err = LDAP_OTHER;
753 /* check current value of readOnly */
754 if ( ( rp_cur & SLAP_RESTRICT_OP_WRITES ) == SLAP_RESTRICT_OP_WRITES ) {
755 tf = (struct berval *)&slap_true_bv;
758 tf = (struct berval *)&slap_false_bv;
761 a = attr_find( e->e_attrs, mi->mi_ad_readOnly );
767 if ( !bvmatch( &a->a_vals[ 0 ], tf ) ) {
768 attr_delete( &e->e_attrs, mi->mi_ad_readOnly );
769 rc = attr_merge_one( e, mi->mi_ad_readOnly, tf, tf );
772 if ( rc == LDAP_SUCCESS ) {
774 if ( rp_delete == be->be_restrictops ) {
775 attr_delete( &e->e_attrs, mi->mi_ad_restrictedOperation );
778 a = attr_find( e->e_attrs, mi->mi_ad_restrictedOperation );
780 rc = rs->sr_err = LDAP_OTHER;
784 for ( i = 0; !BER_BVISNULL( &restricted_ops[ i ].op ); i++ ) {
785 if ( rp_delete & restricted_ops[ i ].tag ) {
788 for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
791 if ( !bvmatch( &a->a_nvals[ j ], &restricted_ops[ i ].op ) ) {
795 ch_free( a->a_vals[ j ].bv_val );
796 ch_free( a->a_nvals[ j ].bv_val );
798 for ( k = j + 1; !BER_BVISNULL( &a->a_nvals[ k ] ); k++ ) {
799 a->a_vals[ k - 1 ] = a->a_vals[ k ];
800 a->a_nvals[ k - 1 ] = a->a_nvals[ k ];
803 BER_BVZERO( &a->a_vals[ k - 1 ] );
804 BER_BVZERO( &a->a_nvals[ k - 1 ] );
809 for ( i = 0; !BER_BVISNULL( &restricted_exops[ i ].op ); i++ ) {
810 if ( rp_delete & restricted_exops[ i ].tag ) {
813 for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
816 if ( !bvmatch( &a->a_nvals[ j ], &restricted_exops[ i ].op ) ) {
820 ch_free( a->a_vals[ j ].bv_val );
821 ch_free( a->a_nvals[ j ].bv_val );
823 for ( k = j + 1; !BER_BVISNULL( &a->a_nvals[ k ] ); k++ ) {
824 a->a_vals[ k - 1 ] = a->a_vals[ k ];
825 a->a_nvals[ k - 1 ] = a->a_nvals[ k ];
828 BER_BVZERO( &a->a_vals[ k - 1 ] );
829 BER_BVZERO( &a->a_nvals[ k - 1 ] );
837 for ( i = 0; !BER_BVISNULL( &restricted_ops[ i ].op ); i++ ) {
838 if ( rp_add & restricted_ops[ i ].tag ) {
839 attr_merge_one( e, mi->mi_ad_restrictedOperation,
840 &restricted_ops[ i ].op,
841 &restricted_ops[ i ].op );
845 for ( i = 0; !BER_BVISNULL( &restricted_exops[ i ].op ); i++ ) {
846 if ( rp_add & restricted_exops[ i ].tag ) {
847 attr_merge_one( e, mi->mi_ad_restrictedOperation,
848 &restricted_exops[ i ].op,
849 &restricted_exops[ i ].op );
855 be->be_restrictops = rp_cur;
858 if ( rc == LDAP_SUCCESS ) {
859 attrs_free( save_attrs );
860 rc = SLAP_CB_CONTINUE;
863 Attribute *tmp = e->e_attrs;
864 e->e_attrs = save_attrs;
870 #if defined(LDAP_SLAPI)
872 monitor_back_add_plugin( monitor_info_t *mi, Backend *be, Entry *e_database )
874 Slapi_PBlock *pCurrentPB;
875 int i, rc = LDAP_SUCCESS;
877 if ( slapi_int_pblock_get_first( be, &pCurrentPB ) != LDAP_SUCCESS ) {
879 * LDAP_OTHER is returned if no plugins are installed
887 Slapi_PluginDesc *srchdesc;
888 char buf[ BACKMONITOR_BUFSIZE ];
891 rc = slapi_pblock_get( pCurrentPB, SLAPI_PLUGIN_DESCRIPTION,
893 if ( rc != LDAP_SUCCESS ) {
897 snprintf( buf, sizeof(buf),
898 "plugin %d name: %s; "
904 srchdesc->spd_vendor,
905 srchdesc->spd_version,
906 srchdesc->spd_description );
908 ber_str2bv( buf, 0, 0, &bv );
909 attr_merge_normalize_one( e_database,
910 mi->mi_ad_monitoredInfo, &bv, NULL );
914 } while ( ( slapi_int_pblock_get_next( &pCurrentPB ) == LDAP_SUCCESS )
915 && ( pCurrentPB != NULL ) );
920 #endif /* defined(LDAP_SLAPI) */