diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2009-07-22 16:03:02 -0700 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2009-07-22 16:03:02 -0700 |
commit | c3f6ff604cf0e0458a50889f15c50e59297e1ddf (patch) | |
tree | d99dacb24b4d4b11847ed631c92696f2f21a39bc | |
parent | 35a54ffef5819e7d0cebadcba03b32c2cf918d8d (diff) | |
download | ds-c3f6ff604cf0e0458a50889f15c50e59297e1ddf.tar.gz ds-c3f6ff604cf0e0458a50889f15c50e59297e1ddf.tar.xz ds-c3f6ff604cf0e0458a50889f15c50e59297e1ddf.zip |
513172 Simple Paged Results does not respect nsslapd-sizelimit
SPR returns one page in one operation. Let the search_result_set keep the
current sizelimit and make the sizelimit work beyond operations.
-rw-r--r-- | ldap/servers/slapd/back-ldbm/back-ldbm.h | 3 | ||||
-rw-r--r-- | ldap/servers/slapd/back-ldbm/ldbm_search.c | 22 |
2 files changed, 18 insertions, 7 deletions
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h index 3036bf7c..733bfe38 100644 --- a/ldap/servers/slapd/back-ldbm/back-ldbm.h +++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h @@ -715,7 +715,8 @@ typedef struct _back_search_result_set int sr_lookthroughlimit; /* how many can we examine? */ int sr_virtuallistview; /* is this a VLV Search */ Slapi_Entry* sr_vlventry; /* a special VLV Entry for when the ACL check fails */ - int sr_flags; /* Magic flags, defined below */ + int sr_flags; /* Magic flags, defined below */ + int sr_current_sizelimit; /* Current sizelimit */ } back_search_result_set; #define SR_FLAG_CAN_SKIP_FILTER_TEST 1 /* If set in sr_flags, means that we can safely skip the filter test */ diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c index 1c859c73..ead99388 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_search.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c @@ -1122,6 +1122,18 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension ) slapi_pblock_get( pb, SLAPI_SEARCH_REFERRALS, &urls ); slapi_pblock_get( pb, SLAPI_SEARCH_RESULT_SET, &sr ); slapi_pblock_get( pb, SLAPI_TARGET_UNIQUEID, &target_uniqueid ); + + if (sr->sr_current_sizelimit >= 0) { + /* + * sr_current_sizelimit contains the current sizelimit. + * In case of paged results, getting one page is one operation, + * while the results on each page are from same back_search_result_set. + * To maintain sizelimit beyond operations, back_search_result_set + * holds the current sizelimit value. + * (The current sizelimit is valid inside an operation, as well.) + */ + slimit = sr->sr_current_sizelimit; + } inst = (ldbm_instance *) be->be_instance_info; @@ -1354,6 +1366,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension ) goto bail; } slapi_pblock_set( pb, SLAPI_SEARCH_SIZELIMIT, &slimit ); + sr->sr_current_sizelimit = slimit; } if ( (filter_test != 0) && sr->sr_virtuallistview) { @@ -1412,15 +1425,12 @@ bail: static back_search_result_set* new_search_result_set(IDList *idl, int vlv, int lookthroughlimit) { - back_search_result_set *p= (back_search_result_set *)slapi_ch_malloc( sizeof( back_search_result_set )); + back_search_result_set *p = (back_search_result_set *)slapi_ch_calloc( 1, sizeof( back_search_result_set )); p->sr_candidates = idl; p->sr_current = idl_iterator_init(idl); - p->sr_entry = NULL; - p->sr_lookthroughcount = 0; p->sr_lookthroughlimit = lookthroughlimit; - p->sr_virtuallistview= vlv; - p->sr_vlventry = NULL; - p->sr_flags = 0; + p->sr_virtuallistview = vlv; + p->sr_current_sizelimit = -1; return p; } |