]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Revert back options for temp/permfail in SPF
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Dec 2019 13:38:07 +0000 (13:38 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Dec 2019 13:38:07 +0000 (13:38 +0000)
src/libserver/spf.h
src/lua/lua_spf.c

index 6fd3e15833ed98b42b36b844a562141a77dc754a..451cb500348e11ed070057b7329a61f6c5fd881d 100644 (file)
@@ -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,
index e3c0686b7f5d9c1f13894e3f4e024a39c7e58329..743d523e55767f10ff9035e703b57dd752c6956b 100644 (file)
@@ -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);