aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-12-17 13:49:30 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-12-17 13:49:30 +0000
commit50e53039c4259a66124ec2bf481da8fc85d551b7 (patch)
tree35845ee194afbc5ccf0949d2ae580aaf2735e444 /src/lua
parent04e354d919c8802d94de60cc2c8d9ad7c192df6d (diff)
downloadrspamd-50e53039c4259a66124ec2bf481da8fc85d551b7.tar.gz
rspamd-50e53039c4259a66124ec2bf481da8fc85d551b7.zip
[Minor] Fix default policy application
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_spf.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/lua/lua_spf.c b/src/lua/lua_spf.c
index 743d523e5..9cb6261f8 100644
--- a/src/lua/lua_spf.c
+++ b/src/lua/lua_spf.c
@@ -429,11 +429,19 @@ lua_spf_record_check_ip (lua_State *L)
for (guint i = 0; i < record->elts->len; i ++) {
struct spf_addr *addr = &g_array_index (record->elts, struct spf_addr, i);
if ((nres = spf_check_element (L, record, addr, ip)) > 0) {
+ if (need_free_ip) {
+ g_free (ip);
+ }
+
return nres;
}
}
}
else {
+ if (need_free_ip) {
+ g_free (ip);
+ }
+
return luaL_error (L, "invalid arguments");
}
@@ -441,9 +449,20 @@ lua_spf_record_check_ip (lua_State *L)
g_free (ip);
}
- lua_pushboolean (L, false);
- lua_pushinteger (L, RSPAMD_SPF_RESOLVED_NA);
- lua_pushstring (L, "no result");
+ /* If we are here it means that there is no ALL record */
+ /*
+ * According to https://tools.ietf.org/html/rfc7208#section-4.7 it means
+ * SPF neutral
+ */
+ struct spf_addr fake_all;
+
+ fake_all.mech = SPF_NEUTRAL;
+ fake_all.flags = RSPAMD_SPF_FLAG_ANY;
+ fake_all.spf_string = "all";
+
+ lua_pushboolean (L, true);
+ lua_pushinteger (L, SPF_NEUTRAL);
+ lua_spf_push_spf_addr (L, &fake_all);
return 3;
}