]> git.sur5r.net Git - openldap/commitdiff
syncrepl fixes
authorKurt Zeilenga <kurt@openldap.org>
Fri, 26 Mar 2004 00:02:30 +0000 (00:02 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 26 Mar 2004 00:02:30 +0000 (00:02 +0000)
servers/slapd/syncrepl.c

index 616c22306fb8b8e76f97fe6f81ab29b836e21852..951841b9e8589dfa003f0836cb7f7ef4659eb743 100644 (file)
@@ -1028,11 +1028,6 @@ done:
        return rc;
 }
 
-static struct berval uuidbva[] = {
-       BER_BVNULL,
-       BER_BVNULL
-};
-
 int
 syncrepl_entry(
        syncinfo_t* si,
@@ -1048,6 +1043,7 @@ syncrepl_entry(
        slap_callback   cb = { NULL };
        struct berval   *syncuuid_bv = NULL;
        struct berval   syncUUID_strrep = { 0, NULL };
+       struct berval   uuid_bv = { 0, NULL };
 
        SlapReply       rs = {REP_RESULT};
        Filter f = {0};
@@ -1197,11 +1193,11 @@ syncrepl_entry(
                                        }
 
                                        mod = (Modifications *)ch_calloc(1, sizeof(Modifications));
-                                       ber_dupbv( &uuidbva[0], syncUUID );
+                                       ber_dupbv( &uuid_bv, syncUUID );
                                        mod->sml_op = LDAP_MOD_REPLACE;
                                        mod->sml_desc = slap_schema.si_ad_entryUUID;
                                        mod->sml_type = mod->sml_desc->ad_cname;
-                                       mod->sml_bvalues = uuidbva;
+                                       ber_bvarray_add( &mod->sml_bvalues, &uuid_bv );
                                        modtail->sml_next = mod;
                                        
                                        op->o_tag = LDAP_REQ_MODIFY;
@@ -1838,7 +1834,7 @@ nonpresent_callback(
 
                if ( a == NULL ) return 0;
 
-               present_uuid = avl_find( si->si_presentlist, &a->a_vals[0],
+               present_uuid = avl_find( si->si_presentlist, &a->a_nvals[0],
                        syncuuid_cmp );
 
                if ( present_uuid == NULL ) {
@@ -1850,7 +1846,7 @@ nonpresent_callback(
 
                } else {
                        avl_delete( &si->si_presentlist,
-                                       &a->a_vals[0], syncuuid_cmp );
+                                       &a->a_nvals[0], syncuuid_cmp );
                        ch_free( present_uuid->bv_val );
                        ch_free( present_uuid );
                }
@@ -1981,7 +1977,7 @@ syncuuid_cmp( const void* v_uuid1, const void* v_uuid2 )
        const struct berval *uuid2 = v_uuid2;
        int rc = uuid1->bv_len - uuid2->bv_len;
        if ( rc ) return rc;
-       return ( strcmp( uuid1->bv_val, uuid2->bv_val ) );
+       return ( memcmp( uuid1->bv_val, uuid2->bv_val, uuid1->bv_len ) );
 }
 
 static void