#define RSPAMD_SESSION_IS_WATCHING(s) ((s)->flags & RSPAMD_SESSION_FLAG_WATCHING)
#define RSPAMD_SESSION_IS_DESTROYING(s) ((s)->flags & RSPAMD_SESSION_FLAG_DESTROYING)
+#define msg_err_session(...) rspamd_default_log_function(G_LOG_LEVEL_CRITICAL, \
+ session->pool->tag.tagname, session->pool->tag.uid, \
+ G_STRFUNC, \
+ __VA_ARGS__)
+#define msg_warn_session(...) rspamd_default_log_function (G_LOG_LEVEL_WARNING, \
+ session->pool->tag.tagname, session->pool->tag.uid, \
+ G_STRFUNC, \
+ __VA_ARGS__)
+#define msg_info_session(...) rspamd_default_log_function (G_LOG_LEVEL_INFO, \
+ session->pool->tag.tagname, session->pool->tag.uid, \
+ G_STRFUNC, \
+ __VA_ARGS__)
+#define msg_debug_session(...) rspamd_default_log_function (G_LOG_LEVEL_DEBUG, \
+ session->pool->tag.tagname, session->pool->tag.uid, \
+ G_STRFUNC, \
+ __VA_ARGS__)
+
struct rspamd_async_watcher {
event_watcher_t cb;
guint remain;
struct rspamd_async_event *new;
if (session == NULL) {
- msg_info ("session is NULL");
+ msg_info_session ("session is NULL");
return;
}
g_hash_table_insert (session->events, new, new);
- msg_debug ("added event: %p, pending %d events, subsystem: %s",
+ msg_debug_session ("added event: %p, pending %d events, subsystem: %s",
user_data,
g_hash_table_size (session->events),
g_quark_to_string (subsystem));
struct rspamd_async_event search_ev, *found_ev;
if (session == NULL) {
- msg_info ("session is NULL");
+ msg_info_session ("session is NULL");
return;
}
found_ev = g_hash_table_lookup (session->events, &search_ev);
g_assert (found_ev != NULL);
- msg_debug ("removed event: %p, subsystem: %s, pending %d events", ud,
+ msg_debug_session ("removed event: %p, subsystem: %s, pending %d events", ud,
g_quark_to_string (found_ev->subsystem),
g_hash_table_size (session->events));
/* Remove event */
rspamd_session_destroy (struct rspamd_async_session *session)
{
if (session == NULL) {
- msg_info ("session is NULL");
+ msg_info_session ("session is NULL");
return FALSE;
}
*url_found = TRUE;
}
else {
- msg_info ("extract of url '%s' failed: %s",
+ msg_info_pool ("extract of url '%s' failed: %s",
url_str,
rspamd_url_strerror (rc));
}
if (tag->flags & FL_CLOSING) {
if (!*cur_level) {
- msg_debug ("bad parent node");
+ msg_debug_pool ("bad parent node");
g_node_destroy (nnode);
return FALSE;
}
g_node_append (*cur_level, nnode);
if (!rspamd_html_check_balance (nnode, cur_level)) {
- msg_debug (
+ msg_debug_pool (
"mark part as unbalanced as it has not pairable closing tags");
hc->flags |= RSPAMD_HTML_FLAG_UNBALANCED;
*balanced = FALSE;
|| (klen == 10 && g_ascii_strncasecmp (key, "font-color", 10) == 0)) {
rspamd_html_process_color (c, p - c, &bl->font_color);
- msg_debug ("got color: %xd", bl->font_color.d.val);
+ msg_debug_pool ("got color: %xd", bl->font_color.d.val);
}
if (klen == 16 && g_ascii_strncasecmp (key,
"background-color", 16) == 0) {
rspamd_html_process_color (c, p - c, &bl->background_color);
- msg_debug ("got bgcolor: %xd", bl->background_color.d.val);
+ msg_debug_pool ("got bgcolor: %xd", bl->background_color.d.val);
}
}
fstr.begin = (gchar *)comp->start;
fstr.len = comp->len;
rspamd_html_process_color (comp->start, comp->len, &bl->font_color);
- msg_debug ("got color: %xd", bl->font_color.d.val);
+ msg_debug_pool ("got color: %xd", bl->font_color.d.val);
}
else if (comp->type == RSPAMD_HTML_COMPONENT_STYLE && comp->len > 0) {
bl->style.len = comp->len;
bl->style.start = comp->start;
- msg_debug ("got style: %*s", (gint)bl->style.len, bl->style.start);
+ msg_debug_pool ("got style: %*s", (gint)bl->style.len, bl->style.start);
rspamd_html_process_style (pool, bl, hc, comp->start, comp->len);
}
else if (comp->type == RSPAMD_HTML_COMPONENT_CLASS && comp->len > 0) {
fstr.begin = (gchar *)comp->start;
fstr.len = comp->len;
bl->class = rspamd_mempool_fstrdup (pool, &fstr);
- msg_debug ("got class: %s", bl->class);
+ msg_debug_pool ("got class: %s", bl->class);
}
cur = g_list_next (cur);
case 'F':
if (g_ascii_strncasecmp (headern, FROM_HEADER, hlen) == 0) {
if (!rspamd_task_add_sender (task, hv->str)) {
- msg_err ("bad from header: '%v'", hv);
+ msg_err_task ("bad from header: '%v'", hv);
validh = FALSE;
}
}
case 'R':
if (g_ascii_strncasecmp (headern, RCPT_HEADER, hlen) == 0) {
if (!rspamd_task_add_recipient (task, hv->str)) {
- msg_err ("bad from header: '%v'", h->value);
+ msg_err_task ("bad from header: '%v'", h->value);
validh = FALSE;
}
debug_task ("read rcpt header, value: %v", hv);
case 'I':
if (g_ascii_strncasecmp (headern, IP_ADDR_HEADER, hlen) == 0) {
if (!rspamd_parse_inet_address (&task->from_addr, hv->str)) {
- msg_err ("bad ip header: '%v'", hv);
+ msg_err_task ("bad ip header: '%v'", hv);
return FALSE;
}
debug_task ("read IP header, value: %v", hv);
task->message_len = strtoul (hv->str, NULL, 10);
if (task->message_len == 0) {
- msg_err ("Invalid message length header: %v", hv);
+ msg_err_task ("Invalid message length header: %v", hv);
validh = FALSE;
}
else {
}
if (!res && task->cfg->strict_protocol_headers) {
- msg_err (
+ msg_err_task (
"deny processing of a request with incorrect or unknown headers");
g_set_error (&task->err, rspamd_protocol_quark(), 400, "invalid header command");
return FALSE;
if (!rspamd_rcl_parse (control_parser, task, task->task_pool,
control, &err)) {
- msg_warn ("cannot parse control block: %e", err);
+ msg_warn_task ("cannot parse control block: %e", err);
g_error_free (err);
return FALSE;
struct tree_cb_data *cb = ud;
struct rspamd_url *url = value;
ucl_object_t *obj, *elt;
+ struct rspamd_task *task = cb->task;
- if (!(cb->task->flags & RSPAMD_TASK_FLAG_EXT_URLS)) {
+ if (!(task->flags & RSPAMD_TASK_FLAG_EXT_URLS)) {
obj = ucl_object_fromlstring (url->host, url->hostlen);
}
else {
ucl_array_append (cb->top, obj);
if (cb->task->cfg->log_urls) {
- msg_info ("<%s> URL: %s - %s: %s",
- cb->task->message_id,
- cb->task->user ?
- cb->task->user : "unknown",
- rspamd_inet_address_to_string (cb->task->from_addr),
+ msg_info_task ("<%s> URL: %s - %s: %s",
+ task->message_id,
+ task->user ?
+ task->user : "unknown",
+ rspamd_inet_address_to_string (task->from_addr),
struri (url));
}
}
}
if (!(task->flags & RSPAMD_TASK_FLAG_NO_LOG)) {
- msg_info ("%v", logbuf);
+ msg_info_task ("%v", logbuf);
}
g_string_free (logbuf, TRUE);
msg = rspamd_http_new_message (HTTP_RESPONSE);
if (rspamd_http_connection_is_encrypted (task->http_conn)) {
- msg_info ("<%s> writing encrypted reply", task->message_id);
+ msg_info_task ("<%s> writing encrypted reply", task->message_id);
}
if (!RSPAMD_TASK_IS_JSON (task)) {
ctype = "text/plain";
break;
case CMD_OTHER:
- msg_err ("BROKEN");
+ msg_err_task ("BROKEN");
break;
}
}