diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-04 15:32:22 -0700 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-04 15:32:22 -0700 |
commit | 115857a2d111b7b6d72ddadd7c8e231f802fc249 (patch) | |
tree | 0dd7afb2905fd01dd9940787376c85b253a44bfc /ldap/servers/slapd/pagedresults.c | |
parent | 26240315c1ef8fcb71798feae171f394293e953f (diff) | |
download | ds-115857a2d111b7b6d72ddadd7c8e231f802fc249.tar.gz ds-115857a2d111b7b6d72ddadd7c8e231f802fc249.tar.xz ds-115857a2d111b7b6d72ddadd7c8e231f802fc249.zip |
513166 - Simple Paged result doesn't provide the server's estimate
of the total number of entries
https://bugzilla.redhat.com/show_bug.cgi?id=513166
Description: By definition, the first integer of the response
control is for the estimated search result set size. This fix
sets the estimated result set size.
* controlType = LDAP_CONTROL_PAGEDRESULTS;
* criticality = n/a;
* controlValue:
* realSearchControlValue ::= SEQUENCE {
* size INTEGER (0..maxInt),
* -- result set size estimate from server
* cookie OCTET STRING
Diffstat (limited to 'ldap/servers/slapd/pagedresults.c')
-rw-r--r-- | ldap/servers/slapd/pagedresults.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c index e82053bc..fdda938e 100644 --- a/ldap/servers/slapd/pagedresults.c +++ b/ldap/servers/slapd/pagedresults.c @@ -114,7 +114,7 @@ pagedresults_parse_control_value( struct berval *psbvp, */ void pagedresults_set_response_control( Slapi_PBlock *pb, int iscritical, - ber_int_t pagesize, int curr_search_count ) + ber_int_t estimate, int curr_search_count ) { LDAPControl **resultctrls = NULL; LDAPControl pr_respctrl; @@ -135,7 +135,7 @@ pagedresults_set_response_control( Slapi_PBlock *pb, int iscritical, } else { cookie_str = slapi_ch_smprintf("%d", curr_search_count); } - ber_printf ( ber, "{io}", pagesize, cookie_str, strlen(cookie_str) ); + ber_printf ( ber, "{io}", estimate, cookie_str, strlen(cookie_str) ); if ( ber_flatten ( ber, &berval ) != LDAP_SUCCESS ) { goto bailout; @@ -250,6 +250,31 @@ pagedresults_set_search_result_count(Connection *conn, int count) } int +pagedresults_get_search_result_set_size_estimate(Connection *conn) +{ + int count = 0; + if (conn) { + PR_Lock(conn->c_mutex); + count = conn->c_search_result_set_size_estimate; + PR_Unlock(conn->c_mutex); + } + return count; +} + +int +pagedresults_set_search_result_set_size_estimate(Connection *conn, int count) +{ + int rc = -1; + if (conn) { + PR_Lock(conn->c_mutex); + conn->c_search_result_set_size_estimate = count; + PR_Unlock(conn->c_mutex); + rc = 0; + } + return rc; +} + +int pagedresults_get_with_sort(Connection *conn) { int flags = 0; |