diff options
author | Thomas Oettli <spacefreak@noop.ch> | 2024-09-12 18:43:10 +0200 |
---|---|---|
committer | Thomas Oettli <spacefreak@noop.ch> | 2024-09-12 18:43:10 +0200 |
commit | cf4ee94734b0d0cfd0f307210096d61ab062331e (patch) | |
tree | 999a35edf5c988c36396ca8958181906c02a3031 /lualib/plugins/dmarc.lua | |
parent | 432604236c48df74c1d7516b58aa46c236116f76 (diff) | |
download | rspamd-cf4ee94734b0d0cfd0f307210096d61ab062331e.tar.gz rspamd-cf4ee94734b0d0cfd0f307210096d61ab062331e.zip |
[Fix] Rework DMARC to correctly handle spaces in DMARC records
Issue: #4906
Diffstat (limited to 'lualib/plugins/dmarc.lua')
-rw-r--r-- | lualib/plugins/dmarc.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lualib/plugins/dmarc.lua b/lualib/plugins/dmarc.lua index 38977ff58..b05a3a0ef 100644 --- a/lualib/plugins/dmarc.lua +++ b/lualib/plugins/dmarc.lua @@ -239,9 +239,9 @@ local function gen_dmarc_grammar() local lpeg = require "lpeg" lpeg.locale(lpeg) local space = lpeg.space ^ 0 - local name = lpeg.C(lpeg.alpha ^ 1) * space - local sep = space * (lpeg.S("\\;") * space) + (lpeg.P(lpeg.graph - lpeg.P(',')) * lpeg.space ^ 1) - local value = lpeg.C(lpeg.P(lpeg.P(lpeg.graph + lpeg.space) - sep) ^ 1) + local name = lpeg.C(lpeg.alpha ^ 1) + local sep = space * lpeg.S("\\;") * space + local value = lpeg.C(lpeg.P(lpeg.P((lpeg.space ^ 1) * lpeg.graph + lpeg.P(lpeg.graph)) - sep) ^ 1) local pair = lpeg.Cg(name * "=" * space * value) * sep ^ -1 local list = lpeg.Cf(lpeg.Ct("") * pair ^ 0, rawset) local version = lpeg.P("v") * space * lpeg.P("=") * space * lpeg.P("DMARC1") |