aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-08-30 01:55:21 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-08-30 01:55:21 +0100
commitaf05d946e5cdd634d05434ebd294f0a31264645b (patch)
tree908cd8498ef5f908cece1aab17d54e40a8b395d2
parent45dfcb815b0ba7996978d22fa3d7de6756ad86b9 (diff)
downloadrspamd-af05d946e5cdd634d05434ebd294f0a31264645b.tar.gz
rspamd-af05d946e5cdd634d05434ebd294f0a31264645b.zip
Update mime code for the new logger.
-rw-r--r--src/libmime/filter.c9
-rw-r--r--src/libmime/images.c8
-rw-r--r--src/libmime/message.c46
-rw-r--r--src/libmime/mime_expressions.c94
4 files changed, 81 insertions, 76 deletions
diff --git a/src/libmime/filter.c b/src/libmime/filter.c
index c24f42f35..7efb8f82a 100644
--- a/src/libmime/filter.c
+++ b/src/libmime/filter.c
@@ -132,7 +132,7 @@ insert_metric_result (struct rspamd_task *task,
/* XXX: does not take grow factor into account */
if (gr != NULL && gr_score != NULL && gr->max_score > 0.0) {
if (*gr_score >= gr->max_score) {
- msg_info ("maximum group score %.2f for group %s has been reached,"
+ msg_info_task ("maximum group score %.2f for group %s has been reached,"
" ignoring symbol %s with weight %.2f", gr->max_score,
gr->name, symbol, w);
return;
@@ -368,7 +368,8 @@ rspamd_action_to_str (enum rspamd_metric_action action)
}
static double
-get_specific_action_score (const ucl_object_t *metric,
+get_specific_action_score (struct rspamd_task *task,
+ const ucl_object_t *metric,
struct metric_action *action)
{
const ucl_object_t *act, *sact;
@@ -381,7 +382,7 @@ get_specific_action_score (const ucl_object_t *metric,
act_name = rspamd_action_to_str (action->action);
sact = ucl_object_find_key (act, act_name);
if (sact != NULL && ucl_object_todouble_safe (sact, &score)) {
- msg_debug ("found override score %.2f for action %s in settings",
+ msg_debug_task ("found override score %.2f for action %s in settings",
score, act_name);
return score;
}
@@ -408,7 +409,7 @@ rspamd_check_action_metric (struct rspamd_task *task,
double sc;
action = &metric->actions[i];
- sc = get_specific_action_score (ms, action);
+ sc = get_specific_action_score (task, ms, action);
if (sc < 0) {
continue;
diff --git a/src/libmime/images.c b/src/libmime/images.c
index 30fe2cb6f..419b6a2ca 100644
--- a/src/libmime/images.c
+++ b/src/libmime/images.c
@@ -90,7 +90,7 @@ process_png_image (struct rspamd_task *task, GByteArray *data)
guint8 *p;
if (data->len < 24) {
- msg_info ("bad png detected (maybe striped): <%s>", task->message_id);
+ msg_info_task ("bad png detected (maybe striped): <%s>", task->message_id);
return NULL;
}
@@ -98,7 +98,7 @@ process_png_image (struct rspamd_task *task, GByteArray *data)
/* Skip signature and read header section */
p = data->data + 12;
if (memcmp (p, "IHDR", 4) != 0) {
- msg_info ("png doesn't begins with IHDR section", task->message_id);
+ msg_info_task ("png doesn't begins with IHDR section", task->message_id);
return NULL;
}
@@ -154,7 +154,7 @@ process_gif_image (struct rspamd_task *task, GByteArray *data)
guint16 t;
if (data->len < 10) {
- msg_info ("bad gif detected (maybe striped): <%s>", task->message_id);
+ msg_info_task ("bad gif detected (maybe striped): <%s>", task->message_id);
return NULL;
}
@@ -179,7 +179,7 @@ process_bmp_image (struct rspamd_task *task, GByteArray *data)
guint8 *p;
if (data->len < 28) {
- msg_info ("bad bmp detected (maybe striped): <%s>", task->message_id);
+ msg_info_task ("bad bmp detected (maybe striped): <%s>", task->message_id);
return NULL;
}
diff --git a/src/libmime/message.c b/src/libmime/message.c
index 404c8f3c7..67896c6c0 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -371,7 +371,8 @@ parse_recv_header (rspamd_mempool_t * pool,
}
static void
-append_raw_header (GHashTable *target, struct raw_header *rh)
+append_raw_header (struct rspamd_task *task,
+ GHashTable *target, struct raw_header *rh)
{
struct raw_header *lp;
@@ -384,7 +385,7 @@ append_raw_header (GHashTable *target, struct raw_header *rh)
else {
g_hash_table_insert (target, rh->name, rh);
}
- msg_debug ("add raw header %s: %s", rh->name, rh->value);
+ msg_debug_task ("add raw header %s: %s", rh->name, rh->value);
}
/* Convert raw headers to a list of struct raw_header * */
@@ -531,14 +532,14 @@ process_raw_headers (struct rspamd_task *task, GHashTable *target,
new->decoded = g_mime_utils_header_decode_text (new->value);
rspamd_mempool_add_destructor (task->task_pool,
(rspamd_mempool_destruct_t)g_free, new->decoded);
- append_raw_header (target, new);
+ append_raw_header (task, target, new);
state = 0;
break;
case 5:
/* Header has only name, no value */
new->value = "";
new->decoded = NULL;
- append_raw_header (target, new);
+ append_raw_header (task, target, new);
state = 0;
break;
case 99:
@@ -748,7 +749,7 @@ convert_text_to_utf (struct rspamd_task *task,
return part_content;
}
if (!charset_validate (task->task_pool, charset, &ocharset)) {
- msg_info (
+ msg_info_task (
"<%s>: has invalid charset",
task->message_id);
SET_PART_RAW (text_part);
@@ -762,7 +763,7 @@ convert_text_to_utf (struct rspamd_task *task,
return part_content;
}
else {
- msg_info (
+ msg_info_task (
"<%s>: contains invalid utf8 characters, assume it as raw",
task->message_id);
SET_PART_RAW (text_part);
@@ -776,7 +777,7 @@ convert_text_to_utf (struct rspamd_task *task,
&write_bytes,
&err);
if (res_str == NULL) {
- msg_warn ("<%s>: cannot convert from %s to utf8: %s",
+ msg_warn_task ("<%s>: cannot convert from %s to utf8: %s",
task->message_id,
ocharset,
err ? err->message : "unknown problem");
@@ -952,7 +953,7 @@ rspamd_normalize_text_part (struct rspamd_task *task,
if (part->language && part->language[0] != '\0' && IS_PART_UTF (part)) {
stem = sb_stemmer_new (part->language, "UTF_8");
if (stem == NULL) {
- msg_info ("<%s> cannot create lemmatizer for %s language",
+ msg_info_task ("<%s> cannot create lemmatizer for %s language",
task->message_id, part->language);
}
}
@@ -1002,8 +1003,9 @@ rspamd_normalize_text_part (struct rspamd_task *task,
#define MIN3(a, b, c) ((a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c)))
-static gint
-rspamd_words_levenshtein_distance (GArray *w1, GArray *w2)
+static guint
+rspamd_words_levenshtein_distance (struct rspamd_task *task,
+ GArray *w1, GArray *w2)
{
guint s1len, s2len, x, y, lastdiag, olddiag;
guint *column;
@@ -1015,7 +1017,7 @@ rspamd_words_levenshtein_distance (GArray *w1, GArray *w2)
s2len = w2->len;
if (s1len > max_words) {
- msg_err ("cannot compare parts with more than %ud words: %ud",
+ msg_err_task ("cannot compare parts with more than %ud words: %ud",
max_words, s1len);
return 0;
}
@@ -1071,7 +1073,7 @@ rspamd_check_gtube (struct rspamd_task *task, struct mime_text_part *part)
rspamd_gtube_cb, NULL, &state, FALSE)) {
task->flags |= RSPAMD_TASK_FLAG_SKIP;
task->flags |= RSPAMD_TASK_FLAG_GTUBE;
- msg_info ("<%s>: gtube pattern has been found in part of length %ud",
+ msg_info_task ("<%s>: gtube pattern has been found in part of length %ud",
task->message_id, part->content->len);
return TRUE;
@@ -1271,7 +1273,7 @@ mime_foreach_callback (GMimeObject * part, gpointer user_data)
#endif
}
else {
- msg_err ("too deep mime recursion detected: %d", md->parser_recursion);
+ msg_err_task ("too deep mime recursion detected: %d", md->parser_recursion);
return;
}
#ifndef GMIME24
@@ -1299,7 +1301,7 @@ mime_foreach_callback (GMimeObject * part, gpointer user_data)
md);
}
else {
- msg_err ("endless recursion detected: %d", task->parser_recursion);
+ msg_err_task ("endless recursion detected: %d", task->parser_recursion);
return;
}
#endif
@@ -1345,7 +1347,7 @@ mime_foreach_callback (GMimeObject * part, gpointer user_data)
#endif
if (type == NULL) {
- msg_warn ("type of part is unknown, assume text/plain");
+ msg_warn_task ("type of part is unknown, assume text/plain");
type = g_mime_content_type_new ("text", "plain");
#ifdef GMIME24
rspamd_mempool_add_destructor (task->task_pool,
@@ -1406,7 +1408,7 @@ mime_foreach_callback (GMimeObject * part, gpointer user_data)
(part_content->len <= 0));
}
else {
- msg_warn ("write to stream failed: %d, %s", errno,
+ msg_warn_task ("write to stream failed: %d, %s", errno,
strerror (errno));
}
#ifndef GMIME24
@@ -1414,7 +1416,7 @@ mime_foreach_callback (GMimeObject * part, gpointer user_data)
#endif
}
else {
- msg_warn ("cannot get wrapper for mime part, type of part: %s/%s",
+ msg_warn_task ("cannot get wrapper for mime part, type of part: %s/%s",
type->type,
type->subtype);
}
@@ -1429,7 +1431,6 @@ destroy_message (void *pointer)
{
GMimeMessage *msg = pointer;
- msg_debug ("freeing pointer %p", msg);
g_object_unref (msg);
}
@@ -1487,7 +1488,7 @@ rspamd_message_parse (struct rspamd_task *task)
message = g_mime_parser_construct_message (parser);
if (message == NULL) {
- msg_warn ("cannot construct mime from stream");
+ msg_warn_task ("cannot construct mime from stream");
g_set_error (&task->err, rspamd_message_quark(), RSPAMD_FILTER_ERROR,\
"cannot parse MIME in the message");
/* TODO: backport to 0.9 */
@@ -1559,7 +1560,7 @@ rspamd_message_parse (struct rspamd_task *task)
recv = g_ptr_array_index (task->received, 0);
if (recv->real_ip) {
if (!rspamd_parse_inet_address (&task->from_addr, recv->real_ip)) {
- msg_warn ("cannot get IP from received header: '%s'",
+ msg_warn_task ("cannot get IP from received header: '%s'",
recv->real_ip);
task->from_addr = NULL;
}
@@ -1676,7 +1677,7 @@ rspamd_message_parse (struct rspamd_task *task)
}
}
else if (rc != URI_ERRNO_OK) {
- msg_info ("extract of url '%s' failed: %s",
+ msg_info_task ("extract of url '%s' failed: %s",
url_str,
rspamd_url_strerror (rc));
}
@@ -1711,7 +1712,8 @@ rspamd_message_parse (struct rspamd_task *task)
tw = MAX (p1->normalized_words->len, p2->normalized_words->len);
if (tw > 0) {
- dw = rspamd_words_levenshtein_distance (p1->normalized_words,
+ dw = rspamd_words_levenshtein_distance (task,
+ p1->normalized_words,
p2->normalized_words);
diff = tw > 0 ? (100.0 * (gdouble)(tw - dw) / (gdouble)tw) : 100;
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c
index 0ad326149..f5732c75a 100644
--- a/src/libmime/mime_expressions.c
+++ b/src/libmime/mime_expressions.c
@@ -210,7 +210,7 @@ rspamd_mime_expr_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line)
GString *re_flags;
if (line == NULL) {
- msg_err ("cannot parse NULL line");
+ msg_err_pool ("cannot parse NULL line");
return NULL;
}
@@ -225,7 +225,7 @@ rspamd_mime_expr_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line)
line++;
}
if (*line == '\0') {
- msg_warn ("got empty regexp");
+ msg_warn_pool ("got empty regexp");
return NULL;
}
start = line;
@@ -268,7 +268,7 @@ rspamd_mime_expr_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line)
}
else {
/* We got header name earlier but have not found // expression, so it is invalid regexp */
- msg_warn (
+ msg_warn_pool (
"got no header name (eg. header=) but without corresponding regexp, %s",
src);
return NULL;
@@ -279,7 +279,7 @@ rspamd_mime_expr_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line)
end++;
}
if (end == begin || *end != '/') {
- msg_warn ("no trailing / in regexp %s", src);
+ msg_warn_pool ("no trailing / in regexp %s", src);
return NULL;
}
/* Parse flags */
@@ -361,7 +361,7 @@ rspamd_mime_expr_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line)
g_string_free (re_flags, TRUE);
if (result->regexp == NULL || err != NULL) {
- msg_warn ("could not read regexp: %s while reading regexp %s",
+ msg_warn_pool ("could not read regexp: %s while reading regexp %s",
err ? err->message : "unknown error",
src);
return NULL;
@@ -739,7 +739,7 @@ rspamd_mime_regexp_element_process (struct rspamd_task *task,
}
if (G_UNLIKELY (re->is_test)) {
- msg_info (
+ msg_info_task (
"process %s test regexp %s returned %d",
rspamd_mime_regexp_type_to_string (re),
re->regexp_text,
@@ -761,19 +761,21 @@ tree_url_callback (gpointer key, gpointer value, void *data)
{
struct url_regexp_param *param = data;
struct rspamd_url *url = value;
+ struct rspamd_task *task;
gint ret;
if (param->found && ! param->re->is_multiple) {
return;
}
+ task = param->task;
ret = rspamd_mime_regexp_element_process (param->task, param->re,
struri (url), 0, FALSE);
param->found = ret;
if (G_UNLIKELY (param->re->is_test)) {
- msg_info ("process test regexp %s for url %s returned FALSE",
+ msg_info_task ("process test regexp %s for url %s returned FALSE",
struri (url));
}
}
@@ -799,7 +801,7 @@ rspamd_mime_expr_process_regexp (struct rspamd_regexp_atom *re,
struct raw_header *rh;
if (re == NULL) {
- msg_info ("invalid regexp passed");
+ msg_info_task ("invalid regexp passed");
return 0;
}
@@ -808,14 +810,14 @@ rspamd_mime_expr_process_regexp (struct rspamd_regexp_atom *re,
switch (re->type) {
case REGEXP_NONE:
- msg_warn ("bad error detected: %s has invalid regexp type",
+ msg_warn_task ("bad error detected: %s has invalid regexp type",
re->regexp_text);
break;
case REGEXP_HEADER:
case REGEXP_RAW_HEADER:
/* Check header's name */
if (re->header == NULL) {
- msg_info ("header regexp without header name: '%s'",
+ msg_info_task ("header regexp without header name: '%s'",
re->regexp_text);
rspamd_task_re_cache_add (task, re->regexp_text, 0);
return 0;
@@ -832,7 +834,7 @@ rspamd_mime_expr_process_regexp (struct rspamd_regexp_atom *re,
if (headerlist == NULL) {
/* Header is not found */
if (G_UNLIKELY (re->is_test)) {
- msg_info (
+ msg_info_task (
"process test regexp %s for header %s returned FALSE: no header found",
re->regexp_text,
re->header);
@@ -945,7 +947,7 @@ rspamd_mime_expr_process_regexp (struct rspamd_regexp_atom *re,
ret = callback_param.found;
break;
default:
- msg_warn ("bad error detected: %p is not a valid regexp object", re);
+ msg_warn_task ("bad error detected: %p is not a valid regexp object", re);
return 0;
break;
}
@@ -1067,7 +1069,7 @@ rspamd_mime_expr_process (gpointer input, rspamd_expression_atom_t *atom)
rspamd_lua_task_push (L, task);
if (lua_pcall (L, 1, 1, 0) != 0) {
- msg_info ("lua call to global function '%s' for atom '%s' failed: %s",
+ msg_info_task ("lua call to global function '%s' for atom '%s' failed: %s",
mime_atom->d.lua_function,
mime_atom->str,
lua_tostring (L, -1));
@@ -1080,7 +1082,7 @@ rspamd_mime_expr_process (gpointer input, rspamd_expression_atom_t *atom)
ret = lua_tonumber (L, 1);
}
else {
- msg_err ("%s returned wrong return type: %s",
+ msg_err_task ("%s returned wrong return type: %s",
mime_atom->str, lua_typename (L, lua_type (L, -1)));
}
/* Remove result */
@@ -1129,7 +1131,7 @@ rspamd_compare_encoding (struct rspamd_task *task, GArray * args, void *unused)
arg = &g_array_index (args, struct expression_argument, 0);
if (!arg || arg->type != EXPRESSION_ARGUMENT_NORMAL) {
- msg_warn ("invalid argument to function is passed");
+ msg_warn_task ("invalid argument to function is passed");
return FALSE;
}
@@ -1149,7 +1151,7 @@ rspamd_header_exists (struct rspamd_task * task, GArray * args, void *unused)
arg = &g_array_index (args, struct expression_argument, 0);
if (!arg || arg->type != EXPRESSION_ARGUMENT_NORMAL) {
- msg_warn ("invalid argument to function is passed");
+ msg_warn_task ("invalid argument to function is passed");
return FALSE;
}
@@ -1185,27 +1187,27 @@ rspamd_parts_distance (struct rspamd_task * task, GArray * args, void *unused)
errno = 0;
arg = &g_array_index (args, struct expression_argument, 0);
if (!arg || arg->type != EXPRESSION_ARGUMENT_NORMAL) {
- msg_warn ("invalid argument to function is passed");
+ msg_warn_task ("invalid argument to function is passed");
return FALSE;
}
threshold = strtoul ((gchar *)arg->data, NULL, 10);
if (errno != 0) {
- msg_info ("bad numeric value for threshold \"%s\", assume it 100",
+ msg_info_task ("bad numeric value for threshold \"%s\", assume it 100",
(gchar *)arg->data);
threshold = 100;
}
if (args->len >= 2) {
arg = &g_array_index (args, struct expression_argument, 1);
if (!arg || arg->type != EXPRESSION_ARGUMENT_NORMAL) {
- msg_warn ("invalid argument to function is passed");
+ msg_warn_task ("invalid argument to function is passed");
return FALSE;
}
errno = 0;
threshold2 = strtoul ((gchar *)arg->data, NULL, 10);
if (errno != 0) {
- msg_info ("bad numeric value for threshold \"%s\", ignore it",
+ msg_info_task ("bad numeric value for threshold \"%s\", ignore it",
(gchar *)arg->data);
threshold2 = -1;
}
@@ -1259,13 +1261,13 @@ rspamd_recipients_distance (struct rspamd_task *task, GArray * args,
gint num, i, j, hits = 0, total = 0;
if (args == NULL) {
- msg_warn ("no parameters to function");
+ msg_warn_task ("no parameters to function");
return FALSE;
}
arg = &g_array_index (args, struct expression_argument, 0);
if (!arg || arg->type != EXPRESSION_ARGUMENT_NORMAL) {
- msg_warn ("invalid argument to function is passed");
+ msg_warn_task ("invalid argument to function is passed");
return FALSE;
}
@@ -1273,7 +1275,7 @@ rspamd_recipients_distance (struct rspamd_task *task, GArray * args,
threshold = strtod ((gchar *)arg->data, NULL);
if (errno != 0) {
- msg_warn ("invalid numeric value '%s': %s",
+ msg_warn_task ("invalid numeric value '%s': %s",
(gchar *)arg->data,
strerror (errno));
return FALSE;
@@ -1467,13 +1469,13 @@ rspamd_compare_transfer_encoding (struct rspamd_task * task,
struct expression_argument *arg;
if (args == NULL) {
- msg_warn ("no parameters to function");
+ msg_warn_task ("no parameters to function");
return FALSE;
}
arg = &g_array_index (args, struct expression_argument, 0);
if (!arg || arg->type != EXPRESSION_ARGUMENT_NORMAL) {
- msg_warn ("invalid argument to function is passed");
+ msg_warn_task ("invalid argument to function is passed");
return FALSE;
}
@@ -1484,7 +1486,7 @@ rspamd_compare_transfer_encoding (struct rspamd_task * task,
enc_req = g_mime_content_encoding_from_string (arg->data);
if (enc_req == GMIME_CONTENT_ENCODING_DEFAULT) {
#endif
- msg_warn ("bad encoding type: %s", (gchar *)arg->data);
+ msg_warn_task ("bad encoding type: %s", (gchar *)arg->data);
return FALSE;
}
@@ -1557,13 +1559,13 @@ rspamd_has_html_tag (struct rspamd_task * task, GArray * args, void *unused)
gboolean res = FALSE;
if (args == NULL) {
- msg_warn ("no parameters to function");
+ msg_warn_task ("no parameters to function");
return FALSE;
}
arg = &g_array_index (args, struct expression_argument, 0);
if (!arg || arg->type != EXPRESSION_ARGUMENT_NORMAL) {
- msg_warn ("invalid argument to function is passed");
+ msg_warn_task ("invalid argument to function is passed");
return FALSE;
}
@@ -1609,7 +1611,7 @@ rspamd_raw_header_exists (struct rspamd_task *task, GArray * args, void *unused)
arg = &g_array_index (args, struct expression_argument, 0);
if (!arg || arg->type != EXPRESSION_ARGUMENT_NORMAL) {
- msg_warn ("invalid argument to function is passed");
+ msg_warn_task ("invalid argument to function is passed");
return FALSE;
}
@@ -1628,7 +1630,7 @@ match_smtp_data (struct rspamd_task *task,
/* This is a regexp */
re = arg->data;
if (re == NULL) {
- msg_warn ("cannot compile regexp for function");
+ msg_warn_task ("cannot compile regexp for function");
return FALSE;
}
@@ -1656,14 +1658,14 @@ rspamd_check_smtp_data (struct rspamd_task *task, GArray * args, void *unused)
gint i, ialen;
if (args == NULL) {
- msg_warn ("no parameters to function");
+ msg_warn_task ("no parameters to function");
return FALSE;
}
arg = &g_array_index (args, struct expression_argument, 0);
if (!arg || !arg->data || arg->type != EXPRESSION_ARGUMENT_NORMAL) {
- msg_warn ("no parameters to function");
+ msg_warn_task ("no parameters to function");
return FALSE;
}
else {
@@ -1675,7 +1677,7 @@ rspamd_check_smtp_data (struct rspamd_task *task, GArray * args, void *unused)
what = rspamd_task_get_sender (task);
}
else {
- msg_warn ("bad argument to function: %s", type);
+ msg_warn_task ("bad argument to function: %s", type);
return FALSE;
}
break;
@@ -1685,7 +1687,7 @@ rspamd_check_smtp_data (struct rspamd_task *task, GArray * args, void *unused)
what = task->helo;
}
else {
- msg_warn ("bad argument to function: %s", type);
+ msg_warn_task ("bad argument to function: %s", type);
return FALSE;
}
break;
@@ -1695,7 +1697,7 @@ rspamd_check_smtp_data (struct rspamd_task *task, GArray * args, void *unused)
what = task->user;
}
else {
- msg_warn ("bad argument to function: %s", type);
+ msg_warn_task ("bad argument to function: %s", type);
return FALSE;
}
break;
@@ -1705,7 +1707,7 @@ rspamd_check_smtp_data (struct rspamd_task *task, GArray * args, void *unused)
what = task->subject;
}
else {
- msg_warn ("bad argument to function: %s", type);
+ msg_warn_task ("bad argument to function: %s", type);
return FALSE;
}
break;
@@ -1715,12 +1717,12 @@ rspamd_check_smtp_data (struct rspamd_task *task, GArray * args, void *unused)
ia = task->rcpt_mime;
}
else {
- msg_warn ("bad argument to function: %s", type);
+ msg_warn_task ("bad argument to function: %s", type);
return FALSE;
}
break;
default:
- msg_warn ("bad argument to function: %s", type);
+ msg_warn_task ("bad argument to function: %s", type);
return FALSE;
}
}
@@ -1777,7 +1779,7 @@ rspamd_content_type_compare_param (struct rspamd_task * task,
struct mime_part *cur_part;
if (args == NULL || args->len < 2) {
- msg_warn ("no parameters to function");
+ msg_warn_task ("no parameters to function");
return FALSE;
}
@@ -1859,7 +1861,7 @@ rspamd_content_type_has_param (struct rspamd_task * task,
struct mime_part *cur_part;
if (args == NULL || args->len < 1) {
- msg_warn ("no parameters to function");
+ msg_warn_task ("no parameters to function");
return FALSE;
}
@@ -1922,7 +1924,7 @@ rspamd_content_type_check (struct rspamd_task *task,
struct mime_part *cur_part;
if (args == NULL || args->len < 1) {
- msg_warn ("no parameters to function");
+ msg_warn_task ("no parameters to function");
return FALSE;
}
@@ -2011,7 +2013,7 @@ compare_subtype (struct rspamd_task *task, GMimeContentType * ct,
gint r = 0;
if (subtype == NULL || ct == NULL) {
- msg_warn ("invalid parameters passed");
+ msg_warn_task ("invalid parameters passed");
return FALSE;
}
if (subtype->type == EXPRESSION_ARGUMENT_REGEXP) {
@@ -2118,7 +2120,7 @@ rspamd_has_content_part (struct rspamd_task * task, GArray * args, void *unused)
struct expression_argument *param_type = NULL, *param_subtype = NULL;
if (args == NULL) {
- msg_warn ("no parameters to function");
+ msg_warn_task ("no parameters to function");
return FALSE;
}
@@ -2140,7 +2142,7 @@ rspamd_has_content_part_len (struct rspamd_task * task,
struct expression_argument *arg;
if (args == NULL) {
- msg_warn ("no parameters to function");
+ msg_warn_task ("no parameters to function");
return FALSE;
}
@@ -2156,7 +2158,7 @@ rspamd_has_content_part_len (struct rspamd_task * task,
g_assert (arg->type == EXPRESSION_ARGUMENT_NORMAL);
if (errno != 0) {
- msg_warn ("invalid numeric value '%s': %s",
+ msg_warn_task ("invalid numeric value '%s': %s",
(gchar *)arg->data,
strerror (errno));
return FALSE;
@@ -2168,7 +2170,7 @@ rspamd_has_content_part_len (struct rspamd_task * task,
max = strtoul (arg->data, NULL, 10);
if (errno != 0) {
- msg_warn ("invalid numeric value '%s': %s",
+ msg_warn_task ("invalid numeric value '%s': %s",
(gchar *)arg->data,
strerror (errno));
return FALSE;