From 8fa2f075310cff6069e703ea037402f719608af5 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 14 Feb 2009 14:13:46 +0000 Subject: [PATCH] do not let entryDN,subschemaSubentry slip into results when mapped out (ITS#5760) --- servers/slapd/back-meta/back-meta.h | 2 ++ servers/slapd/back-meta/init.c | 18 ++++++++++++++++++ servers/slapd/back-meta/search.c | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/servers/slapd/back-meta/back-meta.h b/servers/slapd/back-meta/back-meta.h index 2eb1e05e51..3c0395200e 100644 --- a/servers/slapd/back-meta/back-meta.h +++ b/servers/slapd/back-meta/back-meta.h @@ -318,6 +318,8 @@ typedef struct metatarget_t { #define META_BACK_TGT_NOREFS(mt) META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_NOREFS ) #define META_BACK_TGT_NOUNDEFFILTER(mt) META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_NOUNDEFFILTER ) + slap_mask_t mt_rep_flags; + int mt_version; time_t mt_network_timeout; struct timeval mt_bind_timeout; diff --git a/servers/slapd/back-meta/init.c b/servers/slapd/back-meta/init.c index ab9df5687b..f5cb37935c 100644 --- a/servers/slapd/back-meta/init.c +++ b/servers/slapd/back-meta/init.c @@ -170,6 +170,8 @@ meta_back_db_open( slap_bindconf sb = { BER_BVNULL }; metatarget_t *mt = mi->mi_targets[ i ]; + struct berval mapped; + ber_str2bv( mt->mt_uri, 0, 0, &sb.sb_uri ); sb.sb_version = mt->mt_version; sb.sb_method = LDAP_AUTH_SIMPLE; @@ -224,6 +226,22 @@ meta_back_db_open( not_always_anon_non_prescriptive = 1; } } + + BER_BVZERO( &mapped ); + ldap_back_map( &mt->mt_rwmap.rwm_at, + &slap_schema.si_ad_entryDN->ad_cname, &mapped, + BACKLDAP_REMAP ); + if ( BER_BVISNULL( &mapped ) || mapped.bv_val[0] == '\0' ) { + mt->mt_rep_flags |= REP_NO_ENTRYDN; + } + + BER_BVZERO( &mapped ); + ldap_back_map( &mt->mt_rwmap.rwm_at, + &slap_schema.si_ad_subschemaSubentry->ad_cname, &mapped, + BACKLDAP_REMAP ); + if ( BER_BVISNULL( &mapped ) || mapped.bv_val[0] == '\0' ) { + mt->mt_rep_flags |= REP_NO_SUBSCHEMA; + } } if ( not_always == 0 ) { diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c index ff723aecc0..27bac0e438 100644 --- a/servers/slapd/back-meta/search.c +++ b/servers/slapd/back-meta/search.c @@ -2147,7 +2147,7 @@ next_attr:; rs->sr_entry = &ent; rs->sr_attrs = op->ors_attrs; rs->sr_operational_attrs = NULL; - rs->sr_flags = 0; + rs->sr_flags = mi->mi_targets[ target ]->mt_rep_flags; rs->sr_err = LDAP_SUCCESS; rc = send_search_entry( op, rs ); switch ( rc ) { -- 2.39.5