Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv19901
Modified Files:
index.c
Log Message:
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.
Index: index.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/index.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- index.c 15 Oct 2008 06:30:08 -0000 1.17
+++ index.c 10 Feb 2009 00:23:27 -0000 1.18
@@ -1055,6 +1055,8 @@
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 @@
{
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 @@
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).
Show replies by date