1 /* database.c - deals with database subsystem */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2001-2007 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 /* for PATH_MAX on some systems (e.g. Solaris) */
39 #endif /* HAVE_LIMITS_H */
42 #endif /* ! PATH_MAX */
45 monitor_subsys_database_modify(
50 static struct restricted_ops_t {
53 } restricted_ops[] = {
54 { BER_BVC( "add" ), SLAP_RESTRICT_OP_ADD },
55 { BER_BVC( "bind" ), SLAP_RESTRICT_OP_BIND },
56 { BER_BVC( "compare" ), SLAP_RESTRICT_OP_COMPARE },
57 { BER_BVC( "delete" ), SLAP_RESTRICT_OP_DELETE },
58 { BER_BVC( "extended" ), SLAP_RESTRICT_OP_EXTENDED },
59 { BER_BVC( "modify" ), SLAP_RESTRICT_OP_MODIFY },
60 { BER_BVC( "rename" ), SLAP_RESTRICT_OP_RENAME },
61 { BER_BVC( "search" ), SLAP_RESTRICT_OP_SEARCH },
63 }, restricted_exops[] = {
64 { BER_BVC( LDAP_EXOP_START_TLS ), SLAP_RESTRICT_EXOP_START_TLS },
65 { BER_BVC( LDAP_EXOP_MODIFY_PASSWD ), SLAP_RESTRICT_EXOP_MODIFY_PASSWD },
66 { BER_BVC( LDAP_EXOP_WHO_AM_I ), SLAP_RESTRICT_EXOP_WHOAMI },
67 { BER_BVC( LDAP_EXOP_CANCEL ), SLAP_RESTRICT_EXOP_CANCEL },
72 init_readOnly( monitor_info_t *mi, Entry *e, slap_mask_t restrictops )
74 struct berval *tf = ( ( restrictops & SLAP_RESTRICT_OP_MASK ) == SLAP_RESTRICT_OP_WRITES ) ?
75 (struct berval *)&slap_true_bv : (struct berval *)&slap_false_bv;
77 return attr_merge_one( e, mi->mi_ad_readOnly, tf, tf );
81 init_restrictedOperation( monitor_info_t *mi, Entry *e, slap_mask_t restrictops )
85 for ( i = 0; restricted_ops[ i ].op.bv_val; i++ ) {
86 if ( restrictops & restricted_ops[ i ].tag ) {
87 rc = attr_merge_one( e, mi->mi_ad_restrictedOperation,
88 &restricted_ops[ i ].op,
89 &restricted_ops[ i ].op );
96 for ( i = 0; restricted_exops[ i ].op.bv_val; i++ ) {
97 if ( restrictops & restricted_exops[ i ].tag ) {
98 rc = attr_merge_one( e, mi->mi_ad_restrictedOperation,
99 &restricted_exops[ i ].op,
100 &restricted_exops[ i ].op );
111 monitor_subsys_database_init_one(
114 monitor_subsys_t *ms,
115 monitor_subsys_t *ms_backend,
116 monitor_subsys_t *ms_overlay,
121 char buf[ BACKMONITOR_BUFSIZE ];
123 slap_overinfo *oi = NULL;
124 BackendInfo *bi, *bi2;
127 char *rdnval = strchr( rdn->bv_val, '=' ) + 1;
132 if ( overlay_is_over( be ) ) {
133 oi = (slap_overinfo *)be->bd_info->bi_private;
137 /* Subordinates are not exposed as their own naming context */
138 if ( SLAP_GLUE_SUBORDINATE( be ) ) {
142 e = monitor_entry_stub( &ms->mss_dn, &ms->mss_ndn, rdn,
143 mi->mi_oc_monitoredObject, mi, NULL, NULL );
146 Debug( LDAP_DEBUG_ANY,
147 "monitor_subsys_database_init: "
148 "unable to create entry \"%s,%s\"\n",
149 rdn->bv_val, ms->mss_dn.bv_val, 0 );
153 ber_str2bv( bi->bi_type, 0, 0, &bv );
154 attr_merge_one( e, mi->mi_ad_monitoredInfo, &bv, NULL );
155 attr_merge_one( e, mi->mi_ad_monitorIsShadow,
156 SLAP_SHADOW( be ) ? (struct berval *)&slap_true_bv :
157 (struct berval *)&slap_false_bv, NULL );
159 if ( SLAP_MONITOR( be ) ) {
160 attr_merge( e, slap_schema.si_ad_monitorContext,
161 be->be_suffix, be->be_nsuffix );
162 attr_merge( e_database, slap_schema.si_ad_monitorContext,
163 be->be_suffix, be->be_nsuffix );
166 if ( be->be_suffix == NULL ) {
167 Debug( LDAP_DEBUG_ANY,
168 "monitor_subsys_database_init: "
169 "missing suffix for %s\n",
173 attr_merge( e, slap_schema.si_ad_namingContexts,
174 be->be_suffix, be->be_nsuffix );
175 attr_merge( e_database, slap_schema.si_ad_namingContexts,
176 be->be_suffix, be->be_nsuffix );
179 (void)init_readOnly( mi, e, be->be_restrictops );
180 (void)init_restrictedOperation( mi, e, be->be_restrictops );
182 if ( SLAP_SHADOW( be ) && be->be_update_refs ) {
183 attr_merge_normalize( e, mi->mi_ad_monitorUpdateRef,
184 be->be_update_refs, NULL );
188 slap_overinst *on = oi->oi_list,
191 for ( ; on; on = on->on_next ) {
194 for ( on2 = on1; on2 != on; on2 = on2->on_next ) {
195 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
204 ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
205 attr_merge_normalize_one( e, mi->mi_ad_monitorOverlay,
208 /* find the overlay number, j */
209 for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
210 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
214 assert( on2 != NULL );
216 snprintf( buf, sizeof( buf ),
218 j, ms_overlay->mss_dn.bv_val );
219 ber_str2bv( buf, 0, 0, &bv );
220 attr_merge_normalize_one( e,
221 slap_schema.si_ad_seeAlso,
227 LDAP_STAILQ_FOREACH( bi2, &backendInfo, bi_next ) {
229 if ( bi2->bi_type == bi->bi_type ) {
230 snprintf( buf, sizeof( buf ),
232 j, ms_backend->mss_dn.bv_val );
234 bv.bv_len = strlen( buf );
235 attr_merge_normalize_one( e,
236 slap_schema.si_ad_seeAlso,
241 /* we must find it! */
244 mp = monitor_entrypriv_create();
248 e->e_private = ( void * )mp;
250 mp->mp_flags = ms->mss_flags
253 if ( monitor_cache_add( mi, e ) ) {
254 Debug( LDAP_DEBUG_ANY,
255 "monitor_subsys_database_init: "
256 "unable to add entry \"%s,%s\"\n",
257 rdn->bv_val, ms->mss_dn.bv_val, 0 );
261 #if defined(LDAP_SLAPI)
262 monitor_back_add_plugin( mi, be, e );
263 #endif /* defined(LDAP_SLAPI) */
266 Entry **ep_overlay = &mp->mp_children;
267 monitor_entry_t *mp_overlay;
268 slap_overinst *on = oi->oi_list;
271 for ( o = 0; on; o++, on = on->on_next ) {
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 bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Overlay %d", o );
286 e_overlay = monitor_entry_stub( &e->e_name, &e->e_nname, &bv,
287 mi->mi_oc_monitoredObject, mi, NULL, NULL );
289 if ( e_overlay == NULL ) {
290 Debug( LDAP_DEBUG_ANY,
291 "monitor_subsys_database_init: "
292 "unable to create entry "
293 "\"cn=Overlay %d,%s,%s\"\n",
294 o, rdn->bv_val, ms->mss_dn.bv_val );
297 ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
298 attr_merge_one( e_overlay, mi->mi_ad_monitoredInfo, &bv, NULL );
300 bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Overlay %d,%s",
301 j, ms_overlay->mss_dn.bv_val );
303 attr_merge_normalize_one( e_overlay, slap_schema.si_ad_seeAlso,
306 if ( SLAP_MONITOR( be ) ) {
307 attr_merge( e_overlay, slap_schema.si_ad_monitorContext,
308 be->be_suffix, be->be_nsuffix );
311 attr_merge( e_overlay, slap_schema.si_ad_namingContexts,
312 be->be_suffix, be->be_nsuffix );
315 mp_overlay = monitor_entrypriv_create();
316 if ( mp_overlay == NULL ) {
319 e_overlay->e_private = ( void * )mp_overlay;
320 mp_overlay->mp_info = ms;
321 mp_overlay->mp_flags = ms->mss_flags
324 if ( monitor_cache_add( mi, e_overlay ) ) {
325 Debug( LDAP_DEBUG_ANY,
326 "monitor_subsys_database_init: "
327 "unable to add entry "
328 "\"cn=Overlay %d,%s,%s\"\n",
329 o, rdn->bv_val, ms->mss_dn.bv_val );
333 *ep_overlay = e_overlay;
334 ep_overlay = &mp_overlay->mp_next;
345 monitor_back_register_database(
350 Entry *e_database, **ep;
353 monitor_subsys_t *ms_backend,
357 char buf[ BACKMONITOR_BUFSIZE ];
359 assert( be_monitor != NULL );
361 if ( !monitor_subsys_is_opened() ) {
362 return monitor_back_register_database_limbo( be, ndn );
365 mi = ( monitor_info_t * )be_monitor->be_private;
367 ms_backend = monitor_back_get_subsys( SLAPD_MONITOR_BACKEND_NAME );
368 if ( ms_backend == NULL ) {
369 Debug( LDAP_DEBUG_ANY,
370 "monitor_back_register_database: "
372 "\"" SLAPD_MONITOR_BACKEND_NAME "\" "
378 ms_database = monitor_back_get_subsys( SLAPD_MONITOR_DATABASE_NAME );
379 if ( ms_database == NULL ) {
380 Debug( LDAP_DEBUG_ANY,
381 "monitor_back_register_database: "
383 "\"" SLAPD_MONITOR_DATABASE_NAME "\" "
389 ms_overlay = monitor_back_get_subsys( SLAPD_MONITOR_OVERLAY_NAME );
390 if ( ms_overlay == NULL ) {
391 Debug( LDAP_DEBUG_ANY,
392 "monitor_back_register_database: "
394 "\"" SLAPD_MONITOR_OVERLAY_NAME "\" "
400 if ( monitor_cache_get( mi, &ms_database->mss_ndn, &e_database ) ) {
401 Debug( LDAP_DEBUG_ANY,
402 "monitor_subsys_database_init: "
403 "unable to get entry \"%s\"\n",
404 ms_database->mss_ndn.bv_val, 0, 0 );
408 mp = ( monitor_entry_t * )e_database->e_private;
409 for ( i = -1, ep = &mp->mp_children; *ep; i++ ) {
412 a = attr_find( (*ep)->e_attrs, slap_schema.si_ad_namingContexts );
416 for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
417 for ( k = 0; !BER_BVISNULL( &be->be_nsuffix[ k ] ); k++ ) {
418 if ( dn_match( &a->a_nvals[ j ], &be->be_nsuffix[ k ] ) ) {
426 mp = ( monitor_entry_t * )(*ep)->e_private;
428 assert( mp != NULL );
433 bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Database %d", i );
434 if ( bv.bv_len >= sizeof( buf ) ) {
439 rc = monitor_subsys_database_init_one( mi, be,
440 ms_database, ms_backend, ms_overlay, &bv, e_database, &ep );
446 monitor_cache_release( mi, e_database );
447 if ( rc == 0 && ndn && ep && *ep ) {
448 *ndn = (*ep)->e_nname;
455 monitor_subsys_database_init(
457 monitor_subsys_t *ms )
460 Entry *e_database, **ep;
463 monitor_subsys_t *ms_backend,
467 assert( be != NULL );
469 ms->mss_modify = monitor_subsys_database_modify;
471 mi = ( monitor_info_t * )be->be_private;
473 ms_backend = monitor_back_get_subsys( SLAPD_MONITOR_BACKEND_NAME );
474 if ( ms_backend == NULL ) {
475 Debug( LDAP_DEBUG_ANY,
476 "monitor_subsys_database_init: "
478 "\"" SLAPD_MONITOR_BACKEND_NAME "\" "
484 ms_overlay = monitor_back_get_subsys( SLAPD_MONITOR_OVERLAY_NAME );
485 if ( ms_overlay == NULL ) {
486 Debug( LDAP_DEBUG_ANY,
487 "monitor_subsys_database_init: "
489 "\"" SLAPD_MONITOR_OVERLAY_NAME "\" "
495 if ( monitor_cache_get( mi, &ms->mss_ndn, &e_database ) ) {
496 Debug( LDAP_DEBUG_ANY,
497 "monitor_subsys_database_init: "
498 "unable to get entry \"%s\"\n",
499 ms->mss_ndn.bv_val, 0, 0 );
503 (void)init_readOnly( mi, e_database, frontendDB->be_restrictops );
504 (void)init_restrictedOperation( mi, e_database, frontendDB->be_restrictops );
506 mp = ( monitor_entry_t * )e_database->e_private;
507 mp->mp_children = NULL;
508 ep = &mp->mp_children;
510 BER_BVSTR( &bv, "cn=Frontend" );
511 rc = monitor_subsys_database_init_one( mi, frontendDB,
512 ms, ms_backend, ms_overlay, &bv, e_database, &ep );
518 LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
519 char buf[ BACKMONITOR_BUFSIZE ];
522 bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Database %d", ++i );
523 if ( bv.bv_len >= sizeof( buf ) ) {
527 rc = monitor_subsys_database_init_one( mi, be,
528 ms, ms_backend, ms_overlay, &bv, e_database, &ep );
534 monitor_cache_release( mi, e_database );
541 * cur: must not contain the tags corresponding to the values in v
542 * delta: will contain the tags corresponding to the values in v
545 value_mask( BerVarray v, slap_mask_t cur, slap_mask_t *delta )
547 for ( ; !BER_BVISNULL( v ); v++ ) {
548 struct restricted_ops_t *rops;
551 if ( OID_LEADCHAR( v->bv_val[ 0 ] ) ) {
552 rops = restricted_exops;
555 rops = restricted_ops;
558 for ( i = 0; !BER_BVISNULL( &rops[ i ].op ); i++ ) {
559 if ( ber_bvstrcasecmp( v, &rops[ i ].op ) != 0 ) {
563 if ( rops[ i ].tag & *delta ) {
567 if ( rops[ i ].tag & cur ) {
571 cur |= rops[ i ].tag;
572 *delta |= rops[ i ].tag;
577 if ( BER_BVISNULL( &rops[ i ].op ) ) {
578 return LDAP_INVALID_SYNTAX;
586 monitor_subsys_database_modify(
591 monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
593 Attribute *save_attrs, *a;
596 int ro_gotval = 1, i, n;
597 slap_mask_t rp_add = 0, rp_delete = 0, rp_cur;
600 i = sscanf( e->e_nname.bv_val, "cn=database %d,", &n );
602 return SLAP_CB_CONTINUE;
605 if ( n < 0 || n >= nBackendDB ) {
606 rs->sr_text = "invalid database index";
607 return ( rs->sr_err = LDAP_NO_SUCH_OBJECT );
610 LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
616 /* do not allow some changes on back-monitor (needs work)... */
617 if ( SLAP_MONITOR( be ) ) {
618 rs->sr_text = "no modifications allowed to monitor database entry";
619 return ( rs->sr_err = LDAP_UNWILLING_TO_PERFORM );
622 rp_cur = be->be_restrictops;
624 save_attrs = e->e_attrs;
625 e->e_attrs = attrs_dup( e->e_attrs );
627 for ( ml = op->orm_modlist; ml; ml = ml->sml_next ) {
628 Modification *mod = &ml->sml_mod;
630 if ( mod->sm_desc == mi->mi_ad_readOnly ) {
633 if ( mod->sm_values ) {
634 if ( !BER_BVISNULL( &mod->sm_values[ 1 ] ) ) {
635 rs->sr_text = "attempting to modify multiple values of single-valued attribute";
636 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
640 if ( bvmatch( &slap_true_bv, mod->sm_values )) {
643 } else if ( bvmatch( &slap_false_bv, mod->sm_values )) {
648 rc = rs->sr_err = LDAP_INVALID_SYNTAX;
653 switch ( mod->sm_op ) {
654 case LDAP_MOD_DELETE:
655 if ( ro_gotval < 1 ) {
656 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
661 if ( val == 0 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) == SLAP_RESTRICT_OP_WRITES ) {
662 rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
666 if ( val == 1 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) != SLAP_RESTRICT_OP_WRITES ) {
667 rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
673 case LDAP_MOD_REPLACE:
678 if ( ro_gotval > 0 ) {
679 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
685 rp_add |= (~rp_cur) & SLAP_RESTRICT_OP_WRITES;
686 rp_cur |= SLAP_RESTRICT_OP_WRITES;
687 rp_delete &= ~SLAP_RESTRICT_OP_WRITES;
689 } else if ( val == 0 ) {
690 rp_delete |= rp_cur & SLAP_RESTRICT_OP_WRITES;
691 rp_cur &= ~SLAP_RESTRICT_OP_WRITES;
692 rp_add &= ~SLAP_RESTRICT_OP_WRITES;
697 rc = rs->sr_err = LDAP_OTHER;
701 } else if ( mod->sm_desc == mi->mi_ad_restrictedOperation ) {
702 slap_mask_t mask = 0;
704 switch ( mod->sm_op ) {
705 case LDAP_MOD_DELETE:
706 if ( mod->sm_values == NULL ) {
712 rc = value_mask( mod->sm_values, ~rp_cur, &mask );
713 if ( rc == LDAP_SUCCESS ) {
718 } else if ( rc == LDAP_OTHER ) {
719 rc = LDAP_NO_SUCH_ATTRIBUTE;
723 case LDAP_MOD_REPLACE:
730 rc = value_mask( mod->sm_values, rp_cur, &mask );
731 if ( rc == LDAP_SUCCESS ) {
736 } else if ( rc == LDAP_OTHER ) {
737 rc = rs->sr_err = LDAP_TYPE_OR_VALUE_EXISTS;
742 rc = rs->sr_err = LDAP_OTHER;
746 if ( rc != LDAP_SUCCESS ) {
750 } else if ( is_at_operational( mod->sm_desc->ad_type )) {
751 /* accept all operational attributes */
752 attr_delete( &e->e_attrs, mod->sm_desc );
753 rc = attr_merge( e, mod->sm_desc, mod->sm_values,
756 rc = rs->sr_err = LDAP_OTHER;
761 rc = rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
767 if ( ro_gotval < 1 ) {
768 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
772 if ( ( rp_cur & SLAP_RESTRICT_OP_EXTENDED ) && ( rp_cur & SLAP_RESTRICT_EXOP_MASK ) ) {
773 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
777 if ( rp_delete & rp_add ) {
778 rc = rs->sr_err = LDAP_OTHER;
782 /* check current value of readOnly */
783 if ( ( rp_cur & SLAP_RESTRICT_OP_WRITES ) == SLAP_RESTRICT_OP_WRITES ) {
784 tf = (struct berval *)&slap_true_bv;
787 tf = (struct berval *)&slap_false_bv;
790 a = attr_find( e->e_attrs, mi->mi_ad_readOnly );
796 if ( !bvmatch( &a->a_vals[ 0 ], tf ) ) {
797 attr_delete( &e->e_attrs, mi->mi_ad_readOnly );
798 rc = attr_merge_one( e, mi->mi_ad_readOnly, tf, tf );
801 if ( rc == LDAP_SUCCESS ) {
803 if ( rp_delete == be->be_restrictops ) {
804 attr_delete( &e->e_attrs, mi->mi_ad_restrictedOperation );
807 a = attr_find( e->e_attrs, mi->mi_ad_restrictedOperation );
809 rc = rs->sr_err = LDAP_OTHER;
813 for ( i = 0; !BER_BVISNULL( &restricted_ops[ i ].op ); i++ ) {
814 if ( rp_delete & restricted_ops[ i ].tag ) {
817 for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
820 if ( !bvmatch( &a->a_nvals[ j ], &restricted_ops[ i ].op ) ) {
824 ch_free( a->a_vals[ j ].bv_val );
825 ch_free( a->a_nvals[ j ].bv_val );
827 for ( k = j + 1; !BER_BVISNULL( &a->a_nvals[ k ] ); k++ ) {
828 a->a_vals[ k - 1 ] = a->a_vals[ k ];
829 a->a_nvals[ k - 1 ] = a->a_nvals[ k ];
832 BER_BVZERO( &a->a_vals[ k - 1 ] );
833 BER_BVZERO( &a->a_nvals[ k - 1 ] );
838 for ( i = 0; !BER_BVISNULL( &restricted_exops[ i ].op ); i++ ) {
839 if ( rp_delete & restricted_exops[ i ].tag ) {
842 for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
845 if ( !bvmatch( &a->a_nvals[ j ], &restricted_exops[ i ].op ) ) {
849 ch_free( a->a_vals[ j ].bv_val );
850 ch_free( a->a_nvals[ j ].bv_val );
852 for ( k = j + 1; !BER_BVISNULL( &a->a_nvals[ k ] ); k++ ) {
853 a->a_vals[ k - 1 ] = a->a_vals[ k ];
854 a->a_nvals[ k - 1 ] = a->a_nvals[ k ];
857 BER_BVZERO( &a->a_vals[ k - 1 ] );
858 BER_BVZERO( &a->a_nvals[ k - 1 ] );
866 for ( i = 0; !BER_BVISNULL( &restricted_ops[ i ].op ); i++ ) {
867 if ( rp_add & restricted_ops[ i ].tag ) {
868 attr_merge_one( e, mi->mi_ad_restrictedOperation,
869 &restricted_ops[ i ].op,
870 &restricted_ops[ i ].op );
874 for ( i = 0; !BER_BVISNULL( &restricted_exops[ i ].op ); i++ ) {
875 if ( rp_add & restricted_exops[ i ].tag ) {
876 attr_merge_one( e, mi->mi_ad_restrictedOperation,
877 &restricted_exops[ i ].op,
878 &restricted_exops[ i ].op );
884 be->be_restrictops = rp_cur;
887 if ( rc == LDAP_SUCCESS ) {
888 attrs_free( save_attrs );
889 rc = SLAP_CB_CONTINUE;
892 Attribute *tmp = e->e_attrs;
893 e->e_attrs = save_attrs;
899 #if defined(LDAP_SLAPI)
901 monitor_back_add_plugin( monitor_info_t *mi, Backend *be, Entry *e_database )
903 Slapi_PBlock *pCurrentPB;
904 int i, rc = LDAP_SUCCESS;
906 if ( slapi_int_pblock_get_first( be, &pCurrentPB ) != LDAP_SUCCESS ) {
908 * LDAP_OTHER is returned if no plugins are installed
916 Slapi_PluginDesc *srchdesc;
917 char buf[ BACKMONITOR_BUFSIZE ];
920 rc = slapi_pblock_get( pCurrentPB, SLAPI_PLUGIN_DESCRIPTION,
922 if ( rc != LDAP_SUCCESS ) {
926 snprintf( buf, sizeof(buf),
927 "plugin %d name: %s; "
933 srchdesc->spd_vendor,
934 srchdesc->spd_version,
935 srchdesc->spd_description );
937 ber_str2bv( buf, 0, 0, &bv );
938 attr_merge_normalize_one( e_database,
939 mi->mi_ad_monitoredInfo, &bv, NULL );
943 } while ( ( slapi_int_pblock_get_next( &pCurrentPB ) == LDAP_SUCCESS )
944 && ( pCurrentPB != NULL ) );
949 #endif /* defined(LDAP_SLAPI) */