]> git.sur5r.net Git - openldap/commitdiff
cn=ldapsync berval cleanup
authorHoward Chu <hyc@openldap.org>
Sat, 20 Sep 2003 03:26:40 +0000 (03:26 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 20 Sep 2003 03:26:40 +0000 (03:26 +0000)
servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/ctxcsn.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c

index e345b5ba3988029ace873f11d36f87f6d5003281..6260b8164e7eea35353e24f195cd8830036dae41 100644 (file)
@@ -514,7 +514,6 @@ retry:      /* transaction retry */
 
                } else {
                        struct berval nrdn;
-                       struct berval ctx_nrdn;
 
                        if (pdn.bv_len) {
                                nrdn.bv_val = op->ora_e->e_nname.bv_val;
@@ -531,9 +530,7 @@ retry:      /* transaction retry */
 
                        if ( !op->o_bd->syncinfo ) {
                                if ( ctxcsn_added ) {
-                                       ctx_nrdn.bv_val = "cn=ldapsync";
-                                       ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
-                                       bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
+                                       bdb_cache_add( bdb, suffix_ei, ctxcsn_e, (struct berval *)&slap_ldapsync_cn_bv, locker );
                                }
                        }
 
index 0bf32194fc6d1d14c4de686a6bebd842505da609..c6655c11f1bf784570efb3b9022214c070488c44 100644 (file)
@@ -247,16 +247,13 @@ bdb_get_commit_csn(
 )
 {
        struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
-       struct berval ctxcsn_rdn = BER_BVNULL;
        struct berval ctxcsn_ndn = BER_BVNULL;
        struct berval csn = BER_BVNULL;
-       struct berval ctx_nrdn = BER_BVC( "cn=ldapsync" );
        EntryInfo       *ctxcsn_ei = NULL;
        EntryInfo       *suffix_ei = NULL;
        Entry           *ctxcsn_e = NULL;
        DB_TXN          *ltid = NULL;
        Attribute       *csn_a;
-       char            substr[67];
        char            gid[DB_XIDDATASIZE];
        char            csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
        int                     num_retries = 0;
@@ -265,12 +262,13 @@ bdb_get_commit_csn(
 
        if ( op->o_sync_mode != SLAP_SYNC_NONE ) {
                if ( op->o_bd->syncinfo ) {
+                       char substr[67];
+                       struct berval bv;
                        sprintf( substr, "cn=syncrepl%d", op->o_bd->syncinfo->id );
-                       ber_str2bv( substr, strlen( substr ), 0, &ctxcsn_rdn );
-                       build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], &ctxcsn_rdn );
+                       ber_str2bv( substr, 0, 0, &bv );
+                       build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], &bv );
                } else {
-                       ber_str2bv( "cn=ldapsync", strlen("cn=ldapsync"), 0, &ctxcsn_rdn );
-                       build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], &ctxcsn_rdn );
+                       build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], (struct berval *)&slap_ldapsync_cn_bv );
                }
 
 ctxcsn_retry :
@@ -330,7 +328,7 @@ txn_retry:
                                        return rs->sr_err;
                                }
 
-                               bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
+                               bdb_cache_add( bdb, suffix_ei, ctxcsn_e, (struct berval *)&slap_ldapsync_cn_bv, locker );
 
                                rs->sr_err = TXN_COMMIT( ltid, 0 );
                                if ( rs->sr_err != 0 ) {
index 664d2f8e4ce666ed744ffe002b8b61911180cb2a..945099b5ce8a17cdab4d30ebcc1ac5ea2c809595 100644 (file)
@@ -489,16 +489,12 @@ retry:    /* transaction retry */
                        rs->sr_err = LDAP_SUCCESS;
                }
        } else {
-               struct berval ctx_nrdn;
-
                bdb_cache_delete( &bdb->bi_cache, e, bdb->bi_dbenv,
                        locker, &lock );
 
                if ( !op->o_bd->syncinfo ) {
                        if ( ctxcsn_added ) {
-                               ctx_nrdn.bv_val = "cn=ldapsync";
-                               ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
-                               bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
+                               bdb_cache_add( bdb, suffix_ei, ctxcsn_e, (struct berval *)&slap_ldapsync_cn_bv, locker );
                        }
                }
 
index 68806a7859a6d512825da2a1b716d2cf17389771..2ff3184daf68f453a3f29ebe7734117d31f69063 100644 (file)
@@ -620,16 +620,13 @@ retry:    /* transaction retry */
                        rs->sr_err = LDAP_SUCCESS;
                }
        } else {
-               struct berval ctx_nrdn;
                EntryInfo *ctx_ei;
 
                bdb_cache_modify( e, dummy.e_attrs, bdb->bi_dbenv, locker, &lock );
 
                if ( !op->o_bd->syncinfo ) {
                        if ( ctxcsn_added ) {
-                               ctx_nrdn.bv_val = "cn=ldapsync";
-                               ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
-                               bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
+                               bdb_cache_add( bdb, suffix_ei, ctxcsn_e, (struct berval *)&slap_ldapsync_cn_bv, locker );
                        }
                }
 
index 80d41518d51d9ce9c2c05540357c18aedd1fe5e4..861a425a7600ef79473e1d9571835618fc19e0e0 100644 (file)
@@ -967,16 +967,12 @@ retry:    /* transaction retry */
                if(( rs->sr_err=TXN_PREPARE( ltid, gid )) != 0 ) {
                        rs->sr_text = "txn_prepare failed";
                } else {
-                       struct berval ctx_nrdn;
-
                        bdb_cache_modrdn( save, &op->orr_nnewrdn, e, neip,
                                bdb->bi_dbenv, locker, &lock );
 
                        if ( !op->o_bd->syncinfo ) {
                                if ( ctxcsn_added ) {
-                                       ctx_nrdn.bv_val = "cn=ldapsync";
-                                       ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
-                                       bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
+                                       bdb_cache_add( bdb, suffix_ei, ctxcsn_e, (struct berval *)&slap_ldapsync_cn_bv, locker );
                                }
                        }