[389-commits] ldapserver/ldap/servers/slapd/back-ldbm index.c, 1.5.2.4, 1.5.2.4.2.1

Noriko Hosoi nhosoi at fedoraproject.org
Tue Feb 2 22:04:57 UTC 2010


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv8554

Modified Files:
      Tag: Directory71Sp7RtmRhelHpuxSolaris_branch
	index.c 
Log Message:
Back porting revision 1.18 for CS71 release.
Resolves: #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.5.2.4
retrieving revision 1.5.2.4.2.1
diff -u -r1.5.2.4 -r1.5.2.4.2.1
--- index.c	28 Aug 2008 16:21:50 -0000	1.5.2.4
+++ index.c	2 Feb 2010 22:04:55 -0000	1.5.2.4.2.1
@@ -1012,6 +1012,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 ));
@@ -1020,6 +1022,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.
@@ -1264,6 +1269,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).



More information about the 389-commits mailing list