]> git.sur5r.net Git - openldap/commitdiff
either pass normalized values to attr_merge*() or call attr_merge_normalize*() (fixes...
authorPierangelo Masarati <ando@openldap.org>
Thu, 21 Apr 2005 21:05:38 +0000 (21:05 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 21 Apr 2005 21:05:38 +0000 (21:05 +0000)
servers/slapd/back-monitor/backend.c
servers/slapd/back-monitor/conn.c
servers/slapd/back-monitor/database.c
servers/slapd/back-monitor/listener.c
servers/slapd/back-monitor/log.c
servers/slapd/back-monitor/operation.c
servers/slapd/back-monitor/overlay.c
servers/slapd/back-monitor/rww.c
servers/slapd/back-monitor/sent.c

index b9e608435807ae3a4d5a91e72e354e51999cbb6f..1c083afe870195516b33927e9e739536f3e6386d 100644 (file)
@@ -108,9 +108,7 @@ monitor_subsys_backend_init(
                        return( -1 );
                }
                
-               bv.bv_val = bi->bi_type;
-               bv.bv_len = strlen( bv.bv_val );
-
+               ber_str2bv( bi->bi_type, 0, 0, &bv );
                attr_merge_normalize_one( e, mi->mi_ad_monitoredInfo,
                                &bv, NULL );
                attr_merge_normalize_one( e_backend, mi->mi_ad_monitoredInfo,
@@ -120,9 +118,9 @@ monitor_subsys_backend_init(
                        int j;
 
                        for ( j = 0; bi->bi_controls[ j ]; j++ ) {
-                               bv.bv_val = bi->bi_controls[ j ];
-                               bv.bv_len = strlen( bv.bv_val );
-                               attr_merge_one( e, slap_schema.si_ad_supportedControl, &bv, NULL );
+                               ber_str2bv( bi->bi_controls[ j ], 0, 0, &bv );
+                               attr_merge_one( e, slap_schema.si_ad_supportedControl,
+                                               &bv, &bv );
                        }
                }
 
@@ -139,9 +137,8 @@ monitor_subsys_backend_init(
 
                        snprintf( buf, sizeof( buf ), "cn=Database %d,%s",
                                        j, ms_database->mss_dn.bv_val );
-                       dn.bv_val = buf;
-                       dn.bv_len = strlen( buf );
 
+                       ber_str2bv( buf, 0, 0, &dn );
                        attr_merge_normalize_one( e, mi->mi_ad_seeAlso,
                                        &dn, NULL );
                }
index 40d0a58b91a8121f5901fde17b4f64c9a50093a9..549c72c880f5c7db311f26175df955674e0b6639 100644 (file)
@@ -86,7 +86,7 @@ monitor_subsys_conn_init(
        }
        
        BER_BVSTR( &bv, "0" );
-       attr_merge_one( e, mi->mi_ad_monitorCounter, &bv, NULL );
+       attr_merge_one( e, mi->mi_ad_monitorCounter, &bv, &bv );
        
        mp = monitor_entrypriv_create();
        if ( mp == NULL ) {
@@ -139,7 +139,7 @@ monitor_subsys_conn_init(
        }
        
        BER_BVSTR( &bv, "0" );
-       attr_merge_one( e, mi->mi_ad_monitorCounter, &bv, NULL );
+       attr_merge_one( e, mi->mi_ad_monitorCounter, &bv, &bv );
        
        mp = monitor_entrypriv_create();
        if ( mp == NULL ) {
@@ -377,15 +377,13 @@ conn_create(
                buf3
                );
 
-       bv.bv_val = buf;
-       bv.bv_len = strlen( buf );
-       attr_merge_one( e, mi->mi_ad_monitoredInfo, &bv, NULL );
+       ber_str2bv( buf, 0, 0, &bv );
+       attr_merge_one( e, mi->mi_ad_monitoredInfo, &bv, &bv );
 
        /* connection number */
        snprintf( buf, sizeof( buf ), "%ld", c->c_connid );
-       bv.bv_val = buf;
-       bv.bv_len = strlen( buf );
-       attr_merge_one( e, mi->mi_ad_monitorConnectionNumber, &bv, NULL );
+       ber_str2bv( buf, 0, 0, &bv );
+       attr_merge_one( e, mi->mi_ad_monitorConnectionNumber, &bv, &bv );
 
        /* authz DN */
        attr_merge_one( e, mi->mi_ad_monitorConnectionAuthzDN,
@@ -393,11 +391,11 @@ conn_create(
 
        /* local address */
        attr_merge_one( e, mi->mi_ad_monitorConnectionLocalAddress,
-                       &c->c_sock_name, NULL );
+                       &c->c_sock_name, &bv );
 
        /* peer address */
        attr_merge_one( e, mi->mi_ad_monitorConnectionPeerAddress,
-                       &c->c_peer_name, NULL );
+                       &c->c_peer_name, &bv );
 
        mp = monitor_entrypriv_create();
        if ( mp == NULL ) {
index 8aa38f6c523af5f428740f8b89d3294e3fdb52c8..8d5ee6076b80f0d92708e75971569cc6e2e984d3 100644 (file)
@@ -81,7 +81,7 @@ init_readOnly( monitor_info_t *mi, Entry *e, slap_mask_t restrictops )
        struct berval   *tf = ( ( restrictops & SLAP_RESTRICT_OP_MASK ) == SLAP_RESTRICT_OP_WRITES ) ?
                (struct berval *)&slap_true_bv : (struct berval *)&slap_false_bv;
 
-       return attr_merge_one( e, mi->mi_ad_readOnly, tf, NULL );
+       return attr_merge_one( e, mi->mi_ad_readOnly, tf, tf );
 }
 
 static int
@@ -92,7 +92,8 @@ init_restrictedOperation( monitor_info_t *mi, Entry *e, slap_mask_t restrictops
        for ( i = 0; restricted_ops[ i ].op.bv_val; i++ ) {
                if ( restrictops & restricted_ops[ i ].tag ) {
                        rc = attr_merge_one( e, mi->mi_ad_restrictedOperation,
-                                       &restricted_ops[ i ].op, NULL );
+                                       &restricted_ops[ i ].op,
+                                       &restricted_ops[ i ].op );
                        if ( rc ) {
                                return rc;
                        }
@@ -102,7 +103,8 @@ init_restrictedOperation( monitor_info_t *mi, Entry *e, slap_mask_t restrictops
        for ( i = 0; restricted_exops[ i ].op.bv_val; i++ ) {
                if ( restrictops & restricted_exops[ i ].tag ) {
                        rc = attr_merge_one( e, mi->mi_ad_restrictedOperation,
-                                       &restricted_exops[ i ].op, NULL );
+                                       &restricted_exops[ i ].op,
+                                       &restricted_exops[ i ].op );
                        if ( rc ) {
                                return rc;
                        }
@@ -261,8 +263,7 @@ monitor_subsys_database_init(
                                        break;
                                }
                                
-                               bv.bv_val = on->on_bi.bi_type;
-                               bv.bv_len = strlen( bv.bv_val );
+                               ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
                                attr_merge_normalize_one( e, mi->mi_ad_monitorOverlay,
                                                &bv, NULL );
 
@@ -277,8 +278,7 @@ monitor_subsys_database_init(
                                snprintf( buf, sizeof( buf ), 
                                        "cn=Overlay %d,%s", 
                                        j, ms_overlay->mss_dn.bv_val );
-                               bv.bv_val = buf;
-                               bv.bv_len = strlen( buf );
+                               ber_str2bv( buf, 0, 0, &bv );
                                attr_merge_normalize_one( e, mi->mi_ad_seeAlso,
                                                &bv, NULL );
                        }
@@ -742,7 +742,7 @@ monitor_subsys_database_modify(
 
        if ( !bvmatch( &a->a_vals[ 0 ], tf ) ) {
                attr_delete( &e->e_attrs, mi->mi_ad_readOnly );
-               rc = attr_merge_one( e, mi->mi_ad_readOnly, tf, NULL );
+               rc = attr_merge_one( e, mi->mi_ad_readOnly, tf, tf );
        }
 
        if ( rc == LDAP_SUCCESS ) {
@@ -813,14 +813,16 @@ monitor_subsys_database_modify(
                        for ( i = 0; !BER_BVISNULL( &restricted_ops[ i ].op ); i++ ) {
                                if ( rp_add & restricted_ops[ i ].tag ) {
                                        attr_merge_one( e, mi->mi_ad_restrictedOperation,
-                                                       &restricted_ops[ i ].op, NULL );
+                                                       &restricted_ops[ i ].op,
+                                                       &restricted_ops[ i ].op );
                                }
                        }
 
                        for ( i = 0; !BER_BVISNULL( &restricted_exops[ i ].op ); i++ ) {
                                if ( rp_add & restricted_exops[ i ].tag ) {
                                        attr_merge_one( e, mi->mi_ad_restrictedOperation,
-                                                       &restricted_exops[ i ].op, NULL );
+                                                       &restricted_exops[ i ].op,
+                                                       &restricted_exops[ i ].op );
                                }
                        }
                }
@@ -878,8 +880,7 @@ monitor_back_add_plugin( monitor_info_t *mi, Backend *be, Entry *e_database )
                                srchdesc->spd_version,
                                srchdesc->spd_description );
 
-               bv.bv_val = buf;
-               bv.bv_len = strlen( buf );
+               ber_str2bv( buf, 0, 0, &bv );
                attr_merge_normalize_one( e_database,
                                mi->mi_ad_monitoredInfo, &bv, NULL );
 
index d94954e8d021c26c391aa08d1bff99fec9e0798a..ae0453b62bb16cf562746196001a8bc0ffbac8ce 100644 (file)
@@ -22,6 +22,7 @@
 #include "portable.h"
 
 #include <stdio.h>
+#include <ac/string.h>
 
 #include "slap.h"
 #include "back-monitor.h"
@@ -106,9 +107,7 @@ monitor_subsys_listener_init(
                if ( l[ i ]->sl_is_tls ) {
                        struct berval bv;
 
-                       bv.bv_val = "TLS";
-                       bv.bv_len = sizeof("TLS")-1;
-
+                       BER_BVSTR( &bv, "TLS" );
                        attr_merge_normalize_one( e, mi->mi_ad_monitoredInfo,
                                        &bv, NULL );
                }
index 8ab11949e983ede6f3d2c68d8b7fffed83b1d9cc..d2b528982e4769b7768765528d9ed8e95e57de7d 100644 (file)
@@ -119,7 +119,7 @@ monitor_subsys_log_init(
                }
        }
 
-       attr_merge( e, mi->mi_ad_description, desc, NULL );
+       attr_merge_normalize( e, mi->mi_ad_description, desc, NULL );
 
        monitor_cache_release( mi, e );
 
index 8ce09525d3b6a4d18bab52a14c6ad8046e8c2703..f071bb0d6157b18d821caab0e064057caff3f346 100644 (file)
@@ -74,8 +74,8 @@ monitor_subsys_ops_init(
                return( -1 );
        }
 
-       attr_merge_one( e_op, mi->mi_ad_monitorOpInitiated, &bv_zero, NULL );
-       attr_merge_one( e_op, mi->mi_ad_monitorOpCompleted, &bv_zero, NULL );
+       attr_merge_one( e_op, mi->mi_ad_monitorOpInitiated, &bv_zero, &bv_zero );
+       attr_merge_one( e_op, mi->mi_ad_monitorOpCompleted, &bv_zero, &bv_zero );
 
        mp = ( monitor_entry_t * )e_op->e_private;
        mp->mp_children = NULL;
index c68d5152cd83321faaa4d24c83ab0b96cc9186ab..01d8beb88e16b01b665798d1ced901a918443f4d 100644 (file)
@@ -103,9 +103,7 @@ monitor_subsys_overlay_init(
                        return( -1 );
                }
                
-               bv.bv_val = on->on_bi.bi_type;
-               bv.bv_len = strlen( bv.bv_val );
-
+               ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
                attr_merge_normalize_one( e, mi->mi_ad_monitoredInfo,
                                &bv, NULL );
                attr_merge_normalize_one( e_overlay, mi->mi_ad_monitoredInfo,
@@ -123,9 +121,8 @@ monitor_subsys_overlay_init(
 
                        snprintf( buf, sizeof( buf ), "cn=Database %d,%s",
                                        j, ms_database->mss_dn.bv_val );
-                       dn.bv_val = buf;
-                       dn.bv_len = strlen( buf );
 
+                       ber_str2bv( buf, 0, 0, &dn );
                        attr_merge_normalize_one( e, mi->mi_ad_seeAlso,
                                        &dn, NULL );
                }
index 150484689779004774a3ea9239b0657ad904eb71..744c7a551138890f99d2a17c722ce0c9b42c401e 100644 (file)
@@ -110,7 +110,7 @@ monitor_subsys_rww_init(
                ber_dupbv( &monitor_rww[ i ].nrdn, &nrdn );
        
                BER_BVSTR( &bv, "0" );
-               attr_merge_one( e, mi->mi_ad_monitorCounter, &bv, NULL );
+               attr_merge_one( e, mi->mi_ad_monitorCounter, &bv, &bv );
        
                mp = monitor_entrypriv_create();
                if ( mp == NULL ) {
index b7ba178f55a3685d4ab9f979134a5d010f5bfbaa..6b5f7e593b80ea10e081198e9ef0acf62eb10a86 100644 (file)
@@ -114,7 +114,7 @@ monitor_subsys_sent_init(
                ber_dupbv( &monitor_sent[ i ].nrdn, &nrdn );
        
                BER_BVSTR( &bv, "0" );
-               attr_merge_one( e, mi->mi_ad_monitorCounter, &bv, NULL );
+               attr_merge_one( e, mi->mi_ad_monitorCounter, &bv, &bv );
        
                mp = monitor_entrypriv_create();
                if ( mp == NULL ) {