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;
194 if ( overlay_is_over( be ) ) {
195 oi = (slap_overinfo *)be->bd_info->bi_private;
199 /* Subordinates are not exposed as their own naming context */
200 if ( SLAP_GLUE_SUBORDINATE( be ) ) {
204 snprintf( buf, sizeof( buf ),
205 "dn: cn=Database %d,%s\n"
207 "structuralObjectClass: %s\n"
212 "modifiersName: %s\n"
213 "createTimestamp: %s\n"
214 "modifyTimestamp: %s\n",
217 mi->mi_oc_monitoredObject->soc_cname.bv_val,
218 mi->mi_oc_monitoredObject->soc_cname.bv_val,
220 mi->mi_ad_monitoredInfo->ad_cname.bv_val,
222 mi->mi_ad_monitorIsShadow->ad_cname.bv_val,
223 SLAP_SHADOW( be ) ? slap_true_bv.bv_val : slap_false_bv.bv_val,
224 mi->mi_creatorsName.bv_val,
225 mi->mi_creatorsName.bv_val,
226 mi->mi_startTime.bv_val,
227 mi->mi_startTime.bv_val );
229 e = str2entry( buf );
231 Debug( LDAP_DEBUG_ANY,
232 "monitor_subsys_database_init: "
233 "unable to create entry \"cn=Database %d,%s\"\n",
234 i, ms->mss_dn.bv_val, 0 );
238 if ( SLAP_MONITOR( be ) ) {
239 attr_merge( e, slap_schema.si_ad_monitorContext,
240 be->be_suffix, be->be_nsuffix );
241 attr_merge( e_database, slap_schema.si_ad_monitorContext,
242 be->be_suffix, be->be_nsuffix );
245 if ( be->be_suffix == NULL ) {
246 Debug( LDAP_DEBUG_ANY,
247 "monitor_subsys_database_init: "
248 "missing suffix for database %d\n",
252 attr_merge( e, slap_schema.si_ad_namingContexts,
253 be->be_suffix, be->be_nsuffix );
254 attr_merge( e_database, slap_schema.si_ad_namingContexts,
255 be->be_suffix, be->be_nsuffix );
258 (void)init_readOnly( mi, e, be->be_restrictops );
259 (void)init_restrictedOperation( mi, e, be->be_restrictops );
261 if ( SLAP_SHADOW( be ) && be->be_update_refs ) {
262 attr_merge_normalize( e, mi->mi_ad_monitorUpdateRef,
263 be->be_update_refs, NULL );
267 slap_overinst *on = oi->oi_list,
270 for ( ; on; on = on->on_next ) {
274 for ( on2 = on1; on2 != on; on2 = on2->on_next ) {
275 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
284 ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
285 attr_merge_normalize_one( e, mi->mi_ad_monitorOverlay,
288 /* find the overlay number, j */
289 for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
290 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
294 assert( on2 != NULL );
296 snprintf( buf, sizeof( buf ),
298 j, ms_overlay->mss_dn.bv_val );
299 ber_str2bv( buf, 0, 0, &bv );
300 attr_merge_normalize_one( e,
301 slap_schema.si_ad_seeAlso,
310 #if defined(SLAPD_BDB) || defined(SLAPD_HDB)
311 } else if ( strcmp( bi->bi_type, "bdb" ) == 0
312 || strcmp( bi->bi_type, "hdb" ) == 0 )
315 ber_len_t pathlen = 0, len = 0;
316 char path[ PATH_MAX ] = { '\0' };
317 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
318 char *fname = bdb->bi_dbenv_home;
320 len = strlen( fname );
321 if ( fname[ 0 ] != '/' ) {
322 /* get full path name */
323 getcwd( path, sizeof( path ) );
324 pathlen = strlen( path );
326 if ( fname[ 0 ] == '.' && fname[ 1 ] == '/' ) {
332 bv.bv_len = STRLENOF( "file://" ) + pathlen
333 + STRLENOF( "/" ) + len;
334 bv.bv_val = ch_malloc( bv.bv_len + STRLENOF( "/" ) + 1 );
335 AC_MEMCPY( bv.bv_val, "file://", STRLENOF( "file://" ) );
337 AC_MEMCPY( &bv.bv_val[ STRLENOF( "file://" ) ],
339 bv.bv_val[ STRLENOF( "file://" ) + pathlen ] = '/';
342 AC_MEMCPY( &bv.bv_val[ STRLENOF( "file://" ) + pathlen ],
344 if ( bv.bv_val[ bv.bv_len - 1 ] != '/' ) {
345 bv.bv_val[ bv.bv_len ] = '/';
348 bv.bv_val[ bv.bv_len ] = '\0';
350 attr_merge_normalize_one( e, slap_schema.si_ad_labeledURI,
353 ch_free( bv.bv_val );
355 #endif /* defined(SLAPD_BDB) || defined(SLAPD_HDB) */
356 #if defined(SLAPD_LDAP)
357 } else if ( strcmp( bi->bi_type, "ldap" ) == 0 ) {
358 ldapinfo_t *li = (ldapinfo_t *)be->be_private;
360 attr_merge_normalize( e, slap_schema.si_ad_labeledURI,
361 li->li_bvuri, NULL );
363 char **urls = ldap_str2charray( li->li_uri, " " );
366 for ( u = 0; urls[ u ] != NULL; u++ ) {
369 ber_str2bv( urls[ u ], 0, 0, &bv );
371 attr_merge_normalize_one( e,
372 slap_schema.si_ad_labeledURI,
376 ldap_charray_free( urls );
379 #endif /* defined(SLAPD_LDAP) */
380 #if defined(SLAPD_META)
381 } else if ( strcmp( bi->bi_type, "meta" ) == 0 ) {
382 metainfo_t *mi = (metainfo_t *)be->be_private;
385 for ( t = 0; t < mi->mi_ntargets; t++ ) {
386 char **urls = ldap_str2charray( mi->mi_targets[ t ].mt_uri, " " );
389 for ( u = 0; urls[ u ] != NULL; u++ ) {
392 ber_str2bv( urls[ u ], 0, 0, &bv );
394 attr_merge_normalize_one( e,
395 slap_schema.si_ad_labeledURI,
398 ldap_charray_free( urls );
400 #endif /* defined(SLAPD_META) */
404 LDAP_STAILQ_FOREACH( bi2, &backendInfo, bi_next ) {
406 if ( bi2->bi_type == bi->bi_type ) {
409 snprintf( buf, sizeof( buf ),
411 j, ms_backend->mss_dn.bv_val );
413 bv.bv_len = strlen( buf );
414 attr_merge_normalize_one( e,
415 slap_schema.si_ad_seeAlso,
420 /* we must find it! */
423 mp = monitor_entrypriv_create();
427 e->e_private = ( void * )mp;
429 mp->mp_flags = ms->mss_flags
432 if ( monitor_cache_add( mi, e ) ) {
433 Debug( LDAP_DEBUG_ANY,
434 "monitor_subsys_database_init: "
435 "unable to add entry \"cn=Database %d,%s\"\n",
436 i, ms->mss_dn.bv_val, 0 );
440 #if defined(LDAP_SLAPI)
441 monitor_back_add_plugin( mi, be, e );
442 #endif /* defined(LDAP_SLAPI) */
445 Entry **ep_overlay = &mp->mp_children;
446 monitor_entry_t *mp_overlay;
447 slap_overinst *on = oi->oi_list;
450 for ( o = 0; on; o++, on = on->on_next ) {
454 /* find the overlay number, j */
455 for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
456 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
460 assert( on2 != NULL );
462 snprintf( buf, sizeof( buf ),
463 "dn: cn=Overlay %d,cn=Database %d,%s\n"
465 "structuralObjectClass: %s\n"
468 "seeAlso: cn=Overlay %d,%s\n"
470 "modifiersName: %s\n"
471 "createTimestamp: %s\n"
472 "modifyTimestamp: %s\n",
476 mi->mi_oc_monitoredObject->soc_cname.bv_val,
477 mi->mi_oc_monitoredObject->soc_cname.bv_val,
479 mi->mi_ad_monitoredInfo->ad_cname.bv_val,
482 ms_overlay->mss_dn.bv_val,
483 mi->mi_creatorsName.bv_val,
484 mi->mi_creatorsName.bv_val,
485 mi->mi_startTime.bv_val,
486 mi->mi_startTime.bv_val );
488 e_overlay = str2entry( buf );
489 if ( e_overlay == NULL ) {
490 Debug( LDAP_DEBUG_ANY,
491 "monitor_subsys_database_init: "
492 "unable to create entry "
493 "\"cn=Overlay %d,cn=Database %d,%s\"\n",
494 o, i, ms->mss_dn.bv_val );
498 mp_overlay = monitor_entrypriv_create();
499 if ( mp_overlay == NULL ) {
502 e_overlay->e_private = ( void * )mp_overlay;
503 mp_overlay->mp_info = ms;
504 mp_overlay->mp_flags = ms->mss_flags
507 if ( monitor_cache_add( mi, e_overlay ) ) {
508 Debug( LDAP_DEBUG_ANY,
509 "monitor_subsys_database_init: "
510 "unable to add entry "
511 "\"cn=Overlay %d,cn=Database %d,%s\"\n",
512 o, i, ms->mss_dn.bv_val );
516 *ep_overlay = e_overlay;
517 ep_overlay = &mp_overlay->mp_next;
525 monitor_cache_release( mi, e_database );
532 * cur: must not contain the tags corresponding to the values in v
533 * delta: will contain the tags corresponding to the values in v
536 value_mask( BerVarray v, slap_mask_t cur, slap_mask_t *delta )
538 for ( ; !BER_BVISNULL( v ); v++ ) {
539 struct restricted_ops_t *rops;
542 if ( OID_LEADCHAR( v->bv_val[ 0 ] ) ) {
543 rops = restricted_exops;
546 rops = restricted_ops;
549 for ( i = 0; !BER_BVISNULL( &rops[ i ].op ); i++ ) {
550 if ( ber_bvstrcasecmp( v, &rops[ i ].op ) != 0 ) {
554 if ( rops[ i ].tag & *delta ) {
558 if ( rops[ i ].tag & cur ) {
562 cur |= rops[ i ].tag;
563 *delta |= rops[ i ].tag;
568 if ( BER_BVISNULL( &rops[ i ].op ) ) {
569 return LDAP_INVALID_SYNTAX;
577 monitor_subsys_database_modify(
582 monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
584 Attribute *save_attrs, *a;
587 int ro_gotval = 1, i, n;
588 slap_mask_t rp_add = 0, rp_delete = 0, rp_cur;
591 i = sscanf( e->e_nname.bv_val, "cn=database %d,", &n );
593 return SLAP_CB_CONTINUE;
596 if ( n < 0 || n >= nBackendDB ) {
597 rs->sr_text = "invalid database index";
598 return ( rs->sr_err = LDAP_NO_SUCH_OBJECT );
601 LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
607 /* do not allow some changes on back-monitor (needs work)... */
608 if ( SLAP_MONITOR( be ) ) {
609 rs->sr_text = "no modifications allowed to monitor database entry";
610 return ( rs->sr_err = LDAP_UNWILLING_TO_PERFORM );
613 rp_cur = be->be_restrictops;
615 save_attrs = e->e_attrs;
616 e->e_attrs = attrs_dup( e->e_attrs );
618 for ( ml = op->orm_modlist; ml; ml = ml->sml_next ) {
619 Modification *mod = &ml->sml_mod;
621 if ( mod->sm_desc == mi->mi_ad_readOnly ) {
624 if ( mod->sm_values ) {
625 if ( !BER_BVISNULL( &mod->sm_values[ 1 ] ) ) {
626 rs->sr_text = "attempting to modify multiple values of single-valued attribute";
627 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
631 if ( bvmatch( &slap_true_bv, mod->sm_values )) {
634 } else if ( bvmatch( &slap_false_bv, mod->sm_values )) {
639 rc = rs->sr_err = LDAP_INVALID_SYNTAX;
644 switch ( mod->sm_op ) {
645 case LDAP_MOD_DELETE:
646 if ( ro_gotval < 1 ) {
647 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
652 if ( val == 0 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) == SLAP_RESTRICT_OP_WRITES ) {
653 rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
657 if ( val == 1 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) != SLAP_RESTRICT_OP_WRITES ) {
658 rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
664 case LDAP_MOD_REPLACE:
669 if ( ro_gotval > 0 ) {
670 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
676 rp_add |= (~rp_cur) & SLAP_RESTRICT_OP_WRITES;
677 rp_cur |= SLAP_RESTRICT_OP_WRITES;
678 rp_delete &= ~SLAP_RESTRICT_OP_WRITES;
680 } else if ( val == 0 ) {
681 rp_delete |= rp_cur & SLAP_RESTRICT_OP_WRITES;
682 rp_cur &= ~SLAP_RESTRICT_OP_WRITES;
683 rp_add &= ~SLAP_RESTRICT_OP_WRITES;
688 rc = rs->sr_err = LDAP_OTHER;
692 } else if ( mod->sm_desc == mi->mi_ad_restrictedOperation ) {
693 slap_mask_t mask = 0;
695 switch ( mod->sm_op ) {
696 case LDAP_MOD_DELETE:
697 if ( mod->sm_values == NULL ) {
703 rc = value_mask( mod->sm_values, ~rp_cur, &mask );
704 if ( rc == LDAP_SUCCESS ) {
709 } else if ( rc == LDAP_OTHER ) {
710 rc = LDAP_NO_SUCH_ATTRIBUTE;
714 case LDAP_MOD_REPLACE:
721 rc = value_mask( mod->sm_values, rp_cur, &mask );
722 if ( rc == LDAP_SUCCESS ) {
727 } else if ( rc == LDAP_OTHER ) {
728 rc = rs->sr_err = LDAP_TYPE_OR_VALUE_EXISTS;
733 rc = rs->sr_err = LDAP_OTHER;
737 if ( rc != LDAP_SUCCESS ) {
741 } else if ( is_at_operational( mod->sm_desc->ad_type )) {
742 /* accept all operational attributes */
743 attr_delete( &e->e_attrs, mod->sm_desc );
744 rc = attr_merge( e, mod->sm_desc, mod->sm_values,
747 rc = rs->sr_err = LDAP_OTHER;
752 rc = rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
758 if ( ro_gotval < 1 ) {
759 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
763 if ( ( rp_cur & SLAP_RESTRICT_OP_EXTENDED ) && ( rp_cur & SLAP_RESTRICT_EXOP_MASK ) ) {
764 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
768 if ( rp_delete & rp_add ) {
769 rc = rs->sr_err = LDAP_OTHER;
773 /* check current value of readOnly */
774 if ( ( rp_cur & SLAP_RESTRICT_OP_WRITES ) == SLAP_RESTRICT_OP_WRITES ) {
775 tf = (struct berval *)&slap_true_bv;
778 tf = (struct berval *)&slap_false_bv;
781 a = attr_find( e->e_attrs, mi->mi_ad_readOnly );
787 if ( !bvmatch( &a->a_vals[ 0 ], tf ) ) {
788 attr_delete( &e->e_attrs, mi->mi_ad_readOnly );
789 rc = attr_merge_one( e, mi->mi_ad_readOnly, tf, tf );
792 if ( rc == LDAP_SUCCESS ) {
794 if ( rp_delete == be->be_restrictops ) {
795 attr_delete( &e->e_attrs, mi->mi_ad_restrictedOperation );
798 a = attr_find( e->e_attrs, mi->mi_ad_restrictedOperation );
800 rc = rs->sr_err = LDAP_OTHER;
804 for ( i = 0; !BER_BVISNULL( &restricted_ops[ i ].op ); i++ ) {
805 if ( rp_delete & restricted_ops[ i ].tag ) {
808 for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
811 if ( !bvmatch( &a->a_nvals[ j ], &restricted_ops[ i ].op ) ) {
815 ch_free( a->a_vals[ j ].bv_val );
816 ch_free( a->a_nvals[ j ].bv_val );
818 for ( k = j + 1; !BER_BVISNULL( &a->a_nvals[ k ] ); k++ ) {
819 a->a_vals[ k - 1 ] = a->a_vals[ k ];
820 a->a_nvals[ k - 1 ] = a->a_nvals[ k ];
823 BER_BVZERO( &a->a_vals[ k - 1 ] );
824 BER_BVZERO( &a->a_nvals[ k - 1 ] );
829 for ( i = 0; !BER_BVISNULL( &restricted_exops[ i ].op ); i++ ) {
830 if ( rp_delete & restricted_exops[ i ].tag ) {
833 for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
836 if ( !bvmatch( &a->a_nvals[ j ], &restricted_exops[ i ].op ) ) {
840 ch_free( a->a_vals[ j ].bv_val );
841 ch_free( a->a_nvals[ j ].bv_val );
843 for ( k = j + 1; !BER_BVISNULL( &a->a_nvals[ k ] ); k++ ) {
844 a->a_vals[ k - 1 ] = a->a_vals[ k ];
845 a->a_nvals[ k - 1 ] = a->a_nvals[ k ];
848 BER_BVZERO( &a->a_vals[ k - 1 ] );
849 BER_BVZERO( &a->a_nvals[ k - 1 ] );
857 for ( i = 0; !BER_BVISNULL( &restricted_ops[ i ].op ); i++ ) {
858 if ( rp_add & restricted_ops[ i ].tag ) {
859 attr_merge_one( e, mi->mi_ad_restrictedOperation,
860 &restricted_ops[ i ].op,
861 &restricted_ops[ i ].op );
865 for ( i = 0; !BER_BVISNULL( &restricted_exops[ i ].op ); i++ ) {
866 if ( rp_add & restricted_exops[ i ].tag ) {
867 attr_merge_one( e, mi->mi_ad_restrictedOperation,
868 &restricted_exops[ i ].op,
869 &restricted_exops[ i ].op );
875 be->be_restrictops = rp_cur;
878 if ( rc == LDAP_SUCCESS ) {
879 attrs_free( save_attrs );
880 rc = SLAP_CB_CONTINUE;
883 Attribute *tmp = e->e_attrs;
884 e->e_attrs = save_attrs;
890 #if defined(LDAP_SLAPI)
892 monitor_back_add_plugin( monitor_info_t *mi, Backend *be, Entry *e_database )
894 Slapi_PBlock *pCurrentPB;
895 int i, rc = LDAP_SUCCESS;
897 if ( slapi_int_pblock_get_first( be, &pCurrentPB ) != LDAP_SUCCESS ) {
899 * LDAP_OTHER is returned if no plugins are installed
907 Slapi_PluginDesc *srchdesc;
908 char buf[ BACKMONITOR_BUFSIZE ];
911 rc = slapi_pblock_get( pCurrentPB, SLAPI_PLUGIN_DESCRIPTION,
913 if ( rc != LDAP_SUCCESS ) {
917 snprintf( buf, sizeof(buf),
918 "plugin %d name: %s; "
924 srchdesc->spd_vendor,
925 srchdesc->spd_version,
926 srchdesc->spd_description );
928 ber_str2bv( buf, 0, 0, &bv );
929 attr_merge_normalize_one( e_database,
930 mi->mi_ad_monitoredInfo, &bv, NULL );
934 } while ( ( slapi_int_pblock_get_next( &pCurrentPB ) == LDAP_SUCCESS )
935 && ( pCurrentPB != NULL ) );
940 #endif /* defined(LDAP_SLAPI) */