From d17fb8137c875d927e1e31ae6648dab98d0903f0 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 20 Oct 2006 09:05:42 +0000 Subject: [PATCH] Fixed sieve script creation freeze, till memory exhausted. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4907 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_sieve.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/class_sieve.inc b/include/class_sieve.inc index bdbf7d6fd..16b50f687 100644 --- a/include/class_sieve.inc +++ b/include/class_sieve.inc @@ -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 "
Trying to receive ".($this->err_len-$this->err_recv)." bytes for result
"; + $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); -- 2.30.2