]> git.sur5r.net Git - openldap/commitdiff
fix ITS#2289 (don't use shared data for search state; use msgid instead)
authorPierangelo Masarati <ando@openldap.org>
Thu, 23 Jan 2003 22:07:33 +0000 (22:07 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 23 Jan 2003 22:07:33 +0000 (22:07 +0000)
servers/slapd/back-meta/compare.c
servers/slapd/back-meta/search.c

index 3f18f88c1798c24c37bbe831c8fdfa82207ed298..cc5b40530c20f3fba7bc235267dd257184350d83 100644 (file)
@@ -113,6 +113,7 @@ meta_back_compare(
                struct berval mapped_value = ava->aa_value;
 
                if ( lsc->candidate != META_CANDIDATE ) {
+                       msgid[ i ] = -1;
                        continue;
                }
 
@@ -158,7 +159,6 @@ meta_back_compare(
                                        &ava->aa_value, &mapped_value, 0 );
 
                        if ( mapped_value.bv_val == NULL ) {
-                               lsc->candidate = META_NOT_CANDIDATE;
                                continue;
                        }
                /*
@@ -168,7 +168,6 @@ meta_back_compare(
                        ldap_back_map( &li->targets[ i ]->at_map,
                                &ava->aa_desc->ad_cname, &mapped_attr, 0 );
                        if ( mapped_attr.bv_val == NULL ) {
-                               lsc->candidate = META_NOT_CANDIDATE;
                                continue;
                        }
                }
@@ -180,11 +179,6 @@ meta_back_compare(
                 */
                msgid[ i ] = ldap_compare( lc->conns[ i ].ld, mdn,
                                mapped_attr.bv_val, mapped_value.bv_val );
-               if ( msgid[ i ] == -1 ) {
-                       lsc->candidate = META_NOT_CANDIDATE;
-                       continue;
-               }
-
                if ( mdn != dn->bv_val ) {
                        free( mdn );
                }
@@ -195,6 +189,10 @@ meta_back_compare(
                        free( mapped_value.bv_val );
                }
 
+               if ( msgid[ i ] == -1 ) {
+                       continue;
+               }
+
                ++candidates;
        }
 
@@ -210,7 +208,7 @@ meta_back_compare(
                        int lrc;
                        LDAPMessage *res = NULL;
 
-                       if ( lsc->candidate != META_CANDIDATE ) {
+                       if ( msgid[ i ] == -1 ) {
                                continue;
                        }
 
@@ -267,10 +265,11 @@ meta_back_compare(
                                        last = i;
                                        break;
                                }
-                               lsc->candidate = META_NOT_CANDIDATE;
+                               msgid[ i ] = -1;
                                --candidates;
+
                        } else {
-                               lsc->candidate = META_NOT_CANDIDATE;
+                               msgid[ i ] = -1;
                                --candidates;
                                if ( res ) {
                                        ldap_msgfree( res );
index 25d2a1ef796a63837f8e3252860aea71bc1b07be..91e70bed0c184f94767cfe36366f1084844ca6d4 100644 (file)
@@ -213,6 +213,7 @@ meta_back_search(
                char    *mapped_filter, **mapped_attrs;
                
                if ( lsc->candidate != META_CANDIDATE ) {
+                       msgid[ i ] = -1;
                        continue;
                }
 
@@ -250,7 +251,7 @@ meta_back_search(
                                        /*
                                         * this target is no longer candidate
                                         */
-                                       lsc->candidate = META_NOT_CANDIDATE;
+                                       msgid[ i ] = -1;
                                        continue;
                                }
                                break;
@@ -273,7 +274,7 @@ meta_back_search(
                                /*
                                 * this target is no longer candidate
                                 */
-                               lsc->candidate = META_NOT_CANDIDATE;
+                               msgid[ i ] = -1;
                                continue;
                        }
 
@@ -386,11 +387,6 @@ meta_back_search(
                 */
                msgid[ i ] = ldap_search( lsc->ld, mbase, realscope,
                                mapped_filter, mapped_attrs, attrsonly ); 
-               if ( msgid[ i ] == -1 ) {
-                       lsc->candidate = META_NOT_CANDIDATE;
-                       continue;
-               }
-
                if ( mapped_attrs ) {
                        free( mapped_attrs );
                        mapped_attrs = NULL;
@@ -404,6 +400,10 @@ meta_back_search(
                        mbase = NULL;
                }
 
+               if ( msgid[ i ] == -1 ) {
+                       continue;
+               }
+
                ++candidates;
        }
 
@@ -426,7 +426,7 @@ meta_back_search(
                ab = op->o_abandon;
 
                for ( i = 0, lsc = lc->conns; !META_LAST(lsc); lsc++, i++ ) {
-                       if ( lsc->candidate != META_CANDIDATE ) {
+                       if ( msgid[ i ] == -1 ) {
                                continue;
                        }
                        
@@ -557,7 +557,7 @@ meta_back_search(
                                 * When no candidates are left,
                                 * the outer cycle finishes
                                 */
-                               lsc->candidate = META_NOT_CANDIDATE;
+                               msgid[ i ] = -1;
                                --candidates;
                        }
                }