]> git.sur5r.net Git - openldap/commitdiff
import nasty subtype bug (too many results) fix from HEAD
authorPierangelo Masarati <ando@openldap.org>
Thu, 18 Mar 2004 23:43:35 +0000 (23:43 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 18 Mar 2004 23:43:35 +0000 (23:43 +0000)
CHANGES
servers/slapd/back-sql/entry-id.c
servers/slapd/back-sql/schema-map.c

diff --git a/CHANGES b/CHANGES
index 14986ff9e1ec6436635eed841a76dd553b00b6fd..c51d2bcc9833293bd347bc16a2fba02db571b750 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -15,6 +15,7 @@ OpenLDAP 2.2.7 Engineering
        Fixed back-sql oracle-related issues (ITS#2641)
        Fixed back-bdb empty suffix/contextCSN bug (ITS#2970)
        Fixed libldap/slapd '=' escape in DN (ITS#3009)
+       Fixed back-sql attribute subtype in search request
        Updated ldapsearch paged results handling
        Added total operation count in back-monitor (ITS#2983)
        Added slapd ACL peername/expand styles (ITS#2907, ITS#3010)
index e1644e2f4011a20216dd7ddbbea1ec040d6a096f..55a4f55d7cb3c3ab437e105cf00082d57586dd70 100644 (file)
@@ -398,6 +398,24 @@ backsql_id2entry( backsql_srch_info *bsi, Entry *e, backsql_entryID *eid )
                                continue;
                        }
 
+                       /* if one of the attributes listed here is
+                        * a subtype of another, it must be ignored,
+                        * because subtypes are already dealt with
+                        * by backsql_supad2at()
+                        */
+                       for ( j = 0; bsi->bsi_attrs[ j ].an_name.bv_val; j++ ) {
+                               /* skip self */
+                               if ( j == i ) {
+                                       continue;
+                               }
+
+                               /* skip subtypes */
+                               if ( is_at_subtype( attr->an_desc->ad_type, bsi->bsi_attrs[ j ].an_desc->ad_type ) )
+                               {
+                                       goto next;
+                               }
+                       }
+
                        rc = backsql_supad2at( bsi->bsi_oc, attr->an_desc, &vat );
                        if ( rc != 0 || vat == NULL ) {
                                Debug( LDAP_DEBUG_TRACE, "backsql_id2entry(): "
@@ -413,6 +431,8 @@ backsql_id2entry( backsql_srch_info *bsi, Entry *e, backsql_entryID *eid )
                        }
 
                        ch_free( vat );
+
+next:;
                }
 
        } else {
index 092a0750f9b5a16c565fb050931d53b7f8509a9b..1de778c5c689bf00d28f4df67664e4abe91c7136 100644 (file)
@@ -595,8 +595,23 @@ supad2at_f( void *v_at, void *v_arg )
 
        if ( is_at_subtype( at->bam_ad->ad_type, va->ad->ad_type ) ) {
                backsql_at_map_rec      **ret;
+               unsigned                i;
+
+               /* if already listed, holler! (should never happen) */
+               if ( va->ret ) {
+                       for ( i = 0; i < va->n; i++ ) {
+                               if ( va->ret[ i ]->bam_ad == at->bam_ad ) {
+                                       break;
+                               }
+                       }
+
+                       if ( i < va->n ) {
+                               return 0;
+                       }
+               }
 
-               ret = ch_realloc( va->ret, sizeof( backsql_at_map_rec *) * ( va->n + 2 ) );
+               ret = ch_realloc( va->ret,
+                               sizeof( backsql_at_map_rec *) * ( va->n + 2 ) );
                if ( ret == NULL ) {
                        ch_free( va->ret );
                        return SUPAD2AT_STOP;
@@ -632,7 +647,7 @@ backsql_supad2at( backsql_oc_map_rec *objclass, AttributeDescription *supad,
        va.ret = NULL;
        va.ad = supad;
        va.n = 0;
-       
+
        rc = avl_apply( objclass->bom_attrs, supad2at_f, &va,
                        SUPAD2AT_STOP, AVL_INORDER );
        if ( rc == SUPAD2AT_STOP ) {