Code

Fixed sieve script creation freeze, till memory exhausted.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 20 Oct 2006 09:05:42 +0000 (09:05 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 20 Oct 2006 09:05:42 +0000 (09:05 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4907 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_sieve.inc

index bdbf7d6fdbea70af45a0fa4b34dc92128a00b9f4..16b50f6877dfce6b0d92ac44aed2812371869b16 100644 (file)
@@ -119,8 +119,13 @@ class sieve
             $this->error_raw[]=substr($this->line, 0, strlen($this->line) -2);    //we want to be nice and strip crlf's
             $this->err_recv = strlen($this->line);
 
-            while($this->err_recv < $this->err_len){
+           /* Avoid loop till memory is full 
+               This can happen if sieve script is modified via external scripts and not by gosa .. */
+           $max = 10000;
+            $cur = 0 ; 
+            while($this->err_recv < $this->err_len && ($cur < $max)){
                 //print "<br>Trying to receive ".($this->err_len-$this->err_recv)." bytes for result<br>";
+                $cur ++ ; 
                 $this->line = fgets($this->fp, ($this->err_len-$this->err_recv));
                 $this->error_raw[]=substr($this->line, 0, strlen($this->line) -2);    //we want to be nice and strip crlf's
                 $this->err_recv += strlen($this->line);