diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2009-02-10 00:23:27 +0000 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2009-02-10 00:23:27 +0000 |
commit | a7371944f0cc0b2e90fb4e98f53e20c933c92732 (patch) | |
tree | 9a4be68a076f43838f4dea5203be09c981568a39 /ldap/servers/slapd | |
parent | 52e16626b1e53b061e40dfc35c345be8ca274069 (diff) | |
download | ds-a7371944f0cc0b2e90fb4e98f53e20c933c92732.tar.gz ds-a7371944f0cc0b2e90fb4e98f53e20c933c92732.tar.xz ds-a7371944f0cc0b2e90fb4e98f53e20c933c92732.zip |
Resoves: #484157
Summary: timelimit not honored in some cases
Description: Range search operations could take longer time than the time limit
depending upon the data size, but there was no chance to check the time limit
in the code (index_range_read). Thus, once the range search operation has
started, it could have lasted far exceeding the specified time limit.
I introduced the time check in the range search function.
Diffstat (limited to 'ldap/servers/slapd')
-rw-r--r-- | ldap/servers/slapd/back-ldbm/index.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c index 62df834e..3c639c25 100644 --- a/ldap/servers/slapd/back-ldbm/index.c +++ b/ldap/servers/slapd/back-ldbm/index.c @@ -1055,6 +1055,8 @@ index_range_read( int retry_count = 0; int is_and = 0; int sizelimit = 0; + time_t curtime, stoptime, optime; + int timelimit = -1; *err = 0; plen = strlen( prefix = index2prefix( indextype )); @@ -1063,6 +1065,9 @@ index_range_read( { slapi_pblock_get(pb, SLAPI_SEARCH_SIZELIMIT, &sizelimit); } + slapi_pblock_get( pb, SLAPI_OPINITIATED_TIME, &optime ); + slapi_pblock_get(pb, SLAPI_SEARCH_TIMELIMIT, &timelimit); + stoptime = optime + timelimit; /* * Determine the lookthrough_limit from the PBlock. @@ -1307,6 +1312,14 @@ index_range_read( 0, 0, 0); break; } + /* check time limit */ + curtime = current_time(); + if ( timelimit != -1 && curtime >= stoptime ) + { + LDAPDebug(LDAP_DEBUG_TRACE, "index_range_read timelimit exceeded\n", + 0, 0, 0); + break; + } /* Check to see if the operation has been abandoned (also happens * when the connection is closed by the client). |