From: Howard Chu Date: Mon, 12 Nov 2007 11:45:12 +0000 (+0000) Subject: Fix pagedresults resume X-Git-Tag: OPENLDAP_REL_ENG_2_4_9~20^2~437 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=74f54320cd414ecf1db51202a0f9f09fea113b97;p=openldap Fix pagedresults resume --- diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index 2e608d33e3..819ca26ea9 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -612,26 +612,15 @@ dn2entry_retry: goto done; } - if ( (ID)( ps->ps_cookie ) == 0 ) { - id = bdb_idl_first( candidates, &cursor ); - - } else { - if ( ps->ps_size == 0 ) { - rs->sr_err = LDAP_SUCCESS; - rs->sr_text = "search abandoned by pagedResult size=0"; - send_ldap_result( op, rs ); - goto done; - } - for ( id = bdb_idl_first( candidates, &cursor ); - id != NOID && - id <= (ID)( ps->ps_cookie ); - id = bdb_idl_next( candidates, &cursor ) ) - { - /* empty */; - } + cursor = (ID) ps->ps_cookie; + if ( cursor && ps->ps_size == 0 ) { + rs->sr_err = LDAP_SUCCESS; + rs->sr_text = "search abandoned by pagedResult size=0"; + send_ldap_result( op, rs ); + goto done; } - - if ( cursor == NOID ) { + id = bdb_idl_first( candidates, &cursor ); + if ( id == NOID ) { Debug( LDAP_DEBUG_TRACE, LDAP_XSTRING(bdb_search) ": no paged results candidates\n", @@ -642,6 +631,8 @@ dn2entry_retry: goto done; } nentries = ps->ps_count; + if ( id == (ID)ps->ps_cookie ) + id = bdb_idl_next( candidates, &cursor ); goto loop_begin; }