]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-monitor/init.c
honor disclose
[openldap] / servers / slapd / back-monitor / init.c
index 23d93e0c022b7b9cdb966bfe2afa0263ef9d24ff..8747e2a8912bcbc2a36b1e308f76fb4a1afcbb72 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2001-2004 The OpenLDAP Foundation.
+ * Copyright 2001-2005 The OpenLDAP Foundation.
  * Portions Copyright 2001-2003 Pierangelo Masarati.
  * All rights reserved.
  *
@@ -160,22 +160,6 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                }, { NULL }
 };
 
-#if SLAPD_MONITOR == SLAPD_MOD_DYNAMIC
-
-int
-init_module( int argc, char *argv[] )
-{
-       BackendInfo bi;
-
-       memset( &bi, '\0', sizeof(bi) );
-       bi.bi_type = "monitor";
-       bi.bi_init = monitor_back_initialize;
-       backend_add( &bi );
-       return 0;
-}
-
-#endif /* SLAPD_MONITOR */
-
 int
 monitor_back_register_subsys( monitor_subsys_t *ms )
 {
@@ -389,7 +373,8 @@ monitor_filter2ndn( struct berval *base, int scope, struct berval *filter,
                struct berval *ndn )
 {
        Connection      conn = { 0 };
-       Operation       op = { 0 };
+       char opbuf[OPERATION_BUFFER_SIZE];
+       Operation       *op;
        SlapReply       rs = { 0 };
        slap_callback   cb = { NULL, monitor_filter2ndn_cb, NULL, NULL };
        AttributeName   anlist[ 2 ];
@@ -401,52 +386,53 @@ monitor_filter2ndn( struct berval *base, int scope, struct berval *filter,
                return -1;
        }
 
-       connection_fake_init( &conn, &op, &conn );
+       op = (Operation *)opbuf;
+       connection_fake_init( &conn, op, &conn );
 
-       op.o_tag = LDAP_REQ_SEARCH;
+       op->o_tag = LDAP_REQ_SEARCH;
 
        /* use global malloc for now */
-       op.o_tmpmemctx = NULL;
-       op.o_tmpmfuncs = &ch_mfuncs;
+       op->o_tmpmemctx = NULL;
+       op->o_tmpmfuncs = &ch_mfuncs;
 
-       op.o_bd = be_monitor;
+       op->o_bd = be_monitor;
        if ( base == NULL || BER_BVISNULL( base ) ) {
-               ber_dupbv_x( &op.o_req_dn, &op.o_bd->be_suffix[ 0 ],
-                               op.o_tmpmemctx );
-               ber_dupbv_x( &op.o_req_ndn, &op.o_bd->be_nsuffix[ 0 ],
-                               op.o_tmpmemctx );
+               ber_dupbv_x( &op->o_req_dn, &op->o_bd->be_suffix[ 0 ],
+                               op->o_tmpmemctx );
+               ber_dupbv_x( &op->o_req_ndn, &op->o_bd->be_nsuffix[ 0 ],
+                               op->o_tmpmemctx );
 
        } else {
-               if ( dnPrettyNormal( NULL, base, &op.o_req_dn, &op.o_req_ndn,
-                                       op.o_tmpmemctx ) ) {
+               if ( dnPrettyNormal( NULL, base, &op->o_req_dn, &op->o_req_ndn,
+                                       op->o_tmpmemctx ) ) {
                        /* error */
                }
        }
 
-       op.o_callback = &cb;
+       op->o_callback = &cb;
        cb.sc_private = (void *)ndn;
 
-       op.ors_scope = scope;
-       ber_dupbv_x( &op.ors_filterstr, filter, op.o_tmpmemctx );
-       op.ors_filter = str2filter_x( &op, filter->bv_val );
-       op.ors_attrs = anlist;
+       op->ors_scope = scope;
+       ber_dupbv_x( &op->ors_filterstr, filter, op->o_tmpmemctx );
+       op->ors_filter = str2filter_x( op, filter->bv_val );
+       op->ors_attrs = anlist;
        BER_BVSTR( &anlist[ 0 ].an_name, LDAP_NO_ATTRS );
        BER_BVZERO( &anlist[ 1 ].an_name );
-       op.ors_attrsonly = 0;
-       op.ors_tlimit = SLAP_NO_LIMIT;
-       op.ors_slimit = 1;
-       op.ors_limit = NULL;
-       op.ors_deref = LDAP_DEREF_NEVER;
+       op->ors_attrsonly = 0;
+       op->ors_tlimit = SLAP_NO_LIMIT;
+       op->ors_slimit = 1;
+       op->ors_limit = NULL;
+       op->ors_deref = LDAP_DEREF_NEVER;
 
-       op.o_nocaching = 1;
-       op.o_managedsait = 1;
+       op->o_nocaching = 1;
+       op->o_managedsait = SLAP_CONTROL_NONCRITICAL;
 
-       rc = op.o_bd->be_search( &op, &rs );
+       rc = op->o_bd->be_search( op, &rs );
 
-       filter_free_x( &op, op.ors_filter );
-       op.o_tmpfree( op.ors_filterstr.bv_val, op.o_tmpmemctx );
-       op.o_tmpfree( op.o_req_dn.bv_val, op.o_tmpmemctx );
-       op.o_tmpfree( op.o_req_ndn.bv_val, op.o_tmpmemctx );
+       filter_free_x( op, op->ors_filter );
+       op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
+       op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
+       op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
 
        if ( rc != 0 ) {
                return rc;
@@ -685,7 +671,6 @@ monitor_back_initialize(
        monitor_subsys_t        *ms;
        static char             *controls[] = {
                LDAP_CONTROL_MANAGEDSAIT,
-               LDAP_CONTROL_VALUESRETURNFILTER,
                NULL
        };
 
@@ -814,7 +799,7 @@ monitor_back_db_init(
                        "DESC 'monitor managed entity class' "
                        "SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
                        offsetof(monitor_info_t, mi_oc_managedObject) },
-               { "monitoredObject", "( 1.3.6.1.4.1.4203.666.3.13 "
+               { "monitoredObject", "( 1.3.6.1.4.1.4203.666.3.14 "
                        "NAME 'monitoredObject' "
                        "DESC 'monitor monitored entity class' "
                        "SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
@@ -1050,7 +1035,7 @@ monitor_back_db_init(
                        return -1;
                }
 
-               code = at_add(at, &err);
+               code = at_add(at, 0, NULL, &err);
                if ( code ) {
                        Debug( LDAP_DEBUG_ANY, "monitor_back_db_init: "
                                "%s in attributeType \"%s\"\n",
@@ -1093,7 +1078,7 @@ monitor_back_db_init(
                        return -1;
                }
 
-               code = oc_add(oc, 0, &err);
+               code = oc_add(oc, 0, NULL, &err);
                if ( code ) {
                        Debug( LDAP_DEBUG_ANY,
                                "objectclass \"%s\": %s \"%s\"\n" ,
@@ -1471,3 +1456,10 @@ monitor_back_db_destroy(
        return 0;
 }
 
+#if SLAPD_MONITOR == SLAPD_MOD_DYNAMIC
+
+/* conditionally define the init_module() function */
+SLAP_BACKEND_INIT_MODULE( monitor )
+
+#endif /* SLAPD_MONITOR == SLAPD_MOD_DYNAMIC */
+