From: Howard Chu Date: Sat, 20 Sep 2003 03:26:40 +0000 (+0000) Subject: cn=ldapsync berval cleanup X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~699 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f2c3ba16d69320b6f53c1e1d0ec75edde5bd68df;p=openldap cn=ldapsync berval cleanup --- diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index e345b5ba39..6260b8164e 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -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 ); } } diff --git a/servers/slapd/back-bdb/ctxcsn.c b/servers/slapd/back-bdb/ctxcsn.c index 0bf32194fc..c6655c11f1 100644 --- a/servers/slapd/back-bdb/ctxcsn.c +++ b/servers/slapd/back-bdb/ctxcsn.c @@ -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 ) { diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index 664d2f8e4c..945099b5ce 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -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 ); } } diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index 68806a7859..2ff3184daf 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -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 ); } } diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index 80d41518d5..861a425a76 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -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 ); } }