From 1dbe92c27b28b9a5757a84147d2665026aea80c4 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 15 Jan 2005 10:39:23 +0000 Subject: [PATCH] Delete dubious use of be_syncinfo - only the consumer can write the database, and it will only perform writes it received from the provider, so referring back to the provider is pointless. (And of course, the consumer never chases referrals.) --- servers/slapd/back-bdb/delete.c | 19 ++----------------- servers/slapd/back-bdb/modify.c | 18 ++---------------- servers/slapd/back-bdb/modrdn.c | 18 ++---------------- servers/slapd/back-ldbm/delete.c | 19 ++----------------- servers/slapd/back-ldbm/modify.c | 18 ++---------------- servers/slapd/back-ldbm/modrdn.c | 18 ++---------------- 6 files changed, 12 insertions(+), 98 deletions(-) diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index 7eacf1fbc4..f7b3ff494f 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -148,8 +148,6 @@ retry: /* transaction retry */ /* FIXME : dn2entry() should return non-glue entry */ if ( e == NULL || ( !manageDSAit && is_entry_glue( e ))) { - BerVarray deref = NULL; - Debug( LDAP_DEBUG_ARGS, "<=- " LDAP_XSTRING(bdb_delete) ": no such object %s\n", op->o_req_dn.bv_val, 0, 0); @@ -163,18 +161,8 @@ retry: /* transaction retry */ matched = NULL; } else { - if ( op->o_bd->be_syncinfo ) { - syncinfo_t *si = op->o_bd->be_syncinfo; - { - struct berval tmpbv; - ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] ); - ber_bvarray_add( &deref, &tmpbv ); - } - } else { - deref = default_referral; - } - rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, - LDAP_SCOPE_DEFAULT ); + rs->sr_ref = referral_rewrite( default_referral, NULL, + &op->o_req_dn, LDAP_SCOPE_DEFAULT ); } rs->sr_err = LDAP_REFERRAL; @@ -183,9 +171,6 @@ retry: /* transaction retry */ if ( rs->sr_ref != default_referral ) { ber_bvarray_free( rs->sr_ref ); } - if ( deref != default_referral ) { - ber_bvarray_free( deref ); - } free( (char *)rs->sr_matched ); rs->sr_ref = NULL; rs->sr_matched = NULL; diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index 9bdf51fde6..db166d0c37 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -372,7 +372,6 @@ retry: /* transaction retry */ if (( rs->sr_err == DB_NOTFOUND ) || ( !manageDSAit && e && is_entry_glue( e ))) { - BerVarray deref = NULL; if ( e != NULL ) { rs->sr_matched = ch_strdup( e->e_dn ); rs->sr_ref = is_entry_referral( e ) @@ -382,18 +381,8 @@ retry: /* transaction retry */ e = NULL; } else { - if ( op->o_bd->be_syncinfo ) { - syncinfo_t *si = op->o_bd->be_syncinfo; - { - struct berval tmpbv; - ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] ); - ber_bvarray_add( &deref, &tmpbv ); - } - } else { - deref = default_referral; - } - rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, - LDAP_SCOPE_DEFAULT ); + rs->sr_ref = referral_rewrite( default_referral, NULL, + &op->o_req_dn, LDAP_SCOPE_DEFAULT ); } rs->sr_err = LDAP_REFERRAL; @@ -402,9 +391,6 @@ retry: /* transaction retry */ if ( rs->sr_ref != default_referral ) { ber_bvarray_free( rs->sr_ref ); } - if ( deref != default_referral ) { - ber_bvarray_free( deref ); - } free( (char *)rs->sr_matched ); rs->sr_ref = NULL; rs->sr_matched = NULL; diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index 51e7399410..333be33ee7 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -163,7 +163,6 @@ retry: /* transaction retry */ if (( rs->sr_err == DB_NOTFOUND ) || ( !manageDSAit && e && is_entry_glue( e ))) { - BerVarray deref = NULL; if( e != NULL ) { rs->sr_matched = ch_strdup( e->e_dn ); rs->sr_ref = is_entry_referral( e ) @@ -173,27 +172,14 @@ retry: /* transaction retry */ e = NULL; } else { - if ( op->o_bd->be_syncinfo ) { - syncinfo_t *si = op->o_bd->be_syncinfo; - { - struct berval tmpbv; - ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] ); - ber_bvarray_add( &deref, &tmpbv ); - } - } else { - deref = default_referral; - } - rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, - LDAP_SCOPE_DEFAULT ); + rs->sr_ref = referral_rewrite( default_referral, NULL, + &op->o_req_dn, LDAP_SCOPE_DEFAULT ); } rs->sr_err = LDAP_REFERRAL; send_ldap_result( op, rs ); ber_bvarray_free( rs->sr_ref ); - if ( deref != default_referral ) { - ber_bvarray_free( deref ); - } free( (char *)rs->sr_matched ); rs->sr_ref = NULL; rs->sr_matched = NULL; diff --git a/servers/slapd/back-ldbm/delete.c b/servers/slapd/back-ldbm/delete.c index 88e5493575..7f1a4d5cb4 100644 --- a/servers/slapd/back-ldbm/delete.c +++ b/servers/slapd/back-ldbm/delete.c @@ -49,8 +49,6 @@ ldbm_back_delete( /* FIXME : dn2entry() should return non-glue entry */ if ( e == NULL || ( !manageDSAit && is_entry_glue( e ))) { - BerVarray deref = NULL; - Debug(LDAP_DEBUG_ARGS, "<=- ldbm_back_delete: no such object %s\n", op->o_req_dn.bv_val, 0, 0); @@ -62,18 +60,8 @@ ldbm_back_delete( cache_return_entry_r( &li->li_cache, matched ); } else { - if ( op->o_bd->be_syncinfo ) { - syncinfo_t *si = op->o_bd->be_syncinfo; - { - struct berval tmpbv; - ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] ); - ber_bvarray_add( &deref, &tmpbv ); - } - } else { - deref = default_referral; - } - rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, - LDAP_SCOPE_DEFAULT ); + rs->sr_ref = referral_rewrite( default_referral, NULL, + &op->o_req_dn, LDAP_SCOPE_DEFAULT ); } ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock); @@ -82,9 +70,6 @@ ldbm_back_delete( send_ldap_result( op, rs ); if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref ); - if ( deref != default_referral ) { - ber_bvarray_free( deref ); - } free( (char *)rs->sr_matched ); rs->sr_ref = NULL; rs->sr_matched = NULL; diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index 725298b78d..3e34178d20 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -249,7 +249,6 @@ ldbm_back_modify( /* FIXME: dn2entry() should return non-glue entry */ if (( e == NULL ) || ( !manageDSAit && e && is_entry_glue( e ))) { - BerVarray deref = NULL; if ( matched != NULL ) { rs->sr_matched = ch_strdup( matched->e_dn ); rs->sr_ref = is_entry_referral( matched ) @@ -257,18 +256,8 @@ ldbm_back_modify( : NULL; cache_return_entry_r( &li->li_cache, matched ); } else { - if ( op->o_bd->be_syncinfo ) { - syncinfo_t *si = op->o_bd->be_syncinfo; - { - struct berval tmpbv; - ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] ); - ber_bvarray_add( &deref, &tmpbv ); - } - } else { - deref = default_referral; - } - rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, - LDAP_SCOPE_DEFAULT ); + rs->sr_ref = referral_rewrite( default_referral, NULL, + &op->o_req_dn, LDAP_SCOPE_DEFAULT ); } ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock); @@ -276,9 +265,6 @@ ldbm_back_modify( send_ldap_result( op, rs ); if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref ); - if ( deref != default_referral ) { - ber_bvarray_free( deref ); - } free( (char *)rs->sr_matched ); rs->sr_ref = NULL; diff --git a/servers/slapd/back-ldbm/modrdn.c b/servers/slapd/back-ldbm/modrdn.c index 02039d4c9f..e9fd151fcc 100644 --- a/servers/slapd/back-ldbm/modrdn.c +++ b/servers/slapd/back-ldbm/modrdn.c @@ -77,7 +77,6 @@ ldbm_back_modrdn( /* get entry with writer lock */ /* FIXME: dn2entry() should return non-glue entry */ if (( e == NULL ) || ( !manageDSAit && e && is_entry_glue( e ))) { - BerVarray deref = NULL; if ( matched != NULL ) { rs->sr_matched = strdup( matched->e_dn ); rs->sr_ref = is_entry_referral( matched ) @@ -85,18 +84,8 @@ ldbm_back_modrdn( : NULL; cache_return_entry_r( &li->li_cache, matched ); } else { - if ( op->o_bd->be_syncinfo ) { - syncinfo_t *si = op->o_bd->be_syncinfo; - { - struct berval tmpbv; - ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] ); - ber_bvarray_add( &deref, &tmpbv ); - } - } else { - deref = default_referral; - } - rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, - LDAP_SCOPE_DEFAULT ); + rs->sr_ref = referral_rewrite( default_referral, NULL, + &op->o_req_dn, LDAP_SCOPE_DEFAULT ); } ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock); @@ -105,9 +94,6 @@ ldbm_back_modrdn( send_ldap_result( op, rs ); if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref ); - if ( deref != default_referral ) { - ber_bvarray_free( deref ); - } free( (char *)rs->sr_matched ); rs->sr_ref = NULL; rs->sr_matched = NULL; -- 2.39.5