From 2baf40733121a69e35cd51af5383d9dc6b523855 Mon Sep 17 00:00:00 2001 From: andryyy Date: Tue, 8 Jan 2019 12:58:15 +0100 Subject: [PATCH] [Rspamd] preg_quote filter objects, only translate * to .* - fixes #2152 --- data/conf/rspamd/dynmaps/settings.php | 45 +++++++++++++++++---------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/data/conf/rspamd/dynmaps/settings.php b/data/conf/rspamd/dynmaps/settings.php index 399538373..8bdfb49d8 100644 --- a/data/conf/rspamd/dynmaps/settings.php +++ b/data/conf/rspamd/dynmaps/settings.php @@ -199,15 +199,16 @@ while ($row = array_shift($rows)) { ?> whitelist_ { prepare("SELECT GROUP_CONCAT(REPLACE(CONCAT('^', `value`, '$'), '*', '.*') SEPARATOR '|') AS `value` FROM `filterconf` + $stmt = $pdo->prepare("SELECT `value` FROM `filterconf` WHERE `object`= :object AND `option` = 'whitelist_from'"); $stmt->execute(array(':object' => $row['object'])); - $grouped_lists = $stmt->fetchAll(PDO::FETCH_COLUMN); - $value_sane = preg_replace("/\.\./", ".", (preg_replace("/\*/", ".*", $grouped_lists[0]))); + $list_items = $stmt->fetchAll(PDO::FETCH_ASSOC); + while ($item = array_shift($list_items)) { ?> - from = "/()/i"; + from = "//i"; priority = 5; @@ -238,15 +239,20 @@ while ($row = array_shift($rows)) { } whitelist_header_ { prepare("SELECT GROUP_CONCAT(REPLACE(CONCAT('\<', `value`, '\>'), '*', '.*') SEPARATOR '|') AS `value` FROM `filterconf` + $header_from = array(); + $stmt = $pdo->prepare("SELECT `value` FROM `filterconf` WHERE `object`= :object AND `option` = 'whitelist_from'"); $stmt->execute(array(':object' => $row['object'])); - $grouped_lists = $stmt->fetchAll(PDO::FETCH_COLUMN); - $value_sane = preg_replace("/\.\./", ".", (preg_replace("/\*/", ".*", $grouped_lists[0]))); + $list_items = $stmt->fetchAll(PDO::FETCH_ASSOC); ?> header = { - "From" = "/()/i"; + + "From" = "/()/i"; } blacklist_ { prepare("SELECT GROUP_CONCAT(REPLACE(CONCAT('^', `value`, '$'), '*', '.*') SEPARATOR '|') AS `value` FROM `filterconf` + $items[] = array(); + $stmt = $pdo->prepare("SELECT `value` FROM `filterconf` WHERE `object`= :object AND `option` = 'blacklist_from'"); $stmt->execute(array(':object' => $row['object'])); - $grouped_lists = $stmt->fetchAll(PDO::FETCH_COLUMN); - $value_sane = preg_replace("/\.\./", ".", (preg_replace("/\*/", ".*", $grouped_lists[0]))); + $list_items = $stmt->fetchAll(PDO::FETCH_ASSOC); + while ($item = array_shift($list_items)) { ?> - from = "/()/i"; + from = "//i"; priority = 5; @@ -330,15 +338,20 @@ while ($row = array_shift($rows)) { } blacklist_header_ { prepare("SELECT GROUP_CONCAT(REPLACE(CONCAT('\<', `value`, '\>'), '*', '.*') SEPARATOR '|') AS `value` FROM `filterconf` + $header_from = array(); + $stmt = $pdo->prepare("SELECT `value` FROM `filterconf` WHERE `object`= :object AND `option` = 'blacklist_from'"); $stmt->execute(array(':object' => $row['object'])); - $grouped_lists = $stmt->fetchAll(PDO::FETCH_COLUMN); - $value_sane = preg_replace("/\.\./", ".", (preg_replace("/\*/", ".*", $grouped_lists[0]))); + $list_items = $stmt->fetchAll(PDO::FETCH_ASSOC); ?> header = { - "From" = "/()/i"; + + "From" = "/()/i"; }