action = rspamd_check_action_metric (task, metric_res);
}
- if (action <= METRIC_ACTION_NOACTION) {
+ if (action == METRIC_ACTION_SOFT_REJECT &&
+ (task->flags & RSPAMD_TASK_FLAG_GREYLISTED)) {
+ /* Set stat action to greylist to display greylisted messages */
+ action = METRIC_ACTION_GREYLIST;
+ }
+
+ if (action < METRIC_ACTION_MAX) {
#ifndef HAVE_ATOMIC_BUILTINS
task->worker->srv->stat->actions_stat[action]++;
#else
#define RSPAMD_TASK_FLAG_LOCAL_CLIENT (1 << 23)
#define RSPAMD_TASK_FLAG_COMPRESSED (1 << 24)
#define RSPAMD_TASK_FLAG_PROFILE (1 << 25)
+#define RSPAMD_TASK_FLAG_GREYLISTED (1 << 26)
#define RSPAMD_TASK_IS_SKIPPED(task) (((task)->flags & RSPAMD_TASK_FLAG_SKIP))
#define RSPAMD_TASK_IS_JSON(task) (((task)->flags & RSPAMD_TASK_FLAG_JSON))
guint processed_stages; /**< bits of stages that are processed */
enum rspamd_command cmd; /**< command */
gint sock; /**< socket descriptor */
- guint flags; /**< Bit flags */
+ guint32 flags; /**< Bit flags */
guint32 dns_requests; /**< number of DNS requests per this task */
gulong message_len; /**< Message length */
gchar *helo; /**< helo header value */
LUA_TASK_SET_FLAG (flag, "learn_ham", RSPAMD_TASK_FLAG_LEARN_HAM, set);
LUA_TASK_SET_FLAG (flag, "broken_headers",
RSPAMD_TASK_FLAG_BROKEN_HEADERS, set);
+ LUA_TASK_SET_FLAG (flag, "gerylisted", RSPAMD_TASK_FLAG_GREYLISTED, set);
if (!found) {
msg_warn_task ("unknown flag requested: %s", flag);
LUA_TASK_GET_FLAG (flag, "extended_urls", RSPAMD_TASK_FLAG_EXT_URLS);
LUA_TASK_GET_FLAG (flag, "learn_spam", RSPAMD_TASK_FLAG_LEARN_SPAM);
LUA_TASK_GET_FLAG (flag, "learn_ham", RSPAMD_TASK_FLAG_LEARN_HAM);
+ LUA_TASK_GET_FLAG (flag, "greylisted", RSPAMD_TASK_FLAG_GREYLISTED);
LUA_TASK_GET_FLAG (flag, "broken_headers",
RSPAMD_TASK_FLAG_BROKEN_HEADERS);
lua_pushstring (L, "learn_ham");
lua_rawseti (L, -2, idx++);
break;
+ case RSPAMD_TASK_FLAG_GREYLISTED:
+ lua_pushstring (L, "greylisted");
+ lua_rawseti (L, -2, idx++);
+ break;
default:
break;
}
else
task:set_pre_result('soft reject', settings['message'])
end
+ task:set_flags('greylisted')
end
elseif err then
rspamd_logger.errx(task, 'got error while getting greylisting keys: %1', err)
'new record')
if not qid then return end
task:set_pre_result(settings['action'], settings['message'])
+ task:set_flags('greylisted')
-- Create new record
ret,conn,upstream = rspamd_redis_make_request(task,
redis_params, -- connect params
task:set_metric_action('default', settings['action'])
if not qid then return end
task:set_pre_result(settings['action'], settings['message'])
+ task:set_flags('greylisted')
else
task:insert_result(settings['symbol'], 0.0, 'greylisted', 'passed')
end