summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-06-23 13:52:41 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-06-23 13:52:41 +0100
commit86a83ea8f15d57e530b4fa937aa9e4720f3e7444 (patch)
tree9014b7001ef473ba45e1015af11c5e956d93f71f
parent2345e3aa48f4d59dd5fe5f93e39210942d5a9806 (diff)
downloadrspamd-86a83ea8f15d57e530b4fa937aa9e4720f3e7444.tar.gz
rspamd-86a83ea8f15d57e530b4fa937aa9e4720f3e7444.zip
Fix issues with bounces From processing.
-rw-r--r--src/libserver/task.c21
-rw-r--r--src/plugins/lua/forged_recipients.lua2
-rw-r--r--src/plugins/lua/multimap.lua8
-rw-r--r--src/plugins/lua/ratelimit.lua2
4 files changed, 22 insertions, 11 deletions
diff --git a/src/libserver/task.c b/src/libserver/task.c
index 1638a46f3..c04aecc0f 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -490,16 +490,25 @@ rspamd_task_add_sender (struct rspamd_task *task, const gchar *sender)
task->from_envelope);
#endif
}
- tmp_addr = internet_address_list_parse_string (sender);
- if (tmp_addr) {
- internet_address_list_append (task->from_envelope, tmp_addr);
+ if (strcmp (sender, "<>") == 0) {
+ /* Workaround for gmime */
+ internet_address_list_add (task->from_envelope,
+ internet_address_mailbox_new ("", ""));
+ return TRUE;
+ }
+ else {
+ tmp_addr = internet_address_list_parse_string (sender);
+
+ if (tmp_addr) {
+ internet_address_list_append (task->from_envelope, tmp_addr);
#ifdef GMIME24
- g_object_unref (tmp_addr);
+ g_object_unref (tmp_addr);
#else
- internet_address_list_destroy (tmp_addr);
+ internet_address_list_destroy (tmp_addr);
#endif
- return TRUE;
+ return TRUE;
+ }
}
return FALSE;
diff --git a/src/plugins/lua/forged_recipients.lua b/src/plugins/lua/forged_recipients.lua
index 170c2cd53..c4a00c57b 100644
--- a/src/plugins/lua/forged_recipients.lua
+++ b/src/plugins/lua/forged_recipients.lua
@@ -63,7 +63,7 @@ local function check_forged_headers(task)
end
-- Check sender
local smtp_from = task:get_from(1)
- if smtp_from and smtp_from[1] then
+ if smtp_from and smtp_from[1] and smtp_from[1]['addr'] ~= '' then
local mime_from = task:get_from(2)
if not mime_from or not mime_from[1] or
not (string.lower(mime_from[1]['addr']) == string.lower(smtp_from[1]['addr'])) then
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index c9b535e67..cd6aa5a1c 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -78,10 +78,12 @@ local function check_multimap(task)
if fields then
_.each(function(e)
local match = e[fields[1]]
- if fields[2] then
- match = fields[2](match)
+ if match then
+ if fields[2] then
+ match = fields[2](match)
+ end
+ ret = match_rule(r, match)
end
- ret = match_rule(r, match)
end, ls)
else
_.each(function(e) ret = match_rule(r, e) end, ls)
diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua
index afc8eda0f..1c1dc4dd6 100644
--- a/src/plugins/lua/ratelimit.lua
+++ b/src/plugins/lua/ratelimit.lua
@@ -242,7 +242,7 @@ local function rate_test_set(task, func)
local from = task:get_from()
local from_user = '<>'
local from_addr = '<>'
- if from then
+ if from and from[1]['addr'] then
from_user = from[1]['user']
from_addr = from[1]['addr']
end