LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
- if (task && task->message) {
- switch (MESSAGE_FIELD (task, nlines_type)) {
- case RSPAMD_TASK_NEWLINES_CR:
- lua_pushstring (L, "cr");
- break;
- case RSPAMD_TASK_NEWLINES_LF:
- lua_pushstring (L, "lf");
- break;
- case RSPAMD_TASK_NEWLINES_CRLF:
- default:
+ if (task) {
+ if (task->message) {
+ switch (MESSAGE_FIELD (task, nlines_type)) {
+ case RSPAMD_TASK_NEWLINES_CR:
+ lua_pushstring (L, "cr");
+ break;
+ case RSPAMD_TASK_NEWLINES_LF:
+ lua_pushstring (L, "lf");
+ break;
+ case RSPAMD_TASK_NEWLINES_CRLF:
+ default:
+ lua_pushstring (L, "crlf");
+ break;
+ }
+ }
+ else {
lua_pushstring (L, "crlf");
- break;
}
}
else {
local rspamd_logger = require "rspamd_logger"
local rspamd_util = require "rspamd_util"
+local lua_redis = require "lua_redis"
local fun = require "fun"
local hash = require "rspamd_cryptobox_hash"
local rspamd_lua_utils = require "lua_util"
end
end
- local ret = rspamd_redis_make_request(task,
- redis_params, -- connect params
- hash_key, -- hash key
- false, -- is write
- redis_get_cb, --callback
- 'MGET', -- command
- {body_key, meta_key} -- arguments
+ local ret = lua_redis.redis_make_request(task,
+ redis_params, -- connect params
+ hash_key, -- hash key
+ false, -- is write
+ redis_get_cb, --callback
+ 'MGET', -- command
+ {body_key, meta_key} -- arguments
)
if not ret then
rspamd_logger.errx(task, 'cannot make redis request to check results')
if not settings.check_local and is_rspamc then return end
- ret,conn,upstream = rspamd_redis_make_request(task,
+ ret,conn,upstream = lua_redis.make_request(task,
redis_params, -- connect params
hash_key, -- hash key
true, -- is write
rspamd_logger.infox(task, 'greylisted until "%s", new record', end_time)
greylist_message(task, end_time, 'new record')
-- Create new record
- ret,conn,upstream = rspamd_redis_make_request(task,
+ ret,conn,upstream = lua_redis.redis_make_request(task,
redis_params, -- connect params
hash_key, -- hash key
true, -- is write
whitelist_domains_map = lua_map.rspamd_map_add(N, 'whitelist_domains_url',
'map', 'Greylist whitelist domains map')
- redis_params = rspamd_parse_redis_server(N)
+ redis_params = lua_redis.parse_redis_server(N)
if not redis_params then
rspamd_logger.infox(rspamd_config, 'no servers are specified, disabling module')
rspamd_lua_utils.disable_module(N, "redis")
type = 'postfilter',
callback = greylist_set,
priority = 6,
- flags = 'empty',
})
rspamd_config:register_symbol({
name = 'GREYLIST_CHECK',
type = 'prefilter',
callback = greylist_check,
priority = 6,
- flags = 'empty',
})
end
end