From 8dc9f3bed874f0944c4120fd9ec0c65eff0b2359 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 20 Jul 2010 17:12:32 +0400 Subject: [PATCH] * Fix expanding spf macros that may fail in rare cases --- src/plugins/lua/whitelist.lua | 2 +- src/spf.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/lua/whitelist.lua b/src/plugins/lua/whitelist.lua index 34867bd2f0..b1cab1aa15 100644 --- a/src/plugins/lua/whitelist.lua +++ b/src/plugins/lua/whitelist.lua @@ -50,7 +50,7 @@ if opts then end if symbol_from then if opts['from_whitelist'] then - h = rspamd_config:add_host_map (opts['from_whitelist']) + h = rspamd_config:add_hash_map (opts['from_whitelist']) else -- No whitelist defined symbol_from = nil diff --git a/src/spf.c b/src/spf.c index 3f735457ac..79a0855ea6 100644 --- a/src/spf.c +++ b/src/spf.c @@ -630,6 +630,7 @@ expand_spf_macro (struct worker_task *task, struct spf_record *rec, char *begin) { char *p, *c, *new, *tmp; int len = 0, slen = 0, state = 0; + gboolean need_expand = FALSE; p = begin; /* Calculate length */ @@ -706,6 +707,7 @@ expand_spf_macro (struct worker_task *task, struct spf_record *rec, char *begin) /* Read modifier */ if (*p == '}') { state = 0; + need_expand = TRUE; } else if (*p != 'r' && !g_ascii_isdigit (*p)) { msg_info ("unknown or unsupported spf modifier %c in %s", *p, begin); @@ -717,7 +719,7 @@ expand_spf_macro (struct worker_task *task, struct spf_record *rec, char *begin) } } - if (slen == len) { + if (!need_expand) { /* No expansion needed */ return begin; } -- 2.47.3