From a78c03bb4a9285d5a42dc7907fc212dbf162a7c1 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 4 Oct 2003 17:18:25 +0000 Subject: [PATCH] fix a_nvals according to back-ldap implementation (ITS#2716; at least part of it) --- servers/slapd/back-meta/search.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c index 940ce702cc..2409e54a40 100644 --- a/servers/slapd/back-meta/search.c +++ b/servers/slapd/back-meta/search.c @@ -673,6 +673,8 @@ meta_send_entry( dc.ctx = "searchAttrDN"; while ( ber_scanf( &ber, "{m", &a ) != LBER_ERROR ) { + int last = 0; + ldap_back_map( &li->targets[ target ]->rwmap.rwm_at, &a, &mapped, BACKLDAP_REMAP ); if ( mapped.bv_val == NULL || mapped.bv_val[0] == '\0' ) { @@ -724,7 +726,6 @@ meta_send_entry( } else if ( attr->a_desc == slap_schema.si_ad_objectClass || attr->a_desc == slap_schema.si_ad_structuralObjectClass ) { - int last; for ( last = 0; attr->a_vals[ last ].bv_val; ++last ); @@ -762,6 +763,25 @@ meta_send_entry( ldap_dnattr_result_rewrite( &dc, attr->a_vals ); } + if ( last && attr->a_desc->ad_type->sat_equality && + attr->a_desc->ad_type->sat_equality->smr_normalize ) { + int i; + + attr->a_nvals = ch_malloc((last + 1)*sizeof(struct berval)); + for ( i = 0; ia_desc->ad_type->sat_equality->smr_normalize( + SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX, + attr->a_desc->ad_type->sat_syntax, + attr->a_desc->ad_type->sat_equality, + &attr->a_vals[i], &attr->a_nvals[i], + op->o_tmpmemctx ); + } + attr->a_nvals[i].bv_val = NULL; + attr->a_nvals[i].bv_len = 0; + } else { + attr->a_nvals = attr->a_vals; + } + *attrp = attr; attrp = &attr->a_next; } -- 2.39.5