Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/wldap32/page.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/dlls/wldap32/page.c b/dlls/wldap32/page.c index f2501e0498..40cb03537e 100644 --- a/dlls/wldap32/page.c +++ b/dlls/wldap32/page.c @@ -175,10 +175,37 @@ ULONG CDECL ldap_get_next_page_s( WLDAP32_LDAP *ld, PLDAPSearch search, struct l_timeval *timeout, ULONG pagesize, ULONG *count, WLDAP32_LDAPMessage **results ) { - FIXME( "(%p, %p, %p, 0x%08x, %p, %p)\n", ld, search, timeout, +#ifdef HAVE_LDAP + ULONG ret; + + TRACE( "(%p, %p, %p, %u, %p, %p)\n", ld, search, timeout, pagesize, count, results ); + if (!ld || !search || !count || !results) return ~0u;
- if (!ld) return ~0u; + if (search->cookie && search->cookie->bv_len == 0) + { + /* end of paged results */ + return WLDAP32_LDAP_NO_RESULTS_RETURNED; + } + + TRACE("search->cookie: %s\n", search->cookie ? debugstr_an(search->cookie->bv_val, search->cookie->bv_len) : "NULL"); + ret = ldap_create_page_control( ld->ld, pagesize, search->cookie, 1, &search->serverctrls[0] ); + if (search->cookie) + { + ber_bvfree( search->cookie ); + search->cookie = NULL; + } + if (ret != LDAP_SUCCESS) return map_error( ret ); + + ret = ldap_search_ext_s( ld->ld, search->base, search->scope, + search->filter, search->attrs, search->attrsonly, + search->serverctrls, search->clientctrls, + search->timeout.tv_sec ? &search->timeout : NULL, search->sizelimit, results ); + if (ret != LDAP_SUCCESS) return map_error( ret ); + + return ldap_get_paged_count( ld, search, count, *results ); + +#endif return WLDAP32_LDAP_NOT_SUPPORTED; }