aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_scanners/p0f.lua
diff options
context:
space:
mode:
authordenpamusic <denpa@netfleet.space>2019-09-18 18:29:43 +0300
committerdenpamusic <denpa@netfleet.space>2019-09-18 18:29:43 +0300
commitedb449b3b936b8721e891d7552647a0d19b84e20 (patch)
tree40608235dd8b8c0ffde8e714c051af6c7c1ce624 /lualib/lua_scanners/p0f.lua
parent1a64f6be2c5e8e5177ec157df737b8db96ea9ec0 (diff)
downloadrspamd-edb449b3b936b8721e891d7552647a0d19b84e20.tar.gz
rspamd-edb449b3b936b8721e891d7552647a0d19b84e20.zip
[Minor] Fix typos in p0f plugin
- Improved tests to include cached response cases - Changed default socket location to /var/run/p0f as per @moisseev recommendation
Diffstat (limited to 'lualib/lua_scanners/p0f.lua')
-rw-r--r--lualib/lua_scanners/p0f.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/lualib/lua_scanners/p0f.lua b/lualib/lua_scanners/p0f.lua
index 72093577b..b27a42ef6 100644
--- a/lualib/lua_scanners/p0f.lua
+++ b/lualib/lua_scanners/p0f.lua
@@ -51,10 +51,10 @@ local function p0f_check(task, ip, rule)
local function trim(...)
local vars = {...}
- for k in pairs(vars) do
+ for k, v in ipairs(vars) do
-- skip numbers, trim only strings
if tonumber(vars[k]) == nil then
- vars[k] = string.gsub(vars[k], '[^%w-_\\.\\(\\) ]', '')
+ vars[k] = string.gsub(v, '[^%w-_\\.\\(\\) ]', '')
end
end
@@ -71,7 +71,7 @@ local function p0f_check(task, ip, rule)
data = tostring(data)
-- API response must be 232 bytes long
- if (#data < 232) then
+ if #data ~= 232 then
rspamd_logger.errx(task, 'malformed response from p0f on %s, %s bytes',
rule.socket, #data)
@@ -112,7 +112,6 @@ local function p0f_check(task, ip, rule)
local function redis_set_cb(redis_set_err)
if redis_set_err then
rspamd_logger.errx(task, 'redis received an error: %s', redis_set_err)
- return
end
end
@@ -156,7 +155,7 @@ local function p0f_check(task, ip, rule)
end
local ret = nil
- if rule.redis_prams then
+ if rule.redis_params then
local key = rule.prefix .. ip:to_string()
ret = lua_redis.redis_make_request(task,
rule.redis_params,