if (!rspamd_map_add (cfg, ucl_obj_tostring (value),
"DKIM domains", rspamd_kv_list_read, rspamd_kv_list_fin,
(void **)&dkim_module_ctx->dkim_domains)) {
- msg_warn ("cannot load dkim domains list from %s",
+ msg_warn_config ("cannot load dkim domains list from %s",
ucl_obj_tostring (value));
}
else {
if (!rspamd_map_add (cfg, ucl_obj_tostring (value),
"DKIM domains", rspamd_kv_list_read, rspamd_kv_list_fin,
(void **)&dkim_module_ctx->dkim_domains)) {
- msg_warn ("cannot load dkim domains list from %s",
+ msg_warn_config ("cannot load dkim domains list from %s",
ucl_obj_tostring (value));
}
else {
}
if (dkim_module_ctx->trusted_only && !got_trusted) {
- msg_err (
+ msg_err_config (
"trusted_only option is set and no trusted domains are defined; disabling dkim module completely as it is useless in this case");
}
else {
#ifndef HAVE_OPENSSL
- msg_warn (
+ msg_warn_config (
"openssl is not found so dkim rsa check is disabled, only check body hash, it is NOT safe to trust these results");
#endif
}
gboolean all_done = TRUE, got_allow = FALSE;
const gchar *strict_value;
struct dkim_check_result *first, *cur, *sel = NULL;
+ struct rspamd_task *task = res->task;
first = res->first;
}
if (cur->key != NULL && cur->res == -1) {
- msg_debug ("check dkim signature for %s domain from %s",
+ msg_debug_task ("check dkim signature for %s domain from %s",
cur->ctx->domain,
cur->ctx->dns_key);
cur->res = rspamd_dkim_check (cur->ctx, cur->key, cur->task);
FALSE);
if (hlist != NULL) {
/* Check whitelist */
- msg_debug ("dkim signature found");
+ msg_debug_task ("dkim signature found");
if (radix_find_compressed_addr (dkim_module_ctx->whitelist_ip,
task->from_addr) == RADIX_NO_VALUE) {
/* Parse signature */
- msg_debug ("create dkim signature");
+ msg_debug_task ("create dkim signature");
while (hlist != NULL) {
rh = (struct raw_header *)hlist->data;
&err);
if (ctx == NULL) {
if (err != NULL) {
- msg_info ("<%s> cannot parse DKIM context: %s",
+ msg_info_task ("<%s> cannot parse DKIM context: %s",
task->message_id, err->message);
g_error_free (err);
}
else {
- msg_info ("<%s> cannot parse DKIM context: unknown error",
+ msg_info_task ("<%s> cannot parse DKIM context: "
+ "unknown error",
task->message_id);
}
(dkim_module_ctx->dkim_domains == NULL ||
g_hash_table_lookup (dkim_module_ctx->dkim_domains,
ctx->domain) == NULL)) {
- msg_debug ("skip dkim check for %s domain", ctx->domain);
+ msg_debug_task ("skip dkim check for %s domain",
+ ctx->domain);
hlist = g_list_next (hlist);
continue;
const gchar *sym = NULL;
if (val->type == UCL_STRING) {
- msg_err (
+ msg_err_config (
"string mappings are deprecated and no longer supported, use new style configuration");
}
else if (val->type == UCL_OBJECT) {
cb_id);
}
else {
- msg_err ("fuzzy_map parameter has no flag definition");
+ msg_err_config ("fuzzy_map parameter has no flag definition");
}
}
else {
- msg_err ("fuzzy_map parameter has no symbol definition");
+ msg_err_config ("fuzzy_map parameter has no symbol definition");
}
}
else {
- msg_err ("fuzzy_map parameter is of an unsupported type");
+ msg_err_config ("fuzzy_map parameter is of an unsupported type");
}
}
const char *k = NULL;
if (obj->type != UCL_OBJECT) {
- msg_err ("invalid rule definition");
+ msg_err_config ("invalid rule definition");
return -1;
}
rule->shingles_key->len = 16;
if (rspamd_upstreams_count (rule->servers) == 0) {
- msg_err ("no servers defined for fuzzy rule with symbol: %s",
+ msg_err_config ("no servers defined for fuzzy rule with symbol: %s",
rule->symbol);
return -1;
}
}
if (fuzzy_module_ctx->fuzzy_rules == NULL) {
- msg_warn ("fuzzy module is enabled but no rules are defined");
+ msg_warn_config ("fuzzy module is enabled but no rules are defined");
}
return res;
}
blake2b_final (&st, shcmd->basic.digest, sizeof (shcmd->basic.digest));
- msg_debug ("loading shingles with key %*xs", 16, rule->shingles_key->str);
+ msg_debug_pool ("loading shingles with key %*xs", 16,
+ rule->shingles_key->str);
sh = rspamd_shingles_generate (words,
rule->shingles_key->str, pool,
rspamd_shingles_default_filter, NULL);
{
struct fuzzy_client_session *session = arg;
const struct rspamd_fuzzy_reply *rep;
+ struct rspamd_task *task;
struct fuzzy_mapping *map;
guchar buf[2048], *p;
const gchar *symbol;
double nval;
gint ret = -1;
+ task = session->task;
+
if (what == EV_WRITE) {
if (!fuzzy_cmd_vector_to_wire (fd, session->commands)) {
ret = -1;
if (rep->prob > 0.5) {
nval = fuzzy_normalize (rep->value, session->rule->max_score);
nval *= rep->prob;
- msg_info (
+ msg_info_task (
"<%s>, found fuzzy hash with weight: %.2f, in list: %s:%d%s",
session->task->message_id,
nval,
return;
}
else if (ret == -1) {
- msg_err ("got error on IO with server %s, %d, %s",
+ msg_err_task ("got error on IO with server %s, %d, %s",
rspamd_upstream_name (session->server),
errno,
strerror (errno));
struct fuzzy_learn_session *session = arg;
const struct rspamd_fuzzy_reply *rep;
struct fuzzy_mapping *map;
+ struct rspamd_task *task;
guchar buf[2048], *p;
const gchar *symbol;
gint r;
gint ret = 0;
+ task = session->task;
+
if (what == EV_WRITE) {
/* Send commands to storage */
if (!fuzzy_cmd_vector_to_wire (fd, session->commands)) {
}
else if (what == EV_READ) {
if ((r = read (fd, buf, sizeof (buf) - 1)) == -1) {
- msg_info ("cannot process fuzzy hash for message <%s>",
+ msg_info_task ("cannot process fuzzy hash for message <%s>",
session->task->message_id);
if (*(session->err) == NULL) {
g_set_error (session->err,
}
if (rep->prob > 0.5) {
- msg_info ("processed fuzzy hash, list: %s:%d for message <%s>",
+ msg_info_task ("processed fuzzy hash, list: %s:%d for "
+ "message <%s>",
symbol,
rep->flag,
session->task->message_id);
ret = 1;
}
else {
- msg_info ("cannot process fuzzy hash for message <%s>, list %s:%d",
+ msg_info_task ("cannot process fuzzy hash for message "
+ "<%s>, "
+ "list %s:%d",
session->task->message_id,
symbol,
rep->flag);
return;
}
else if (ret == -1) {
- msg_err ("got error in IO with server %s, %d, %s",
+ msg_err_task ("got error in IO with server %s, %d, %s",
rspamd_upstream_name (session->server), errno, strerror (errno));
rspamd_upstream_fail (session->server);
}
/* Check length of part */
if (fuzzy_module_ctx->min_bytes > part->content->len) {
- msg_info ("<%s>, part is shorter than %d symbols, skip fuzzy check",
+ msg_info_task ("<%s>, part is shorter than %d symbols, skip fuzzy "
+ "check",
task->message_id, fuzzy_module_ctx->min_bytes);
continue;
}
if (part->words == NULL || part->words->len == 0) {
- msg_info ("<%s>, part hash empty, skip fuzzy check",
+ msg_info_task ("<%s>, part hash empty, skip fuzzy check",
task->message_id, fuzzy_module_ctx->min_hash_len);
continue;
}
if (fuzzy_module_ctx->min_hash_len != 0 &&
part->words->len < fuzzy_module_ctx->min_hash_len) {
- msg_info (
+ msg_info_task (
"<%s>, part hash is shorter than %d symbols, skip fuzzy check",
task->message_id,
fuzzy_module_ctx->min_hash_len);
if (selected) {
if ((sock = rspamd_inet_address_connect (rspamd_upstream_addr (selected),
SOCK_DGRAM, TRUE)) == -1) {
- msg_warn ("cannot connect to %s, %d, %s",
+ msg_warn_task ("cannot connect to %s, %d, %s",
rspamd_upstream_name (selected),
errno,
strerror (errno));
if (fuzzy_module_ctx->whitelist) {
if (radix_find_compressed_addr (fuzzy_module_ctx->whitelist,
task->from_addr) != RADIX_NO_VALUE) {
- msg_info ("<%s>, address %s is whitelisted, skip fuzzy check",
+ msg_info_task ("<%s>, address %s is whitelisted, skip fuzzy check",
task->message_id,
rspamd_inet_address_to_string (task->from_addr));
return;
err = rspamd_mempool_alloc0 (task->task_pool, sizeof (GError *));
r = rspamd_message_parse (task);
if (r == -1) {
- msg_warn ("<%s>: cannot process message for fuzzy", task->message_id);
+ msg_warn_task ("<%s>: cannot process message for fuzzy",
+ task->message_id);
rspamd_task_free (task, FALSE);
rspamd_controller_send_error (conn_ent, 400,
"Message processing error");
}
if (res == -1) {
- msg_warn ("<%s>: cannot send fuzzy request: %s", task->message_id,
+ msg_warn_task ("<%s>: cannot send fuzzy request: %s", task->message_id,
strerror (errno));
rspamd_controller_send_error (conn_ent, 400, "Message sending error");
rspamd_task_free (task, FALSE);
}
else if (!processed) {
if (rules) {
- msg_warn ("<%s>: no content to generate fuzzy", task->message_id);
+ msg_warn_task ("<%s>: no content to generate fuzzy",
+ task->message_id);
rspamd_controller_send_error (conn_ent, 404,
"No content to generate fuzzy for flag %d", flag);
}
else {
- msg_warn ("<%s>: no fuzzy rules found for flag %d", task->message_id,
+ msg_warn_task ("<%s>: no fuzzy rules found for flag %d",
+ task->message_id,
flag);
rspamd_controller_send_error (conn_ent, 404,
"No fuzzy rules matched for flag %d", flag);
if (!rspamd_parse_expression (line, 0, &mime_expr_subr, cfg, pool, &err,
&e)) {
- msg_warn ("%s = \"%s\" is invalid regexp expression: %e", symbol, line,
+ msg_warn_pool ("%s = \"%s\" is invalid regexp expression: %e", symbol,
+ line,
err);
g_error_free (err);
sec = ucl_object_find_key (cfg->rcl_obj, "regexp");
if (sec == NULL) {
- msg_err ("regexp module enabled, but no rules are defined");
+ msg_err_config ("regexp module enabled, but no rules are defined");
return TRUE;
}
}
else if (g_ascii_strncasecmp (ucl_object_key (value), "max_threads",
sizeof ("max_threads") - 1) == 0) {
- msg_warn ("regexp module is now single threaded, max_threads is ignored");
+ msg_warn_config ("regexp module is now single threaded, max_threads is ignored");
}
else if (value->type == UCL_STRING) {
cur_item = rspamd_mempool_alloc0 (regexp_module_ctx->regexp_pool,
}
}
else {
- msg_err (
+ msg_err_config (
"no callback/expression defined for regexp symbol: "
"%s", ucl_object_key (value));
}
}
}
else {
- msg_warn ("unknown type of attribute %s for regexp module",
+ msg_warn_config ("unknown type of attribute %s for regexp module",
ucl_object_key (value));
}
}
lua_pushboolean (L, (gboolean) GPOINTER_TO_SIZE(arg->data));
break;
default:
- msg_err("cannot pass custom params to lua function");
+ msg_err_task ("cannot pass custom params to lua function");
return FALSE;
}
}
}
if (lua_pcall (L, nargs + 1, 1, 0) != 0) {
- msg_info("call to lua function failed: %s", lua_tostring (L, -1));
+ msg_info_task ("call to lua function failed: %s", lua_tostring (L, -1));
return FALSE;
}
pop++;
*res = lua_toboolean (L, -1);
}
else {
- msg_info("lua function must return a boolean");
+ msg_info_task ("lua function must return a boolean");
}
lua_pop (L, pop);
res = FALSE;
if (!rspamd_lua_call_expression_func (item->lua_function, task, NULL,
&res)) {
- msg_err ("error occurred when checking symbol %s", item->symbol);
+ msg_err_task ("error occurred when checking symbol %s",
+ item->symbol);
}
}
else {
res = rspamd_process_expression (item->expr, 0, task);
}
else {
- msg_warn ("FIXME: %s symbol is broken with new expressions",
+ msg_warn_task ("FIXME: %s symbol is broken with new expressions",
item->symbol);
}
}