From: Vsevolod Stakhov Date: Wed, 17 Jul 2024 14:35:18 +0000 (+0100) Subject: [Feature] Treat SPF +all in a special way X-Git-Tag: 3.9.1~3^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f8b0fd41a3b6335d86e9fa3ee25e1e5b12df1c7b;p=thirdparty%2Frspamd.git [Feature] Treat SPF +all in a special way Issue: #4996 --- diff --git a/src/libserver/spf.c b/src/libserver/spf.c index 32c020bf3b..afd77294ba 100644 --- a/src/libserver/spf.c +++ b/src/libserver/spf.c @@ -1418,7 +1418,7 @@ parse_spf_all(struct spf_record *rec, struct spf_addr *addr) /* Disallow +all */ if (addr->mech == SPF_PASS) { - addr->flags |= RSPAMD_SPF_FLAG_INVALID; + addr->flags |= RSPAMD_SPF_FLAG_INVALID | RSPAMD_SPF_FLAG_PLUSALL; msg_notice_spf("domain %s allows any SPF (+all), ignore SPF record completely", rec->sender_domain); } diff --git a/src/libserver/spf.h b/src/libserver/spf.h index cc0ee4c059..2487b6d574 100644 --- a/src/libserver/spf.h +++ b/src/libserver/spf.h @@ -77,6 +77,7 @@ typedef enum spf_action_e { #define RSPAMD_SPF_FLAG_PERMFAIL (1u << 10u) #define RSPAMD_SPF_FLAG_RESOLVED (1u << 11u) #define RSPAMD_SPF_FLAG_CACHED (1u << 12u) +#define RSPAMD_SPF_FLAG_PLUSALL (1u << 13u) /** Default SPF limits for avoiding abuse **/ #define SPF_MAX_NESTING 10 diff --git a/src/lua/lua_spf.c b/src/lua/lua_spf.c index 46e72202f1..a9bcfc80c5 100644 --- a/src/lua/lua_spf.c +++ b/src/lua/lua_spf.c @@ -89,6 +89,8 @@ lua_load_spf(lua_State *L) lua_setfield(L, -2, "perm_fail"); lua_pushinteger(L, RSPAMD_SPF_FLAG_CACHED); lua_setfield(L, -2, "cached"); + lua_pushinteger(L, RSPAMD_SPF_FLAG_PLUSALL); + lua_setfield(L, -2, "plusall"); lua_setfield(L, -2, "flags"); diff --git a/src/plugins/lua/spf.lua b/src/plugins/lua/spf.lua index 48f3c17bec..b9add61a6b 100644 --- a/src/plugins/lua/spf.lua +++ b/src/plugins/lua/spf.lua @@ -56,6 +56,7 @@ local symbols = { dnsfail = "R_SPF_DNSFAIL", permfail = "R_SPF_PERMFAIL", na = "R_SPF_NA", + plusall = "R_SPF_PLUSALL", } local default_config = {