From 74f54320cd414ecf1db51202a0f9f09fea113b97 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 12 Nov 2007 11:45:12 +0000 Subject: [PATCH] Fix pagedresults resume --- servers/slapd/back-bdb/search.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) 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; } -- 2.39.5