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 defined(SLAPD_META)
46 #include "../back-meta/back-meta.h"
47 #endif /* defined(SLAPD_META) */
49 /* for PATH_MAX on some systems (e.g. Solaris) */
52 #endif /* HAVE_LIMITS_H */
55 #endif /* ! PATH_MAX */
58 monitor_subsys_database_modify(
63 static struct restricted_ops_t {
66 } restricted_ops[] = {
67 { BER_BVC( "add" ), SLAP_RESTRICT_OP_ADD },
68 { BER_BVC( "bind" ), SLAP_RESTRICT_OP_BIND },
69 { BER_BVC( "compare" ), SLAP_RESTRICT_OP_COMPARE },
70 { BER_BVC( "delete" ), SLAP_RESTRICT_OP_DELETE },
71 { BER_BVC( "extended" ), SLAP_RESTRICT_OP_EXTENDED },
72 { BER_BVC( "modify" ), SLAP_RESTRICT_OP_MODIFY },
73 { BER_BVC( "rename" ), SLAP_RESTRICT_OP_RENAME },
74 { BER_BVC( "search" ), SLAP_RESTRICT_OP_SEARCH },
76 }, restricted_exops[] = {
77 { BER_BVC( LDAP_EXOP_START_TLS ), SLAP_RESTRICT_EXOP_START_TLS },
78 { BER_BVC( LDAP_EXOP_MODIFY_PASSWD ), SLAP_RESTRICT_EXOP_MODIFY_PASSWD },
79 { BER_BVC( LDAP_EXOP_WHO_AM_I ), SLAP_RESTRICT_EXOP_WHOAMI },
80 { BER_BVC( LDAP_EXOP_CANCEL ), SLAP_RESTRICT_EXOP_CANCEL },
85 init_readOnly( monitor_info_t *mi, Entry *e, slap_mask_t restrictops )
87 struct berval *tf = ( ( restrictops & SLAP_RESTRICT_OP_MASK ) == SLAP_RESTRICT_OP_WRITES ) ?
88 (struct berval *)&slap_true_bv : (struct berval *)&slap_false_bv;
90 return attr_merge_one( e, mi->mi_ad_readOnly, tf, tf );
94 init_restrictedOperation( monitor_info_t *mi, Entry *e, slap_mask_t restrictops )
98 for ( i = 0; restricted_ops[ i ].op.bv_val; i++ ) {
99 if ( restrictops & restricted_ops[ i ].tag ) {
100 rc = attr_merge_one( e, mi->mi_ad_restrictedOperation,
101 &restricted_ops[ i ].op,
102 &restricted_ops[ i ].op );
109 for ( i = 0; restricted_exops[ i ].op.bv_val; i++ ) {
110 if ( restrictops & restricted_exops[ i ].tag ) {
111 rc = attr_merge_one( e, mi->mi_ad_restrictedOperation,
112 &restricted_exops[ i ].op,
113 &restricted_exops[ i ].op );
124 monitor_subsys_database_init(
130 Entry *e_database, **ep;
133 monitor_subsys_t *ms_backend,
136 assert( be != NULL );
138 ms->mss_modify = monitor_subsys_database_modify;
140 mi = ( monitor_info_t * )be->be_private;
142 ms_backend = monitor_back_get_subsys( SLAPD_MONITOR_BACKEND_NAME );
143 if ( ms_backend == NULL ) {
144 Debug( LDAP_DEBUG_ANY,
145 "monitor_subsys_database_init: "
147 "\"" SLAPD_MONITOR_BACKEND_NAME "\" "
153 ms_overlay = monitor_back_get_subsys( SLAPD_MONITOR_OVERLAY_NAME );
154 if ( ms_overlay == NULL ) {
155 Debug( LDAP_DEBUG_ANY,
156 "monitor_subsys_database_init: "
158 "\"" SLAPD_MONITOR_OVERLAY_NAME "\" "
164 if ( monitor_cache_get( mi, &ms->mss_ndn, &e_database ) ) {
165 Debug( LDAP_DEBUG_ANY,
166 "monitor_subsys_database_init: "
167 "unable to get entry \"%s\"\n",
168 ms->mss_ndn.bv_val, 0, 0 );
172 (void)init_readOnly( mi, e_database, frontendDB->be_restrictops );
173 (void)init_restrictedOperation( mi, e_database, frontendDB->be_restrictops );
175 mp = ( monitor_entry_t * )e_database->e_private;
176 mp->mp_children = NULL;
177 ep = &mp->mp_children;
180 LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
181 char buf[ BACKMONITOR_BUFSIZE ];
183 slap_overinfo *oi = NULL;
184 BackendInfo *bi, *bi2;
192 if ( overlay_is_over( be ) ) {
193 oi = (slap_overinfo *)be->bd_info->bi_private;
197 /* Subordinates are not exposed as their own naming context */
198 if ( SLAP_GLUE_SUBORDINATE( be ) ) {
202 bv.bv_len = snprintf( buf, sizeof( buf ),
203 "cn=Database %d", i );
205 e = monitor_entry_stub( &ms->mss_dn, &ms->mss_ndn, &bv,
206 mi->mi_oc_monitoredObject, mi, NULL, NULL );
209 Debug( LDAP_DEBUG_ANY,
210 "monitor_subsys_database_init: "
211 "unable to create entry \"cn=Database %d,%s\"\n",
212 i, ms->mss_dn.bv_val, 0 );
216 ber_str2bv( bi->bi_type, 0, 0, &bv );
217 attr_merge_one( e, mi->mi_ad_monitoredInfo, &bv, NULL );
218 attr_merge_one( e, mi->mi_ad_monitorIsShadow,
219 SLAP_SHADOW( be ) ? (struct berval *)&slap_true_bv :
220 (struct berval *)&slap_false_bv, NULL );
222 if ( SLAP_MONITOR( be ) ) {
223 attr_merge( e, slap_schema.si_ad_monitorContext,
224 be->be_suffix, be->be_nsuffix );
225 attr_merge( e_database, slap_schema.si_ad_monitorContext,
226 be->be_suffix, be->be_nsuffix );
229 if ( be->be_suffix == NULL ) {
230 Debug( LDAP_DEBUG_ANY,
231 "monitor_subsys_database_init: "
232 "missing suffix for database %d\n",
236 attr_merge( e, slap_schema.si_ad_namingContexts,
237 be->be_suffix, be->be_nsuffix );
238 attr_merge( e_database, slap_schema.si_ad_namingContexts,
239 be->be_suffix, be->be_nsuffix );
242 (void)init_readOnly( mi, e, be->be_restrictops );
243 (void)init_restrictedOperation( mi, e, be->be_restrictops );
245 if ( SLAP_SHADOW( be ) && be->be_update_refs ) {
246 attr_merge_normalize( e, mi->mi_ad_monitorUpdateRef,
247 be->be_update_refs, NULL );
251 slap_overinst *on = oi->oi_list,
254 for ( ; on; on = on->on_next ) {
258 for ( on2 = on1; on2 != on; on2 = on2->on_next ) {
259 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
268 ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
269 attr_merge_normalize_one( e, mi->mi_ad_monitorOverlay,
272 /* find the overlay number, j */
273 for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
274 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
278 assert( on2 != NULL );
280 snprintf( buf, sizeof( buf ),
282 j, ms_overlay->mss_dn.bv_val );
283 ber_str2bv( buf, 0, 0, &bv );
284 attr_merge_normalize_one( e,
285 slap_schema.si_ad_seeAlso,
294 #if defined(SLAPD_BDB) || defined(SLAPD_HDB)
295 } else if ( strcmp( bi->bi_type, "bdb" ) == 0
296 || strcmp( bi->bi_type, "hdb" ) == 0 )
299 ber_len_t pathlen = 0, len = 0;
300 char path[ PATH_MAX ] = { '\0' };
301 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
302 char *fname = bdb->bi_dbenv_home;
304 len = strlen( fname );
305 if ( fname[ 0 ] != '/' ) {
306 /* get full path name */
307 getcwd( path, sizeof( path ) );
308 pathlen = strlen( path );
310 if ( fname[ 0 ] == '.' && fname[ 1 ] == '/' ) {
316 bv.bv_len = STRLENOF( "file://" ) + pathlen
317 + STRLENOF( "/" ) + len;
318 bv.bv_val = ch_malloc( bv.bv_len + STRLENOF( "/" ) + 1 );
319 AC_MEMCPY( bv.bv_val, "file://", STRLENOF( "file://" ) );
321 AC_MEMCPY( &bv.bv_val[ STRLENOF( "file://" ) ],
323 bv.bv_val[ STRLENOF( "file://" ) + pathlen ] = '/';
326 AC_MEMCPY( &bv.bv_val[ STRLENOF( "file://" ) + pathlen ],
328 if ( bv.bv_val[ bv.bv_len - 1 ] != '/' ) {
329 bv.bv_val[ bv.bv_len ] = '/';
332 bv.bv_val[ bv.bv_len ] = '\0';
334 attr_merge_normalize_one( e, slap_schema.si_ad_labeledURI,
337 ch_free( bv.bv_val );
339 #endif /* defined(SLAPD_BDB) || defined(SLAPD_HDB) */
340 #if defined(SLAPD_LDAP)
341 } else if ( strcmp( bi->bi_type, "ldap" ) == 0 ) {
342 ldapinfo_t *li = (ldapinfo_t *)be->be_private;
344 attr_merge_normalize( e, slap_schema.si_ad_labeledURI,
345 li->li_bvuri, NULL );
347 char **urls = ldap_str2charray( li->li_uri, " " );
349 if ( urls != NULL ) {
352 for ( u = 0; urls[ u ] != NULL; u++ ) {
355 ber_str2bv( urls[ u ], 0, 0, &bv );
357 attr_merge_normalize_one( e,
358 slap_schema.si_ad_labeledURI,
362 ldap_charray_free( urls );
366 #endif /* defined(SLAPD_LDAP) */
367 #if defined(SLAPD_META)
368 } else if ( strcmp( bi->bi_type, "meta" ) == 0 ) {
369 metainfo_t *mi = (metainfo_t *)be->be_private;
372 for ( t = 0; t < mi->mi_ntargets; t++ ) {
373 char **urls = ldap_str2charray( mi->mi_targets[ t ].mt_uri, " " );
375 if ( urls != NULL ) {
378 for ( u = 0; urls[ u ] != NULL; u++ ) {
381 ber_str2bv( urls[ u ], 0, 0, &bv );
383 attr_merge_normalize_one( e,
384 slap_schema.si_ad_labeledURI,
387 ldap_charray_free( urls );
390 #endif /* defined(SLAPD_META) */
394 LDAP_STAILQ_FOREACH( bi2, &backendInfo, bi_next ) {
396 if ( bi2->bi_type == bi->bi_type ) {
399 snprintf( buf, sizeof( buf ),
401 j, ms_backend->mss_dn.bv_val );
403 bv.bv_len = strlen( buf );
404 attr_merge_normalize_one( e,
405 slap_schema.si_ad_seeAlso,
410 /* we must find it! */
413 mp = monitor_entrypriv_create();
417 e->e_private = ( void * )mp;
419 mp->mp_flags = ms->mss_flags
422 if ( monitor_cache_add( mi, e ) ) {
423 Debug( LDAP_DEBUG_ANY,
424 "monitor_subsys_database_init: "
425 "unable to add entry \"cn=Database %d,%s\"\n",
426 i, ms->mss_dn.bv_val, 0 );
430 #if defined(LDAP_SLAPI)
431 monitor_back_add_plugin( mi, be, e );
432 #endif /* defined(LDAP_SLAPI) */
435 Entry **ep_overlay = &mp->mp_children;
436 monitor_entry_t *mp_overlay;
437 slap_overinst *on = oi->oi_list;
440 for ( o = 0; on; o++, on = on->on_next ) {
444 /* find the overlay number, j */
445 for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
446 if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
450 assert( on2 != NULL );
452 bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Overlay %d", o );
455 e_overlay = monitor_entry_stub( &e->e_name, &e->e_nname, &bv,
456 mi->mi_oc_monitoredObject, mi, NULL, NULL );
458 if ( e_overlay == NULL ) {
459 Debug( LDAP_DEBUG_ANY,
460 "monitor_subsys_database_init: "
461 "unable to create entry "
462 "\"cn=Overlay %d,cn=Database %d,%s\"\n",
463 o, i, ms->mss_dn.bv_val );
466 ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
467 attr_merge_one( e_overlay, mi->mi_ad_monitoredInfo, &bv, NULL );
469 bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Overlay %d,%s",
470 j, ms_overlay->mss_dn.bv_val );
472 attr_merge_normalize_one( e_overlay, slap_schema.si_ad_seeAlso,
475 mp_overlay = monitor_entrypriv_create();
476 if ( mp_overlay == NULL ) {
479 e_overlay->e_private = ( void * )mp_overlay;
480 mp_overlay->mp_info = ms;
481 mp_overlay->mp_flags = ms->mss_flags
484 if ( monitor_cache_add( mi, e_overlay ) ) {
485 Debug( LDAP_DEBUG_ANY,
486 "monitor_subsys_database_init: "
487 "unable to add entry "
488 "\"cn=Overlay %d,cn=Database %d,%s\"\n",
489 o, i, ms->mss_dn.bv_val );
493 *ep_overlay = e_overlay;
494 ep_overlay = &mp_overlay->mp_next;
502 monitor_cache_release( mi, e_database );
509 * cur: must not contain the tags corresponding to the values in v
510 * delta: will contain the tags corresponding to the values in v
513 value_mask( BerVarray v, slap_mask_t cur, slap_mask_t *delta )
515 for ( ; !BER_BVISNULL( v ); v++ ) {
516 struct restricted_ops_t *rops;
519 if ( OID_LEADCHAR( v->bv_val[ 0 ] ) ) {
520 rops = restricted_exops;
523 rops = restricted_ops;
526 for ( i = 0; !BER_BVISNULL( &rops[ i ].op ); i++ ) {
527 if ( ber_bvstrcasecmp( v, &rops[ i ].op ) != 0 ) {
531 if ( rops[ i ].tag & *delta ) {
535 if ( rops[ i ].tag & cur ) {
539 cur |= rops[ i ].tag;
540 *delta |= rops[ i ].tag;
545 if ( BER_BVISNULL( &rops[ i ].op ) ) {
546 return LDAP_INVALID_SYNTAX;
554 monitor_subsys_database_modify(
559 monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
561 Attribute *save_attrs, *a;
564 int ro_gotval = 1, i, n;
565 slap_mask_t rp_add = 0, rp_delete = 0, rp_cur;
568 i = sscanf( e->e_nname.bv_val, "cn=database %d,", &n );
570 return SLAP_CB_CONTINUE;
573 if ( n < 0 || n >= nBackendDB ) {
574 rs->sr_text = "invalid database index";
575 return ( rs->sr_err = LDAP_NO_SUCH_OBJECT );
578 LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
584 /* do not allow some changes on back-monitor (needs work)... */
585 if ( SLAP_MONITOR( be ) ) {
586 rs->sr_text = "no modifications allowed to monitor database entry";
587 return ( rs->sr_err = LDAP_UNWILLING_TO_PERFORM );
590 rp_cur = be->be_restrictops;
592 save_attrs = e->e_attrs;
593 e->e_attrs = attrs_dup( e->e_attrs );
595 for ( ml = op->orm_modlist; ml; ml = ml->sml_next ) {
596 Modification *mod = &ml->sml_mod;
598 if ( mod->sm_desc == mi->mi_ad_readOnly ) {
601 if ( mod->sm_values ) {
602 if ( !BER_BVISNULL( &mod->sm_values[ 1 ] ) ) {
603 rs->sr_text = "attempting to modify multiple values of single-valued attribute";
604 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
608 if ( bvmatch( &slap_true_bv, mod->sm_values )) {
611 } else if ( bvmatch( &slap_false_bv, mod->sm_values )) {
616 rc = rs->sr_err = LDAP_INVALID_SYNTAX;
621 switch ( mod->sm_op ) {
622 case LDAP_MOD_DELETE:
623 if ( ro_gotval < 1 ) {
624 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
629 if ( val == 0 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) == SLAP_RESTRICT_OP_WRITES ) {
630 rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
634 if ( val == 1 && ( rp_cur & SLAP_RESTRICT_OP_WRITES ) != SLAP_RESTRICT_OP_WRITES ) {
635 rc = rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
641 case LDAP_MOD_REPLACE:
646 if ( ro_gotval > 0 ) {
647 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
653 rp_add |= (~rp_cur) & SLAP_RESTRICT_OP_WRITES;
654 rp_cur |= SLAP_RESTRICT_OP_WRITES;
655 rp_delete &= ~SLAP_RESTRICT_OP_WRITES;
657 } else if ( val == 0 ) {
658 rp_delete |= rp_cur & SLAP_RESTRICT_OP_WRITES;
659 rp_cur &= ~SLAP_RESTRICT_OP_WRITES;
660 rp_add &= ~SLAP_RESTRICT_OP_WRITES;
665 rc = rs->sr_err = LDAP_OTHER;
669 } else if ( mod->sm_desc == mi->mi_ad_restrictedOperation ) {
670 slap_mask_t mask = 0;
672 switch ( mod->sm_op ) {
673 case LDAP_MOD_DELETE:
674 if ( mod->sm_values == NULL ) {
680 rc = value_mask( mod->sm_values, ~rp_cur, &mask );
681 if ( rc == LDAP_SUCCESS ) {
686 } else if ( rc == LDAP_OTHER ) {
687 rc = LDAP_NO_SUCH_ATTRIBUTE;
691 case LDAP_MOD_REPLACE:
698 rc = value_mask( mod->sm_values, rp_cur, &mask );
699 if ( rc == LDAP_SUCCESS ) {
704 } else if ( rc == LDAP_OTHER ) {
705 rc = rs->sr_err = LDAP_TYPE_OR_VALUE_EXISTS;
710 rc = rs->sr_err = LDAP_OTHER;
714 if ( rc != LDAP_SUCCESS ) {
718 } else if ( is_at_operational( mod->sm_desc->ad_type )) {
719 /* accept all operational attributes */
720 attr_delete( &e->e_attrs, mod->sm_desc );
721 rc = attr_merge( e, mod->sm_desc, mod->sm_values,
724 rc = rs->sr_err = LDAP_OTHER;
729 rc = rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
735 if ( ro_gotval < 1 ) {
736 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
740 if ( ( rp_cur & SLAP_RESTRICT_OP_EXTENDED ) && ( rp_cur & SLAP_RESTRICT_EXOP_MASK ) ) {
741 rc = rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
745 if ( rp_delete & rp_add ) {
746 rc = rs->sr_err = LDAP_OTHER;
750 /* check current value of readOnly */
751 if ( ( rp_cur & SLAP_RESTRICT_OP_WRITES ) == SLAP_RESTRICT_OP_WRITES ) {
752 tf = (struct berval *)&slap_true_bv;
755 tf = (struct berval *)&slap_false_bv;
758 a = attr_find( e->e_attrs, mi->mi_ad_readOnly );
764 if ( !bvmatch( &a->a_vals[ 0 ], tf ) ) {
765 attr_delete( &e->e_attrs, mi->mi_ad_readOnly );
766 rc = attr_merge_one( e, mi->mi_ad_readOnly, tf, tf );
769 if ( rc == LDAP_SUCCESS ) {
771 if ( rp_delete == be->be_restrictops ) {
772 attr_delete( &e->e_attrs, mi->mi_ad_restrictedOperation );
775 a = attr_find( e->e_attrs, mi->mi_ad_restrictedOperation );
777 rc = rs->sr_err = LDAP_OTHER;
781 for ( i = 0; !BER_BVISNULL( &restricted_ops[ i ].op ); i++ ) {
782 if ( rp_delete & restricted_ops[ i ].tag ) {
785 for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
788 if ( !bvmatch( &a->a_nvals[ j ], &restricted_ops[ i ].op ) ) {
792 ch_free( a->a_vals[ j ].bv_val );
793 ch_free( a->a_nvals[ j ].bv_val );
795 for ( k = j + 1; !BER_BVISNULL( &a->a_nvals[ k ] ); k++ ) {
796 a->a_vals[ k - 1 ] = a->a_vals[ k ];
797 a->a_nvals[ k - 1 ] = a->a_nvals[ k ];
800 BER_BVZERO( &a->a_vals[ k - 1 ] );
801 BER_BVZERO( &a->a_nvals[ k - 1 ] );
806 for ( i = 0; !BER_BVISNULL( &restricted_exops[ i ].op ); i++ ) {
807 if ( rp_delete & restricted_exops[ i ].tag ) {
810 for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
813 if ( !bvmatch( &a->a_nvals[ j ], &restricted_exops[ i ].op ) ) {
817 ch_free( a->a_vals[ j ].bv_val );
818 ch_free( a->a_nvals[ j ].bv_val );
820 for ( k = j + 1; !BER_BVISNULL( &a->a_nvals[ k ] ); k++ ) {
821 a->a_vals[ k - 1 ] = a->a_vals[ k ];
822 a->a_nvals[ k - 1 ] = a->a_nvals[ k ];
825 BER_BVZERO( &a->a_vals[ k - 1 ] );
826 BER_BVZERO( &a->a_nvals[ k - 1 ] );
834 for ( i = 0; !BER_BVISNULL( &restricted_ops[ i ].op ); i++ ) {
835 if ( rp_add & restricted_ops[ i ].tag ) {
836 attr_merge_one( e, mi->mi_ad_restrictedOperation,
837 &restricted_ops[ i ].op,
838 &restricted_ops[ i ].op );
842 for ( i = 0; !BER_BVISNULL( &restricted_exops[ i ].op ); i++ ) {
843 if ( rp_add & restricted_exops[ i ].tag ) {
844 attr_merge_one( e, mi->mi_ad_restrictedOperation,
845 &restricted_exops[ i ].op,
846 &restricted_exops[ i ].op );
852 be->be_restrictops = rp_cur;
855 if ( rc == LDAP_SUCCESS ) {
856 attrs_free( save_attrs );
857 rc = SLAP_CB_CONTINUE;
860 Attribute *tmp = e->e_attrs;
861 e->e_attrs = save_attrs;
867 #if defined(LDAP_SLAPI)
869 monitor_back_add_plugin( monitor_info_t *mi, Backend *be, Entry *e_database )
871 Slapi_PBlock *pCurrentPB;
872 int i, rc = LDAP_SUCCESS;
874 if ( slapi_int_pblock_get_first( be, &pCurrentPB ) != LDAP_SUCCESS ) {
876 * LDAP_OTHER is returned if no plugins are installed
884 Slapi_PluginDesc *srchdesc;
885 char buf[ BACKMONITOR_BUFSIZE ];
888 rc = slapi_pblock_get( pCurrentPB, SLAPI_PLUGIN_DESCRIPTION,
890 if ( rc != LDAP_SUCCESS ) {
894 snprintf( buf, sizeof(buf),
895 "plugin %d name: %s; "
901 srchdesc->spd_vendor,
902 srchdesc->spd_version,
903 srchdesc->spd_description );
905 ber_str2bv( buf, 0, 0, &bv );
906 attr_merge_normalize_one( e_database,
907 mi->mi_ad_monitoredInfo, &bv, NULL );
911 } while ( ( slapi_int_pblock_get_next( &pCurrentPB ) == LDAP_SUCCESS )
912 && ( pCurrentPB != NULL ) );
917 #endif /* defined(LDAP_SLAPI) */