Back to index

openldap  2.4.31
monitor.c
Go to the documentation of this file.
00001 /* monitor.c - monitor ldap backend */
00002 /* $OpenLDAP$ */
00003 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00004  *
00005  * Copyright 2003-2012 The OpenLDAP Foundation.
00006  * Portions Copyright 1999-2003 Howard Chu.
00007  * Portions Copyright 2000-2003 Pierangelo Masarati.
00008  * All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without
00011  * modification, are permitted only as authorized by the OpenLDAP
00012  * Public License.
00013  *
00014  * A copy of this license is available in the file LICENSE in the
00015  * top-level directory of the distribution or, alternatively, at
00016  * <http://www.OpenLDAP.org/license.html>.
00017  */
00018 /* ACKNOWLEDGEMENTS:
00019  * This work was initially developed by the Howard Chu for inclusion
00020  * in OpenLDAP Software and subsequently enhanced by Pierangelo
00021  * Masarati.
00022  */
00023 
00024 #include "portable.h"
00025 
00026 #include <stdio.h>
00027 #include <ac/string.h>
00028 #include <ac/unistd.h>
00029 #include <ac/stdlib.h>
00030 #include <ac/errno.h>
00031 #include <sys/stat.h>
00032 #include "lutil.h"
00033 #include "back-ldap.h"
00034 
00035 #include "config.h"
00036 
00037 static ObjectClass          *oc_olmLDAPDatabase;
00038 
00039 static AttributeDescription *ad_olmDbURIList;
00040 
00041 /*
00042  * NOTE: there's some confusion in monitor OID arc;
00043  * by now, let's consider:
00044  * 
00045  * Subsystems monitor attributes   1.3.6.1.4.1.4203.666.1.55.0
00046  * Databases monitor attributes           1.3.6.1.4.1.4203.666.1.55.0.1
00047  * LDAP database monitor attributes       1.3.6.1.4.1.4203.666.1.55.0.1.2
00048  *
00049  * Subsystems monitor objectclasses       1.3.6.1.4.1.4203.666.3.16.0
00050  * Databases monitor objectclasses 1.3.6.1.4.1.4203.666.3.16.0.1
00051  * LDAP database monitor objectclasses    1.3.6.1.4.1.4203.666.3.16.0.1.2
00052  */
00053 
00054 static struct {
00055        char                 *name;
00056        char                 *oid;
00057 }             s_oid[] = {
00058        { "olmLDAPAttributes",                    "olmDatabaseAttributes:2" },
00059        { "olmLDAPObjectClasses",          "olmDatabaseObjectClasses:2" },
00060 
00061        { NULL }
00062 };
00063 
00064 static struct {
00065        char                 *desc;
00066        AttributeDescription **ad;
00067 }             s_at[] = {
00068        { "( olmLDAPAttributes:1 "
00069               "NAME ( 'olmDbURIList' ) "
00070               "DESC 'List of URIs a proxy is serving; can be modified run-time' "
00071               "SUP managedInfo )",
00072               &ad_olmDbURIList },
00073 
00074        { NULL }
00075 };
00076 
00077 static struct {
00078        char          *desc;
00079        ObjectClass   **oc;
00080 }             s_oc[] = {
00081        /* augments an existing object, so it must be AUXILIARY
00082         * FIXME: derive from some ABSTRACT "monitoredEntity"? */
00083        { "( olmLDAPObjectClasses:1 "
00084               "NAME ( 'olmLDAPDatabase' ) "
00085               "SUP top AUXILIARY "
00086               "MAY ( "
00087                      "olmDbURIList "
00088                      ") )",
00089               &oc_olmLDAPDatabase },
00090 
00091        { NULL }
00092 };
00093 
00094 static int
00095 ldap_back_monitor_info_destroy( ldapinfo_t * li )
00096 {
00097        if ( !BER_BVISNULL( &li->li_monitor_info.lmi_rdn ) )
00098               ch_free( li->li_monitor_info.lmi_rdn.bv_val );
00099        if ( !BER_BVISNULL( &li->li_monitor_info.lmi_nrdn ) )
00100               ch_free( li->li_monitor_info.lmi_nrdn.bv_val );
00101        if ( !BER_BVISNULL( &li->li_monitor_info.lmi_filter ) )
00102               ch_free( li->li_monitor_info.lmi_filter.bv_val );
00103        if ( !BER_BVISNULL( &li->li_monitor_info.lmi_more_filter ) )
00104               ch_free( li->li_monitor_info.lmi_more_filter.bv_val );
00105 
00106        memset( &li->li_monitor_info, 0, sizeof( li->li_monitor_info ) );
00107 
00108        return 0;
00109 }
00110 
00111 static int
00112 ldap_back_monitor_update(
00113        Operation     *op,
00114        SlapReply     *rs,
00115        Entry         *e,
00116        void          *priv )
00117 {
00118        ldapinfo_t           *li = (ldapinfo_t *)priv;
00119 
00120        Attribute            *a;
00121 
00122        /* update olmDbURIList */
00123        a = attr_find( e->e_attrs, ad_olmDbURIList );
00124        if ( a != NULL ) {
00125               struct berval bv;
00126 
00127               assert( a->a_vals != NULL );
00128               assert( !BER_BVISNULL( &a->a_vals[ 0 ] ) );
00129               assert( BER_BVISNULL( &a->a_vals[ 1 ] ) );
00130 
00131               ldap_pvt_thread_mutex_lock( &li->li_uri_mutex );
00132               if ( li->li_uri ) {
00133                      ber_str2bv( li->li_uri, 0, 0, &bv );
00134                      if ( !bvmatch( &a->a_vals[ 0 ], &bv ) ) {
00135                             ber_bvreplace( &a->a_vals[ 0 ], &bv );
00136                      }
00137               }
00138               ldap_pvt_thread_mutex_unlock( &li->li_uri_mutex );
00139        }
00140 
00141        return SLAP_CB_CONTINUE;
00142 }
00143 
00144 static int
00145 ldap_back_monitor_modify(
00146        Operation     *op,
00147        SlapReply     *rs,
00148        Entry         *e,
00149        void          *priv )
00150 {
00151        ldapinfo_t           *li = (ldapinfo_t *) priv;
00152        
00153        Attribute            *save_attrs = NULL;
00154        Modifications        *ml,
00155                             *ml_olmDbURIList = NULL;
00156        struct berval        ul = BER_BVNULL;
00157        int                  got = 0;
00158 
00159        for ( ml = op->orm_modlist; ml; ml = ml->sml_next ) {
00160               if ( ml->sml_desc == ad_olmDbURIList ) {
00161                      if ( ml_olmDbURIList != NULL ) {
00162                             rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
00163                             rs->sr_text = "conflicting modifications";
00164                             goto done;
00165                      }
00166 
00167                      if ( ml->sml_op != LDAP_MOD_REPLACE ) {
00168                             rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
00169                             rs->sr_text = "modification not allowed";
00170                             goto done;
00171                      }
00172 
00173                      ml_olmDbURIList = ml;
00174                      got++;
00175                      continue;
00176               }
00177        }
00178 
00179        if ( got == 0 ) {
00180               return SLAP_CB_CONTINUE;
00181        }
00182 
00183        save_attrs = attrs_dup( e->e_attrs );
00184 
00185        if ( ml_olmDbURIList != NULL ) {
00186               Attribute     *a = NULL;
00187               LDAPURLDesc   *ludlist = NULL;
00188               int           rc;
00189 
00190               ml = ml_olmDbURIList;
00191               assert( ml->sml_nvalues != NULL );
00192 
00193               if ( BER_BVISNULL( &ml->sml_nvalues[ 0 ] ) ) {
00194                      rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
00195                      rs->sr_text = "no value provided";
00196                      goto done;
00197               }
00198 
00199               if ( !BER_BVISNULL( &ml->sml_nvalues[ 1 ] ) ) {
00200                      rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
00201                      rs->sr_text = "multiple values provided";
00202                      goto done;
00203               }
00204 
00205               rc = ldap_url_parselist_ext( &ludlist,
00206                      ml->sml_nvalues[ 0 ].bv_val, NULL,
00207                      LDAP_PVT_URL_PARSE_NOEMPTY_HOST
00208                             | LDAP_PVT_URL_PARSE_DEF_PORT );
00209               if ( rc != LDAP_URL_SUCCESS ) {
00210                      rs->sr_err = LDAP_INVALID_SYNTAX;
00211                      rs->sr_text = "unable to parse URI list";
00212                      goto done;
00213               }
00214 
00215               ul.bv_val = ldap_url_list2urls( ludlist );
00216               ldap_free_urllist( ludlist );
00217               if ( ul.bv_val == NULL ) {
00218                      rs->sr_err = LDAP_OTHER;
00219                      goto done;
00220               }
00221               ul.bv_len = strlen( ul.bv_val );
00222               
00223               a = attr_find( e->e_attrs, ad_olmDbURIList );
00224               if ( a != NULL ) {
00225                      if ( a->a_nvals == a->a_vals ) {
00226                             a->a_nvals = ch_calloc( sizeof( struct berval ), 2 );
00227                      }
00228 
00229                      ber_bvreplace( &a->a_vals[ 0 ], &ul );
00230                      ber_bvreplace( &a->a_nvals[ 0 ], &ul );
00231 
00232               } else {
00233                      attr_merge_normalize_one( e, ad_olmDbURIList, &ul, NULL );
00234               }
00235        }
00236 
00237        /* apply changes */
00238        if ( !BER_BVISNULL( &ul ) ) {
00239               ldap_pvt_thread_mutex_lock( &li->li_uri_mutex );
00240               if ( li->li_uri ) {
00241                      ch_free( li->li_uri );
00242               }
00243               li->li_uri = ul.bv_val;
00244               ldap_pvt_thread_mutex_unlock( &li->li_uri_mutex );
00245 
00246               BER_BVZERO( &ul );
00247        }
00248 
00249 done:;
00250        if ( !BER_BVISNULL( &ul ) ) {
00251               ldap_memfree( ul.bv_val );
00252        }
00253 
00254        if ( rs->sr_err == LDAP_SUCCESS ) {
00255               attrs_free( save_attrs );
00256               return SLAP_CB_CONTINUE;
00257        }
00258 
00259        attrs_free( e->e_attrs );
00260        e->e_attrs = save_attrs;
00261 
00262        return rs->sr_err;
00263 }
00264 
00265 static int
00266 ldap_back_monitor_free(
00267        Entry         *e,
00268        void          **priv )
00269 {
00270        ldapinfo_t           *li = (ldapinfo_t *)(*priv);
00271 
00272        *priv = NULL;
00273 
00274        if ( !slapd_shutdown && !BER_BVISNULL( &li->li_monitor_info.lmi_rdn ) ) {
00275               ldap_back_monitor_info_destroy( li );
00276        }
00277 
00278        return SLAP_CB_CONTINUE;
00279 }
00280 
00281 static int
00282 ldap_back_monitor_conn_create(
00283        Operation     *op,
00284        SlapReply     *rs,
00285        struct berval *ndn,
00286        Entry         *e_parent,
00287        Entry         **ep )
00288 {
00289        monitor_entry_t             *mp_parent;
00290        ldap_monitor_info_t  *lmi;
00291        ldapinfo_t           *li;
00292 
00293        assert( e_parent->e_private != NULL );
00294 
00295        mp_parent = e_parent->e_private;
00296        lmi = (ldap_monitor_info_t *)mp_parent->mp_info;
00297        li = lmi->lmi_li;
00298 
00299        /* do the hard work! */
00300 
00301        return 1;
00302 }
00303 
00304 /*
00305  * call from within ldap_back_initialize()
00306  */
00307 static int
00308 ldap_back_monitor_initialize( void )
00309 {
00310        int           i, code;
00311        ConfigArgs c;
00312        char   *argv[ 3 ];
00313 
00314        static int    ldap_back_monitor_initialized = 0;
00315 
00316        /* set to 0 when successfully initialized; otherwise, remember failure */
00317        static int    ldap_back_monitor_initialized_failure = 1;
00318 
00319        /* register schema here; if compiled as dynamic object,
00320         * must be loaded __after__ back_monitor.la */
00321 
00322        if ( ldap_back_monitor_initialized++ ) {
00323               return ldap_back_monitor_initialized_failure;
00324        }
00325 
00326        if ( backend_info( "monitor" ) == NULL ) {
00327               return -1;
00328        }
00329 
00330        argv[ 0 ] = "back-ldap monitor";
00331        c.argv = argv;
00332        c.argc = 3;
00333        c.fname = argv[0];
00334        for ( i = 0; s_oid[ i ].name; i++ ) {
00335        
00336               argv[ 1 ] = s_oid[ i ].name;
00337               argv[ 2 ] = s_oid[ i ].oid;
00338 
00339               if ( parse_oidm( &c, 0, NULL ) != 0 ) {
00340                      Debug( LDAP_DEBUG_ANY,
00341                             "ldap_back_monitor_initialize: unable to add "
00342                             "objectIdentifier \"%s=%s\"\n",
00343                             s_oid[ i ].name, s_oid[ i ].oid, 0 );
00344                      return 2;
00345               }
00346        }
00347 
00348        for ( i = 0; s_at[ i ].desc != NULL; i++ ) {
00349               code = register_at( s_at[ i ].desc, s_at[ i ].ad, 1 );
00350               if ( code != LDAP_SUCCESS ) {
00351                      Debug( LDAP_DEBUG_ANY,
00352                             "ldap_back_monitor_initialize: register_at failed for attributeType (%s)\n",
00353                             s_at[ i ].desc, 0, 0 );
00354                      return 3;
00355 
00356               } else {
00357                      (*s_at[ i ].ad)->ad_type->sat_flags |= SLAP_AT_HIDE;
00358               }
00359        }
00360 
00361        for ( i = 0; s_oc[ i ].desc != NULL; i++ ) {
00362               code = register_oc( s_oc[ i ].desc, s_oc[ i ].oc, 1 );
00363               if ( code != LDAP_SUCCESS ) {
00364                      Debug( LDAP_DEBUG_ANY,
00365                             "ldap_back_monitor_initialize: register_oc failed for objectClass (%s)\n",
00366                             s_oc[ i ].desc, 0, 0 );
00367                      return 4;
00368 
00369               } else {
00370                      (*s_oc[ i ].oc)->soc_flags |= SLAP_OC_HIDE;
00371               }
00372        }
00373 
00374        return ( ldap_back_monitor_initialized_failure = LDAP_SUCCESS );
00375 }
00376 
00377 /*
00378  * call from within ldap_back_db_init()
00379  */
00380 int
00381 ldap_back_monitor_db_init( BackendDB *be )
00382 {
00383        int    rc;
00384 
00385        rc = ldap_back_monitor_initialize();
00386        if ( rc != LDAP_SUCCESS ) {
00387               return rc;
00388        }
00389 
00390 #if 0  /* uncomment to turn monitoring on by default */
00391        SLAP_DBFLAGS( be ) |= SLAP_DBFLAG_MONITORING;
00392 #endif
00393 
00394        return 0;
00395 }
00396 
00397 /*
00398  * call from within ldap_back_db_open()
00399  */
00400 int
00401 ldap_back_monitor_db_open( BackendDB *be )
00402 {
00403        ldapinfo_t           *li = (ldapinfo_t *) be->be_private;
00404        char                 buf[ BACKMONITOR_BUFSIZE ];
00405        Entry                *e = NULL;
00406        monitor_callback_t   *cb = NULL;
00407        struct berval        suffix, *filter, *base;
00408        char                 *ptr;
00409        time_t               now;
00410        char                 timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
00411        struct berval               timestamp;
00412        int                  rc = 0;
00413        BackendInfo          *mi;
00414        monitor_extra_t             *mbe;
00415 
00416        if ( !SLAP_DBMONITORING( be ) ) {
00417               return 0;
00418        }
00419 
00420        /* check if monitor is configured and usable */
00421        mi = backend_info( "monitor" );
00422        if ( !mi || !mi->bi_extra ) {
00423               SLAP_DBFLAGS( be ) ^= SLAP_DBFLAG_MONITORING;
00424               return 0;
00425        }
00426        mbe = mi->bi_extra;
00427 
00428        /* don't bother if monitor is not configured */
00429        if ( !mbe->is_configured() ) {
00430               static int warning = 0;
00431 
00432               if ( warning++ == 0 ) {
00433                      Debug( LDAP_DEBUG_ANY, "ldap_back_monitor_db_open: "
00434                             "monitoring disabled; "
00435                             "configure monitor database to enable\n",
00436                             0, 0, 0 );
00437               }
00438 
00439               return 0;
00440        }
00441 
00442        /* set up the fake subsystem that is used to create
00443         * the volatile connection entries */
00444        li->li_monitor_info.lmi_mss.mss_name = "back-ldap";
00445        li->li_monitor_info.lmi_mss.mss_flags = MONITOR_F_VOLATILE_CH;
00446        li->li_monitor_info.lmi_mss.mss_create = ldap_back_monitor_conn_create;
00447 
00448        li->li_monitor_info.lmi_li = li;
00449        li->li_monitor_info.lmi_scope = LDAP_SCOPE_SUBORDINATE;
00450        base = &li->li_monitor_info.lmi_base;
00451        BER_BVSTR( base, "cn=databases,cn=monitor" );
00452        filter = &li->li_monitor_info.lmi_filter;
00453        BER_BVZERO( filter );
00454 
00455        suffix.bv_len = ldap_bv2escaped_filter_value_len( &be->be_nsuffix[ 0 ] );
00456        if ( suffix.bv_len == be->be_nsuffix[ 0 ].bv_len ) {
00457               suffix = be->be_nsuffix[ 0 ];
00458 
00459        } else {
00460               ldap_bv2escaped_filter_value( &be->be_nsuffix[ 0 ], &suffix );
00461        }
00462        
00463        filter->bv_len = STRLENOF( "(&" )
00464               + li->li_monitor_info.lmi_more_filter.bv_len
00465               + STRLENOF( "(monitoredInfo=" )
00466               + strlen( be->bd_info->bi_type )
00467               + STRLENOF( ")(!(monitorOverlay=" )
00468               + strlen( be->bd_info->bi_type )
00469               + STRLENOF( "))(namingContexts:distinguishedNameMatch:=" )
00470               + suffix.bv_len + STRLENOF( "))" );
00471        ptr = filter->bv_val = ch_malloc( filter->bv_len + 1 );
00472        ptr = lutil_strcopy( ptr, "(&" );
00473        ptr = lutil_strncopy( ptr, li->li_monitor_info.lmi_more_filter.bv_val,
00474               li->li_monitor_info.lmi_more_filter.bv_len );
00475        ptr = lutil_strcopy( ptr, "(monitoredInfo=" );
00476        ptr = lutil_strcopy( ptr, be->bd_info->bi_type );
00477        ptr = lutil_strcopy( ptr, ")(!(monitorOverlay=" );
00478        ptr = lutil_strcopy( ptr, be->bd_info->bi_type );
00479        ptr = lutil_strcopy( ptr, "))(namingContexts:distinguishedNameMatch:=" );
00480        ptr = lutil_strncopy( ptr, suffix.bv_val, suffix.bv_len );
00481        ptr = lutil_strcopy( ptr, "))" );
00482        ptr[ 0 ] = '\0';
00483        assert( ptr == &filter->bv_val[ filter->bv_len ] );
00484 
00485        if ( suffix.bv_val != be->be_nsuffix[ 0 ].bv_val ) {
00486               ch_free( suffix.bv_val );
00487        }
00488 
00489        now = slap_get_time();
00490        timestamp.bv_val = timebuf;
00491        timestamp.bv_len = sizeof( timebuf );
00492        slap_timestamp( &now, &timestamp );
00493 
00494        /* caller (e.g. an overlay based on back-ldap) may want to use
00495         * a different RDN... */
00496        if ( BER_BVISNULL( &li->li_monitor_info.lmi_rdn ) ) {
00497               ber_str2bv( "cn=Connections", 0, 1, &li->li_monitor_info.lmi_rdn );
00498        }
00499 
00500        ptr = ber_bvchr( &li->li_monitor_info.lmi_rdn, '=' );
00501        assert( ptr != NULL );
00502        ptr[ 0 ] = '\0';
00503        ptr++;
00504 
00505        snprintf( buf, sizeof( buf ),
00506               "dn: %s=%s\n"
00507               "objectClass: monitorContainer\n"
00508               "%s: %s\n"
00509               "creatorsName: %s\n"
00510               "createTimestamp: %s\n"
00511               "modifiersName: %s\n"
00512               "modifyTimestamp: %s\n",
00513               li->li_monitor_info.lmi_rdn.bv_val,
00514                      ptr,
00515               li->li_monitor_info.lmi_rdn.bv_val,
00516                      ptr,
00517               BER_BVISNULL( &be->be_rootdn ) ? SLAPD_ANONYMOUS : be->be_rootdn.bv_val,
00518               timestamp.bv_val,
00519               BER_BVISNULL( &be->be_rootdn ) ? SLAPD_ANONYMOUS : be->be_rootdn.bv_val,
00520               timestamp.bv_val );
00521        e = str2entry( buf );
00522        if ( e == NULL ) {
00523               rc = -1;
00524               goto cleanup;
00525        }
00526 
00527        ptr[ -1 ] = '=';
00528 
00529        /* add labeledURI and special, modifiable URI value */
00530        if ( li->li_uri != NULL ) {
00531               struct berval bv;
00532               LDAPURLDesc   *ludlist = NULL;
00533               int           rc;
00534 
00535               rc = ldap_url_parselist_ext( &ludlist,
00536                      li->li_uri, NULL,
00537                      LDAP_PVT_URL_PARSE_NOEMPTY_HOST
00538                             | LDAP_PVT_URL_PARSE_DEF_PORT );
00539               if ( rc != LDAP_URL_SUCCESS ) {
00540                      Debug( LDAP_DEBUG_ANY,
00541                             "ldap_back_monitor_db_open: "
00542                             "unable to parse URI list (ignored)\n",
00543                             0, 0, 0 );
00544               } else {
00545                      for ( ; ludlist != NULL; ) {
00546                             LDAPURLDesc   *next = ludlist->lud_next;
00547 
00548                             bv.bv_val = ldap_url_desc2str( ludlist );
00549                             assert( bv.bv_val != NULL );
00550                             ldap_free_urldesc( ludlist );
00551                             bv.bv_len = strlen( bv.bv_val );
00552                             attr_merge_normalize_one( e, slap_schema.si_ad_labeledURI,
00553                                    &bv, NULL );
00554                             ch_free( bv.bv_val );
00555 
00556                             ludlist = next;
00557                      }
00558               }
00559               
00560               ber_str2bv( li->li_uri, 0, 0, &bv );
00561               attr_merge_normalize_one( e, ad_olmDbURIList,
00562                      &bv, NULL );
00563        }
00564 
00565        ber_dupbv( &li->li_monitor_info.lmi_nrdn, &e->e_nname );
00566 
00567        cb = ch_calloc( sizeof( monitor_callback_t ), 1 );
00568        cb->mc_update = ldap_back_monitor_update;
00569        cb->mc_modify = ldap_back_monitor_modify;
00570        cb->mc_free = ldap_back_monitor_free;
00571        cb->mc_private = (void *)li;
00572 
00573        rc = mbe->register_entry_parent( e, cb,
00574               (monitor_subsys_t *)&li->li_monitor_info,
00575               MONITOR_F_VOLATILE_CH,
00576               base, LDAP_SCOPE_SUBORDINATE, filter );
00577 
00578 cleanup:;
00579        if ( rc != 0 ) {
00580               if ( cb != NULL ) {
00581                      ch_free( cb );
00582                      cb = NULL;
00583               }
00584 
00585               if ( e != NULL ) {
00586                      entry_free( e );
00587                      e = NULL;
00588               }
00589 
00590               if ( !BER_BVISNULL( filter ) ) {
00591                      ch_free( filter->bv_val );
00592                      BER_BVZERO( filter );
00593               }
00594        }
00595 
00596        /* store for cleanup */
00597        li->li_monitor_info.lmi_cb = (void *)cb;
00598 
00599        if ( e != NULL ) {
00600               entry_free( e );
00601        }
00602 
00603        return rc;
00604 }
00605 
00606 /*
00607  * call from within ldap_back_db_close()
00608  */
00609 int
00610 ldap_back_monitor_db_close( BackendDB *be )
00611 {
00612        ldapinfo_t           *li = (ldapinfo_t *) be->be_private;
00613 
00614        if ( li && !BER_BVISNULL( &li->li_monitor_info.lmi_filter ) ) {
00615               BackendInfo          *mi;
00616               monitor_extra_t             *mbe;
00617 
00618               /* check if monitor is configured and usable */
00619               mi = backend_info( "monitor" );
00620               if ( mi && mi->bi_extra ) {
00621                      mbe = mi->bi_extra;
00622 
00623                      mbe->unregister_entry_parent(
00624                             &li->li_monitor_info.lmi_nrdn,
00625                             (monitor_callback_t *)li->li_monitor_info.lmi_cb,
00626                             &li->li_monitor_info.lmi_base,
00627                             li->li_monitor_info.lmi_scope,
00628                             &li->li_monitor_info.lmi_filter );
00629               }
00630        }
00631 
00632        return 0;
00633 }
00634 
00635 /*
00636  * call from within ldap_back_db_destroy()
00637  */
00638 int
00639 ldap_back_monitor_db_destroy( BackendDB *be )
00640 {
00641        ldapinfo_t           *li = (ldapinfo_t *) be->be_private;
00642 
00643        if ( li ) {
00644               (void)ldap_back_monitor_info_destroy( li );
00645        }
00646 
00647        return 0;
00648 }
00649