diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-12-30 18:52:58 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-12-30 18:52:58 +0000 |
commit | 7cb713aa457bb0169b2c9811555c0bc071d3c3e9 (patch) | |
tree | 9ce84eba889118794a125a9a5418b5956c30cb4d | |
parent | 927a3f3d04567098ce64b73cef90473a9a993618 (diff) | |
download | rspamd-7cb713aa457bb0169b2c9811555c0bc071d3c3e9.tar.gz rspamd-7cb713aa457bb0169b2c9811555c0bc071d3c3e9.zip |
Some fixes to macro expansion in spf.
-rw-r--r-- | src/libserver/spf.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libserver/spf.c b/src/libserver/spf.c index df5426b1d..06b53c184 100644 --- a/src/libserver/spf.c +++ b/src/libserver/spf.c @@ -1109,13 +1109,15 @@ expand_spf_macro (struct rspamd_task *task, struct spf_record *rec, break; case 1: /* We got % sign, so we should whether wait for { or for - or for _ or for % */ - if (*p == '%' || *p == '-') { + if (*p == '%' || *p == '_') { /* Just a single % sign or space */ len++; + state = 0; } - else if (*p == '_') { + else if (*p == '-') { /* %20 */ len += sizeof ("%20") - 1; + state = 0; } else if (*p == '{') { state = 2; @@ -1224,15 +1226,18 @@ expand_spf_macro (struct rspamd_task *task, struct spf_record *rec, if (*p == '%') { /* Just a single % sign or space */ *c++ = '%'; + state = 0; } - else if (*p == '-') { + else if (*p == '_') { *c++ = ' '; + state = 0; } - else if (*p == '_') { + else if (*p == '-') { /* %20 */ *c++ = '%'; *c++ = '2'; *c++ = '0'; + state = 0; } else if (*p == '{') { state = 2; @@ -1318,7 +1323,7 @@ expand_spf_macro (struct rspamd_task *task, struct spf_record *rec, len = 0; } else if (g_ascii_isdigit (*p)) { - /*XXX: try to implement domain strimming */ + /*XXX: try to implement domain trimming */ } else { msg_info ( |