Fix handling of scripts with nested rules (#5540)

pull/5754/head
Aleksander Machniak 8 years ago
parent f04fc506b0
commit bc826be106

@ -1,6 +1,8 @@
CHANGELOG Roundcube Webmail
===========================
- Managesieve: Fix handling of scripts with nested rules (#5540)
RELEASE 1.2.3
-------------
- Searching in both contacts and groups when LDAP addressbook with group_filters option is used

@ -1,3 +1,5 @@
- Fix handling of scripts with nested rules (#5540)
* version 8.6 [2016-04-06]
-----------------------------------------------------------
- Refactored script parser to be 100x faster

@ -805,6 +805,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':
@ -890,8 +895,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