commit ff07415: [Minor] Ratelimit: Fix formatting issue

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Mar 27 20:14:14 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-03-27 20:10:03 +0000
URL: https://github.com/rspamd/rspamd/commit/ff07415a3b827737a6be30d3d36ef123363556e1 (HEAD -> master)

[Minor] Ratelimit: Fix formatting issue

---
 src/lua/lua_mempool.c          | 6 ++++--
 src/plugins/lua/reputation.lua | 9 ++++++---
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/lua/lua_mempool.c b/src/lua/lua_mempool.c
index 396f39170..5f1fe46b3 100644
--- a/src/lua/lua_mempool.c
+++ b/src/lua/lua_mempool.c
@@ -524,8 +524,10 @@ lua_mempool_get_variable (lua_State *L)
 
 				return nvar;
 			}
-
-			lua_pushstring (L, value);
+			else {
+				/* No type specified, return string */
+				lua_pushstring(L, value);
+			}
 		}
 		else {
 			lua_pushnil (L);
diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua
index 5ee16354b..d846ece9a 100644
--- a/src/plugins/lua/reputation.lua
+++ b/src/plugins/lua/reputation.lua
@@ -411,19 +411,22 @@ local function ip_reputation_filter(task, rule)
     if asn_stats then
       local asn_score = generic_reputation_calc(asn_stats, rule, cfg.scores.asn, task)
       score = score + asn_score
-      table.insert(description_t, string.format('asn: %s(%.2f)', asn, asn_score))
+      table.insert(description_t, string.format('asn: %s(%.2f)',
+              asn, asn_score))
     end
     if country_stats then
       local country_score = generic_reputation_calc(country_stats, rule,
           cfg.scores.country, task)
       score = score + country_score
-      table.insert(description_t, string.format('country: %s(%.2f)', country, country_score))
+      table.insert(description_t, string.format('country: %s(%.2f)',
+              country, country_score))
     end
     if ip_stats then
       local ip_score = generic_reputation_calc(ip_stats, rule, cfg.scores.ip,
         task)
       score = score + ip_score
-      table.insert(description_t, string.format('ip: %s(%.2f)', ip, ip_score))
+      table.insert(description_t, string.format('ip: %s(%.2f)',
+              tostring(ip), ip_score))
     end
 
     if math.abs(score) > 0.001 then


More information about the Commits mailing list