> Ah yes, just saw this. Sorry, my email seems to be slow today (weird).
>
> Similar to my patch, but I'm unsure about the second part:
>
> } else if ( op->o_bd != gi->gi_n[0].gn_be ) {
> /* if cookie not empty, it's again this database's turn */
> op->o_conn->c_pagedresults_state.ps_be = op->o_bd;
> }
>
> If the cookie is not empty, then it should again be this database's
> turn, even it this is this last database.
>
> This makes a search that stops in the middle of results from last
> database with a valid cookie fall back to the first database on
> continuation, and thus loop forever.
>
> Would you consider removing the else if?
Well, it's not that simple. The fact is that paged results state is being
handled in two ways: when the database is back-bdb/hdb, the cookie is an
ID, and it's stored in ps_cookie; otherwise (e.g. back-ldap), it's a
berval, stored in ps_cookieval. I need to handle both cases. I think I
made it.
Now, ps_cookie in c_pagedresults_state is initialized to NOID; back-bdb
will set it to 0 first, and then to whatever value it needs. Other
backends, that use ps_cookieval, will not touch it. So when ps_cookie ==
NOID one needs to look at ps_cookieval (and parse it as needed), otherwise
ps_cookie suffices. You'll need to update backglue.c, controls.c and
back-bdb/search.c.
Now it passes all cases I checked, both with local glued databases and
with back-null/back-ldap as in your example.
p.