commit 04e354d: [Minor] Revert back options for temp/permfail in SPF
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Dec 17 15:14:06 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-12-17 13:38:07 +0000
URL: https://github.com/rspamd/rspamd/commit/04e354d919c8802d94de60cc2c8d9ad7c192df6d
[Minor] Revert back options for temp/permfail in SPF
---
src/libserver/spf.h | 15 +++++++++++++++
src/lua/lua_spf.c | 4 ++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/libserver/spf.h b/src/libserver/spf.h
index 6fd3e1583..451cb5003 100644
--- a/src/libserver/spf.h
+++ b/src/libserver/spf.h
@@ -22,6 +22,21 @@ typedef enum spf_mech_e {
SPF_NEUTRAL
} spf_mech_t;
+static inline gchar spf_mech_char (spf_mech_t mech)
+{
+ switch (mech) {
+ case SPF_FAIL:
+ return '-';
+ case SPF_SOFT_FAIL:
+ return '~';
+ case SPF_PASS:
+ return '+';
+ case SPF_NEUTRAL:
+ default:
+ return '?';
+ }
+}
+
typedef enum spf_action_e {
SPF_RESOLVE_MX,
SPF_RESOLVE_A,
diff --git a/src/lua/lua_spf.c b/src/lua/lua_spf.c
index e3c0686b7..743d523e5 100644
--- a/src/lua/lua_spf.c
+++ b/src/lua/lua_spf.c
@@ -360,12 +360,12 @@ spf_check_element (lua_State *L, struct spf_resolved *rec, struct spf_addr *addr
if (rec->flags & RSPAMD_SPF_RESOLVED_PERM_FAILED) {
lua_pushboolean (L, false);
lua_pushinteger (L, RSPAMD_SPF_RESOLVED_PERM_FAILED);
- lua_pushstring (L, "any perm fail");
+ lua_pushfstring (L, "%cany", spf_mech_char (addr->mech));
}
else if (rec->flags & RSPAMD_SPF_RESOLVED_TEMP_FAILED) {
lua_pushboolean (L, false);
lua_pushinteger (L, RSPAMD_SPF_RESOLVED_TEMP_FAILED);
- lua_pushfstring (L, "any temp fail");
+ lua_pushfstring (L, "%cany", spf_mech_char (addr->mech));
}
else {
lua_pushboolean (L, true);
More information about the Commits
mailing list