commit 0bf4593: [Minor] Sigh, some more error paths handling fixed

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Dec 2 17:07:12 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-12-02 15:01:23 +0000
URL: https://github.com/rspamd/rspamd/commit/0bf45936043f24d24c79bc960641f9efd5df0312

[Minor] Sigh, some more error paths handling fixed

---
 src/lua/lua_spf.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/lua/lua_spf.c b/src/lua/lua_spf.c
index 333f51bbf..655691092 100644
--- a/src/lua/lua_spf.c
+++ b/src/lua/lua_spf.c
@@ -169,19 +169,19 @@ spf_lua_lib_callback (struct spf_resolved *record, struct rspamd_task *task,
 
 	if (record) {
 		if ((record->flags & RSPAMD_SPF_RESOLVED_NA)) {
-			lua_spf_push_result (cbd, RSPAMD_SPF_RESOLVED_NA, record,
+			lua_spf_push_result (cbd, RSPAMD_SPF_RESOLVED_NA, NULL,
 					"no record found");
 		}
 		else if (record->elts->len == 0 && (record->flags & RSPAMD_SPF_RESOLVED_TEMP_FAILED)) {
-			lua_spf_push_result (cbd, RSPAMD_SPF_RESOLVED_TEMP_FAILED, record,
+			lua_spf_push_result (cbd, RSPAMD_SPF_RESOLVED_TEMP_FAILED, NULL,
 					"temporary resolution error");
 		}
 		else if (record->elts->len == 0 && (record->flags & RSPAMD_SPF_RESOLVED_PERM_FAILED)) {
-			lua_spf_push_result (cbd, RSPAMD_SPF_RESOLVED_PERM_FAILED, record,
+			lua_spf_push_result (cbd, RSPAMD_SPF_RESOLVED_PERM_FAILED, NULL,
 					"permanent resolution error");
 		}
 		else if (record->elts->len == 0) {
-			lua_spf_push_result (cbd, RSPAMD_SPF_RESOLVED_PERM_FAILED, record,
+			lua_spf_push_result (cbd, RSPAMD_SPF_RESOLVED_PERM_FAILED, NULL,
 					"record is empty");
 		}
 		else if (record->domain) {
@@ -190,7 +190,7 @@ spf_lua_lib_callback (struct spf_resolved *record, struct rspamd_task *task,
 			spf_record_unref (record);
 		}
 		else {
-			lua_spf_push_result (cbd, RSPAMD_SPF_RESOLVED_PERM_FAILED, record,
+			lua_spf_push_result (cbd, RSPAMD_SPF_RESOLVED_PERM_FAILED, NULL,
 					"internal error: non empty record for no domain");
 		}
 	}
@@ -300,11 +300,8 @@ spf_check_element (lua_State *L, struct spf_resolved *rec, struct spf_addr *addr
 
 	if (addr->flags & RSPAMD_SPF_FLAG_TEMPFAIL) {
 		/* Ignore failed addresses */
-		lua_pushboolean (L, false);
-		lua_pushinteger (L, RSPAMD_SPF_FLAG_TEMPFAIL);
-		lua_pushstring (L, "temp failed");
 
-		return 3;
+		return -1;
 	}
 
 	af = rspamd_inet_address_get_af (ip->addr);
@@ -357,12 +354,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_spf_push_spf_addr (L, addr);
+				lua_pushstring (L, "any perm fail");
 			}
 			else if (rec->flags & RSPAMD_SPF_RESOLVED_TEMP_FAILED) {
 				lua_pushboolean (L, false);
 				lua_pushinteger (L, RSPAMD_SPF_RESOLVED_TEMP_FAILED);
-				lua_spf_push_spf_addr (L, addr);
+				lua_pushfstring (L, "any temp fail");
 			}
 			else {
 				lua_pushboolean (L, true);


More information about the Commits mailing list