]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-monitor/operation.c
Add search no-op support.
[openldap] / servers / slapd / back-monitor / operation.c
index 7108669e8f1fa450ecc93a5c661055d20dfdca72..7dbb0a51ad10f3c24be2debf3e98a86de53ead6e 100644 (file)
@@ -1,12 +1,9 @@
 /* operation.c - deal with operation subsystem */
 /*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
- * Copyright 2001 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
- * 
  * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
  * 
  * This work has beed deveolped for the OpenLDAP Foundation 
@@ -51,24 +48,24 @@ monitor_subsys_ops_init(
        Entry                   *e, *e_tmp, *e_op;
        struct monitorentrypriv *mp;
        char                    buf[1024];
-       struct berval           val, *bv[2] = { &val, NULL };
+       struct berval           bv[2];
 
        assert( be != NULL );
 
        mi = ( struct monitorinfo * )be->be_private;
 
        if ( monitor_cache_get( mi,
-                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn, &e_op ) ) {
+                       &monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn, &e_op ) ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
                        "monitor_subsys_ops_init: "
                        "unable to get entry '%s'\n",
-                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn->bv_val ));
+                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val ));
 #else
                Debug( LDAP_DEBUG_ANY,
                        "monitor_subsys_ops_init: "
                        "unable to get entry '%s'\n%s%s",
-                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn->bv_val, 
+                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val, 
                        "", "" );
 #endif
                return( -1 );
@@ -81,15 +78,9 @@ monitor_subsys_ops_init(
         */
        snprintf( buf, sizeof( buf ),
                        "dn: cn=Initiated,%s\n"
-                       "objectClass: top\n"
-                       "objectClass: LDAPsubEntry\n"
-#ifdef SLAPD_MONITORSUBENTRY
-                       "objectClass: monitorSubEntry\n"
-#else /* !SLAPD_MONITORSUBENTRY */
-                       "objectClass: extensibleObject\n"
-#endif /* !SLAPD_MONITORSUBENTRY */
+                       SLAPD_MONITOR_OBJECTCLASSES
                        "cn: Initiated\n",
-                       monitor_subsys[SLAPD_MONITOR_OPS].mss_dn->bv_val );
+                       monitor_subsys[SLAPD_MONITOR_OPS].mss_dn.bv_val );
 
        e = str2entry( buf );
        if ( e == NULL ) {
@@ -97,19 +88,20 @@ monitor_subsys_ops_init(
                LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
                        "monitor_subsys_ops_init: "
                        "unable to create entry 'cn=Initiated,%s'\n",
-                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn->bv_val ));
+                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val ));
 #else
                Debug( LDAP_DEBUG_ANY,
                        "monitor_subsys_ops_init: "
                        "unable to create entry 'cn=Initiated,%s'\n%s%s",
-                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn->bv_val,
+                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val,
                        "", "" );
 #endif
                return( -1 );
        }
        
-       val.bv_val = "0";
-       val.bv_len = 1;
+       bv[1].bv_val = NULL;
+       bv[0].bv_val = "0";
+       bv[0].bv_len = 1;
        attr_merge( e, monitor_ad_desc, bv );
        
        mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
@@ -125,12 +117,12 @@ monitor_subsys_ops_init(
                LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
                        "monitor_subsys_ops_init: "
                        "unable to add entry 'cn=Initiated,%s'\n",
-                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn->bv_val ));
+                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val ));
 #else
                Debug( LDAP_DEBUG_ANY,
                        "monitor_subsys_ops_init: "
                        "unable to add entry 'cn=Initiated,%s'\n%s%s",
-                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn->bv_val,
+                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val,
                        "", "" );
 #endif
                return( -1 );
@@ -143,15 +135,9 @@ monitor_subsys_ops_init(
         */
        snprintf( buf, sizeof( buf ),
                        "dn: cn=Completed,%s\n"
-                       "objectClass: top\n"
-                       "objectClass: LDAPsubEntry\n"
-#ifdef SLAPD_MONITORSUBENTRY
-                       "objectClass: monitorSubEntry\n"
-#else /* !SLAPD_MONITORSUBENTRY */
-                       "objectClass: extensibleObject\n"
-#endif /* !SLAPD_MONITORSUBENTRY */
+                       SLAPD_MONITOR_OBJECTCLASSES
                        "cn: Completed\n",
-                       monitor_subsys[SLAPD_MONITOR_OPS].mss_dn->bv_val );
+                       monitor_subsys[SLAPD_MONITOR_OPS].mss_dn.bv_val );
 
        e = str2entry( buf );
        if ( e == NULL ) {
@@ -159,19 +145,19 @@ monitor_subsys_ops_init(
                LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
                        "monitor_subsys_ops_init: "
                        "unable to create entry 'cn=Completed,%s'\n",
-                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn->bv_val ));
+                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val ));
 #else
                Debug( LDAP_DEBUG_ANY,
                        "monitor_subsys_ops_init: "
                        "unable to create entry 'cn=Completed,%s'\n%s%s",
-                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn->bv_val,
+                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val,
                        "", "" );
 #endif
                return( -1 );
        }
 
-       val.bv_val = "0";
-       val.bv_len = 1;
+       bv[0].bv_val = "0";
+       bv[0].bv_len = 1;
        attr_merge( e, monitor_ad_desc, bv );
        
        mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
@@ -187,12 +173,12 @@ monitor_subsys_ops_init(
                LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
                        "monitor_subsys_ops_init: "
                        "unable to add entry 'cn=Completed,%s'\n",
-                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn->bv_val ));
+                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val ));
 #else
                Debug( LDAP_DEBUG_ANY,
                        "monitor_subsys_ops_init: "
                        "unable to add entry 'cn=Completed,%s'\n%s%s",
-                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn->bv_val,
+                       monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val,
                        "", "" );
 #endif
                return( -1 );
@@ -242,8 +228,8 @@ monitor_subsys_ops_update(
                }
 
                snprintf( buf, sizeof( buf ), "%ld", n );
-               ber_bvfree( a->a_vals[ 0 ] );
-               a->a_vals[ 0 ] = ber_bvstrdup( buf );
+               free( a->a_vals[ 0 ].bv_val );
+               ber_str2bv( buf, 0, 1, a->a_vals );
        }
 
        return( 0 );