From 1f3d88f32b4cdbd6c8b31b63741c59d0b9ec60e9 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Mon, 13 Aug 2007 20:51:42 +0000 Subject: [PATCH] recent check for syncrepl searchbase broke test048; fixing... --- servers/slapd/backend.c | 20 ++++++++++++++++++++ servers/slapd/proto-slap.h | 2 ++ servers/slapd/syncrepl.c | 5 +++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index f1d49e2c07..ab0ccd1f95 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -693,6 +693,26 @@ be_issuffix( return 0; } +int +be_issubordinate( + Backend *be, + struct berval *bvsubordinate ) +{ + int i; + + if ( be->be_nsuffix == NULL ) { + return 0; + } + + for ( i = 0; !BER_BVISNULL( &be->be_nsuffix[i] ); i++ ) { + if ( dnIsSuffix( bvsubordinate, &be->be_nsuffix[i] ) ) { + return 1; + } + } + + return 0; +} + int be_isroot_dn( Backend *be, struct berval *ndn ) { diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 8b975e7615..19b86837ec 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -340,6 +340,8 @@ LDAP_SLAPD_F (BackendDB *) select_backend LDAP_P(( LDAP_SLAPD_F (int) be_issuffix LDAP_P(( Backend *be, struct berval *suffix )); +LDAP_SLAPD_F (int) be_issubordinate LDAP_P(( Backend *be, + struct berval *subordinate )); LDAP_SLAPD_F (int) be_isroot LDAP_P(( Operation *op )); LDAP_SLAPD_F (int) be_isroot_dn LDAP_P(( Backend *be, struct berval *ndn )); LDAP_SLAPD_F (int) be_isroot_pw LDAP_P(( Operation *op )); diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 426d40cbdf..a2acceaf84 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -3358,8 +3358,9 @@ parse_syncrepl_line( Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg, 0 ); return -1; } - if ( select_backend( &si->si_base, 0 ) != c->be ) { - ber_memfree( si->si_base.bv_val ); + if ( !be_issubordinate( c->be, &si->si_base ) ) { + ch_free( si->si_base.bv_val ); + BER_BVZERO( &si->si_base ); snprintf( c->cr_msg, sizeof( c->cr_msg ), "Base DN \"%s\" is not within the database naming context", val ); -- 2.39.5