]> git.sur5r.net Git - openldap/commitdiff
fix a_nvals according to back-ldap implementation (ITS#2716; at least part of it)
authorPierangelo Masarati <ando@openldap.org>
Sat, 4 Oct 2003 17:18:25 +0000 (17:18 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 4 Oct 2003 17:18:25 +0000 (17:18 +0000)
servers/slapd/back-meta/search.c

index 940ce702cc6f66c52f2442908e544b661673dc0a..2409e54a4027f4ba8554e07ba536d95f19537c78 100644 (file)
@@ -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; i<last; i++ ) {
+                               attr->a_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;
        }