#include "libutil/http_private.h"
#include "unix-std.h"
+#define msg_err_surbl(...) rspamd_default_log_function (G_LOG_LEVEL_CRITICAL, \
+ "surbl", task->task_pool->tag.uid, \
+ G_STRFUNC, \
+ __VA_ARGS__)
+#define msg_warn_surbl(...) rspamd_default_log_function (G_LOG_LEVEL_WARNING, \
+ "surbl", task->task_pool->tag.uid, \
+ G_STRFUNC, \
+ __VA_ARGS__)
+#define msg_info_surbl(...) rspamd_default_log_function (G_LOG_LEVEL_INFO, \
+ "surbl", task->task_pool->tag.uid, \
+ G_STRFUNC, \
+ __VA_ARGS__)
+#define msg_debug_surbl(...) rspamd_default_log_function (G_LOG_LEVEL_DEBUG, \
+ "surbl", task->task_pool->tag.uid, \
+ G_STRFUNC, \
+ __VA_ARGS__)
+
static struct surbl_ctx *surbl_module_ctx = NULL;
static const guint64 rspamd_surbl_cb_magic = 0xe09b8536f80de0d1ULL;
if (surbl_req == NULL) {
if (err != NULL) {
if (err->code != WHITELIST_ERROR && err->code != DUPLICATE_ERROR) {
- msg_info_task ("cannot format url string for surbl %*s, %e",
+ msg_info_surbl ("cannot format url string for surbl %*s, %e",
url->urllen, url->string,
err);
}
}
else if (err != NULL) {
if (err->code != WHITELIST_ERROR && err->code != DUPLICATE_ERROR) {
- msg_info_task ("cannot format url string for surbl %*s, %e",
+ msg_info_surbl ("cannot format url string for surbl %*s, %e",
url->urllen,
url->string, err);
}
bit = g_hash_table_lookup (suffix->ips, &addr);
if (bit != NULL) {
- msg_info_task ("<%s> domain [%s] is in surbl %s(%xd)",
+ msg_info_surbl ("<%s> domain [%s] is in surbl %s(%xd)",
task->message_id,
resolved_name, suffix->suffix,
bit->bit);
if (((gint)bit->bit & (gint)ntohl (addr)) != 0) {
got_result = TRUE;
- msg_info_task ("<%s> domain [%s] is in surbl %s(%xd)",
+ msg_info_surbl ("<%s> domain [%s] is in surbl %s(%xd)",
task->message_id,
resolved_name, suffix->suffix,
bit->bit);
if (!got_result) {
if ((suffix->bits == NULL || suffix->bits->len == 0) &&
suffix->ips == NULL) {
- msg_info_task ("<%s> domain [%s] is in surbl %s",
+ msg_info_surbl ("<%s> domain [%s] is in surbl %s",
task->message_id,
resolved_name, suffix->suffix);
rspamd_task_insert_result (task, suffix->symbol, 1, resolved_name);
}
else {
ina.s_addr = addr;
- msg_info_task ("<%s> domain [%s] is in surbl %s but at unknown result: %s",
+ msg_info_surbl ("<%s> domain [%s] is in surbl %s but at unknown result: %s",
task->message_id,
resolved_name, suffix->suffix,
inet_ntoa (ina));
task = param->task;
/* If we have result from DNS server, this url exists in SURBL, so increase score */
if (reply->code == RDNS_RC_NOERROR && reply->entries) {
- msg_debug_task ("<%s> domain [%s] is in surbl %s",
+ msg_debug_surbl ("<%s> domain [%s] is in surbl %s",
param->task->message_id,
param->host_resolve, param->suffix->suffix);
elt = reply->entries;
}
}
else {
- msg_debug_task ("<%s> domain [%s] is not in surbl %s",
+ msg_debug_surbl ("<%s> domain [%s] is not in surbl %s",
param->task->message_id, param->host_resolve,
param->suffix->suffix);
}
ip_addr >> 16 & 0xff,
ip_addr >> 8 & 0xff,
ip_addr & 0xff, param->suffix->suffix);
- msg_debug_task (
+ msg_debug_surbl (
"<%s> domain [%s] send %v request to surbl",
param->task->message_id,
param->host_resolve,
}
}
else {
- msg_debug_task ("<%s> domain [%s] cannot be resolved for SURBL check %s",
+ msg_debug_surbl ("<%s> domain [%s] cannot be resolved for SURBL check %s",
param->task->message_id, param->host_resolve,
param->suffix->suffix);
struct rspamd_task *task;
task = param->task;
- msg_err_task ("connection with http server %s terminated incorrectly: %e",
+ msg_err_surbl ("connection with http server %s terminated incorrectly: %e",
rspamd_inet_address_to_string (rspamd_upstream_addr (param->redirector)),
err);
rspamd_upstream_fail (param->redirector);
hdr = rspamd_http_message_find_header (msg, "Uri");
if (hdr != NULL) {
- msg_info_task ("<%s> got reply from redirector: '%*s' -> '%T'",
+ msg_info_surbl ("<%s> got reply from redirector: '%*s' -> '%T'",
param->task->message_id,
param->url->urllen, param->url->string,
hdr);
task->task_pool);
}
else {
- msg_info_task ("cannot parse redirector reply: %s", urlstr);
+ msg_info_surbl ("cannot parse redirector reply: %s", urlstr);
}
}
}
else {
- msg_info_task ("<%s> could not resolve '%*s' on redirector",
+ msg_info_surbl ("<%s> could not resolve '%*s' on redirector",
param->task->message_id,
param->url->urllen, param->url->string);
}
}
if (s == -1) {
- msg_info_task ("<%s> cannot create tcp socket failed: %s",
+ msg_info_surbl ("<%s> cannot create tcp socket failed: %s",
task->message_id,
strerror (errno));
make_surbl_requests (url, task, suffix, FALSE, tree);
rspamd_http_connection_write_message (param->conn, msg, NULL,
NULL, param, s, timeout, task->ev_base);
- msg_info_task (
+ msg_info_surbl (
"<%s> registered redirector call for %*s to %s, according to rule: %s",
task->message_id,
url->urllen, url->string,
struct rspamd_url *url;
if (!rspamd_monitored_alive (suffix->m)) {
- msg_info_task ("disable surbl %s as it is reported to be offline",
+ msg_info_surbl ("disable surbl %s as it is reported to be offline",
suffix->suffix);
return;
}
if (url) {
surbl_tree_url_callback (url, url, ¶m);
- msg_debug_task ("checked image url %s over %s",
+ msg_debug_surbl ("checked image url %s over %s",
img->src, suffix->suffix);
}
}