Fix handling of scripts with nested rules (#5540)

pull/5549/head
Aleksander Machniak 8 years ago
parent 47750b9b06
commit 2eede31561

@ -69,6 +69,7 @@ CHANGELOG Roundcube Webmail
- Added missing primary keys (dictionary, cache, cache_shared tables)
- Fix so templating system does not mess with external (e.g. email) content (#5499)
- Fix redundant keep-alive/refresh after session error on compose page (#5500)
- Managesieve: Fix handling of scripts with nested rules (#5540)
RELEASE 1.2.3
-------------

@ -1,3 +1,5 @@
- Fix handling of scripts with nested rules (#5540)
* version 8.8 [2016-11-27]
-----------------------------------------------------------
- Fix parsing of vacation date-time with non-default date_format (#5372)

@ -242,7 +242,7 @@ class rcube_sieve_script
if ($test['test'] == 'string') {
array_push($exts, 'variables');
}
$tests[$i] .= ($test['not'] ? 'not ' : '');
$tests[$i] .= $test['test'];
@ -851,6 +851,11 @@ class rcube_sieve_script
$token = !empty($tokens) ? array_shift($tokens) : $separator;
switch ($token) {
case 'if':
// nested 'if' conditions, ignore the whole rule (#5540)
$this->_parse_actions($content, $position);
continue 2;
case 'discard':
case 'keep':
case 'stop':
@ -936,8 +941,9 @@ class rcube_sieve_script
break;
}
if ($separator == $end)
if ($separator == $end) {
break;
}
}
return $result;

@ -0,0 +1,25 @@
# Sieve Filter
# Erzeugt von Ingo (http://www.horde.org/ingo/) (30.09.2016, 16:02)
# Nested rules aren't supported and will be ignored (#5540)
require ["vacation", "regex"];
# Abwesenheit
if allof ( not exists ["list-help", "list-unsubscribe", "list-subscribe", "list-owner", "list-post", "list-archive", "list-id", "Mailing-List"],
not header :is "Precedence" ["list", "bulk", "junk"],
not header :matches "To" "Multiple recipients of*") {
if header :regex "Received" "^.*(2016) (\\(.*\\) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" {
if header :regex "Received" "^.*(Oct) (\\(.*\\) )?.... (\\(.*\\) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" {
if header :regex "Received" "^.*([0 ]4|[0 ]5|[0 ]6|[0 ]7) (\\(.*\\) )?... (\\(.*\\) )?.... (\\(.*\\) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" {
vacation :days 7 :addresses "test@company.com" :subject "vacation" "blablabla";
}
}
}
}
# Ausgeschlossene Adressen
if address :is ["From", "Sender", "Resent-From"] "noreply@example.org" {
discard;
stop;
}

@ -0,0 +1,9 @@
# Sieve Filter
# Erzeugt von Ingo (http://www.horde.org/ingo/) (30.09.2016, 16:02)
# rule:[Ausgeschlossene Adressen]
if address :is ["From","Sender","Resent-From"] "noreply@example.org"
{
discard;
stop;
}
Loading…
Cancel
Save