From d8756a1c98fe3d0cc161fd97149458d02272e46a Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Thu, 23 Jan 2003 22:07:33 +0000 Subject: [PATCH] fix ITS#2289 (don't use shared data for search state; use msgid instead) --- servers/slapd/back-meta/compare.c | 19 +++++++++---------- servers/slapd/back-meta/search.c | 18 +++++++++--------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/servers/slapd/back-meta/compare.c b/servers/slapd/back-meta/compare.c index 3f18f88c17..cc5b40530c 100644 --- a/servers/slapd/back-meta/compare.c +++ b/servers/slapd/back-meta/compare.c @@ -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 ); diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c index 25d2a1ef79..91e70bed0c 100644 --- a/servers/slapd/back-meta/search.c +++ b/servers/slapd/back-meta/search.c @@ -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; } } -- 2.39.5