commit 72042e8: [Project] Rework plugins

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Jul 12 16:42:07 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-07-11 13:43:25 +0100
URL: https://github.com/rspamd/rspamd/commit/72042e8114b7097a84dfbd9d2c5c3253dd1c9eb9

[Project] Rework plugins

---
 src/CMakeLists.txt              |  2 +-
 src/libmime/message.h           |  2 +-
 src/libserver/dkim.c            | 91 +++++++++++++++++++++++------------------
 src/libserver/dns.c             |  4 +-
 src/libserver/protocol.c        | 37 +++++++++--------
 src/libserver/roll_history.c    |  3 +-
 src/libserver/rspamd_symcache.c |  6 +--
 src/libserver/spf.c             | 87 +++++++++++++++------------------------
 src/libserver/task.c            | 28 +------------
 9 files changed, 115 insertions(+), 145 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 03fa61600..19945f62d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -164,10 +164,10 @@ ELSE()
 	ADD_LIBRARY(rspamd-server SHARED
 			${RSPAMD_CRYPTOBOX}
 			${RSPAMD_UTIL}
-			${RSPAMD_LUA}
 			${RSPAMD_SERVER}
 			${RSPAMD_STAT}
 			${RSPAMD_MIME}
+			${RSPAMD_LUA}
 			${CMAKE_CURRENT_BINARY_DIR}/modules.c
 			${PLUGINSSRC}
 			"${RAGEL_ragel_smtp_addr_OUTPUTS}"
diff --git a/src/libmime/message.h b/src/libmime/message.h
index 880645c0a..9cf67ba82 100644
--- a/src/libmime/message.h
+++ b/src/libmime/message.h
@@ -159,7 +159,7 @@ struct rspamd_message {
 #else
 #define MESSAGE_FIELD(task, field)
 	((!(task)->message) ? \
-	(msg_err_task("no message when getting field %s", #field), g_assert(0)) : \
+	(__typeof__((task)->message->field))(msg_err_task("no message when getting field %s", #field), g_assert(0), NULL) : \
 	((task)->message->field))
 #endif
 
diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c
index c0ea29f08..1cc72e65d 100644
--- a/src/libserver/dkim.c
+++ b/src/libserver/dkim.c
@@ -2165,23 +2165,34 @@ rspamd_dkim_canonize_header (struct rspamd_dkim_common_ctx *ctx,
 	const gchar *dkim_header,
 	const gchar *dkim_domain)
 {
-	struct rspamd_mime_header *rh;
-	gint rh_num = 0;
-	GPtrArray *ar;
+	struct rspamd_mime_header *rh, *cur, *sel = NULL;
+	gint hdr_cnt = 0;
 
 	if (dkim_header == NULL) {
-		ar = g_hash_table_lookup (task->raw_headers, header_name);
+		rh = rspamd_message_get_header_array (task, header_name);
 
-		if (ar) {
+		if (rh) {
 			/* Check uniqueness of the header */
-			rh = g_ptr_array_index (ar, 0);
-			if ((rh->flags & RSPAMD_HEADER_UNIQUE) && ar->len > 1) {
+			for (cur = rh->prev; ; cur = cur->prev) {
+				hdr_cnt ++;
+
+				if (hdr_cnt == count) {
+					sel = cur;
+				}
+
+				if (cur->next == NULL) {
+					/* Cycle */
+					break;
+				}
+			}
+
+			if ((rh->flags & RSPAMD_HEADER_UNIQUE) && hdr_cnt > 1) {
 				guint64 random_cookie = ottery_rand_uint64 ();
 
 				msg_warn_dkim ("header %s is intended to be unique by"
 						" email standards, but we have %d headers of this"
 						" type, artificially break DKIM check", header_name,
-						ar->len);
+						hdr_cnt);
 				rspamd_dkim_hash_update (ctx->headers_hash,
 						(const gchar *)&random_cookie,
 						sizeof (random_cookie));
@@ -2189,11 +2200,7 @@ rspamd_dkim_canonize_header (struct rspamd_dkim_common_ctx *ctx,
 				return FALSE;
 			}
 
-			if (ar->len > count) {
-				/* Set skip count */
-				rh_num = ar->len - count - 1;
-			}
-			else {
+			if (hdr_cnt <= count) {
 				/*
 				 * If DKIM has less headers requested than there are in a
 				 * message, then it's fine, it allows adding extra headers
@@ -2201,22 +2208,23 @@ rspamd_dkim_canonize_header (struct rspamd_dkim_common_ctx *ctx,
 				return TRUE;
 			}
 
-			rh = g_ptr_array_index (ar, rh_num);
+			/* Selected header must be non-null if previous condition is false */
+			g_assert (sel != NULL);
 
 			if (ctx->header_canon_type == DKIM_CANON_SIMPLE) {
-				rspamd_dkim_hash_update (ctx->headers_hash, rh->raw_value,
-						rh->raw_len);
+				rspamd_dkim_hash_update (ctx->headers_hash, sel->raw_value,
+						sel->raw_len);
 				msg_debug_dkim ("update signature with header: %*s",
-						(gint)rh->raw_len, rh->raw_value);
+						(gint)sel->raw_len, sel->raw_value);
 			}
 			else {
-				if (ctx->is_sign && (rh->flags & RSPAMD_HEADER_FROM)) {
+				if (ctx->is_sign && (sel->flags & RSPAMD_HEADER_FROM)) {
 					/* Special handling of the From handling when rewrite is done */
 					gboolean has_rewrite = FALSE;
 					guint i;
 					struct rspamd_email_address *addr;
 
-					PTR_ARRAY_FOREACH (task->from_mime, i, addr) {
+					PTR_ARRAY_FOREACH (MESSAGE_FIELD (task, from_mime), i, addr) {
 						if ((addr->flags & RSPAMD_EMAIL_ADDR_ORIGINAL)
 							&& !(addr->flags & RSPAMD_EMAIL_ADDR_ALIASED)) {
 							has_rewrite = TRUE;
@@ -2224,7 +2232,7 @@ rspamd_dkim_canonize_header (struct rspamd_dkim_common_ctx *ctx,
 					}
 
 					if (has_rewrite) {
-						PTR_ARRAY_FOREACH (task->from_mime, i, addr) {
+						PTR_ARRAY_FOREACH (MESSAGE_FIELD (task, from_mime), i, addr) {
 							if (!(addr->flags & RSPAMD_EMAIL_ADDR_ORIGINAL)) {
 								if (!rspamd_dkim_canonize_header_relaxed (ctx, addr->raw,
 										header_name, FALSE)) {
@@ -2237,7 +2245,7 @@ rspamd_dkim_canonize_header (struct rspamd_dkim_common_ctx *ctx,
 					}
 				}
 
-				if (!rspamd_dkim_canonize_header_relaxed (ctx, rh->value,
+				if (!rspamd_dkim_canonize_header_relaxed (ctx, sel->value,
 						header_name, FALSE)) {
 					return FALSE;
 				}
@@ -2248,17 +2256,15 @@ rspamd_dkim_canonize_header (struct rspamd_dkim_common_ctx *ctx,
 		/* For signature check just use the saved dkim header */
 		if (ctx->header_canon_type == DKIM_CANON_SIMPLE) {
 			/* We need to find our own signature and use it */
-			guint i;
+			rh = rspamd_message_get_header_array (task, header_name);
 
-			ar = g_hash_table_lookup (task->raw_headers, header_name);
-
-			if (ar) {
+			if (rh) {
 				/* We need to find our own signature */
 				if (!dkim_domain) {
 					return FALSE;
 				}
 
-				PTR_ARRAY_FOREACH (ar, i, rh) {
+				DL_FOREACH (rh, cur) {
 					guint64 th = rspamd_cryptobox_fast_hash (rh->decoded,
 							strlen (rh->decoded), rspamd_hash_seed ());
 
@@ -2348,7 +2354,8 @@ rspamd_dkim_check (rspamd_dkim_context_t *ctx,
 
 	/* First of all find place of body */
 	body_end = task->msg.begin + task->msg.len;
-	body_start = task->raw_headers_content.body_start;
+
+	body_start = MESSAGE_FIELD (task, raw_headers_content).body_start;
 
 	res = rspamd_mempool_alloc0 (task->task_pool, sizeof (*res));
 	res->ctx = ctx;
@@ -2948,7 +2955,7 @@ rspamd_dkim_sign (struct rspamd_task *task, const gchar *selector,
 
 	/* First of all find place of body */
 	body_end = task->msg.begin + task->msg.len;
-	body_start = task->raw_headers_content.body_start;
+	body_start = MESSAGE_FIELD (task, raw_headers_content).body_start;
 
 	if (len > 0) {
 		ctx->common.len = len;
@@ -3020,6 +3027,8 @@ rspamd_dkim_sign (struct rspamd_task *task, const gchar *selector,
 
 	/* Now canonize headers */
 	for (i = 0; i < ctx->common.hlist->len; i++) {
+		struct rspamd_mime_header *rh, *cur;
+
 		dh = g_ptr_array_index (ctx->common.hlist, i);
 
 		/* We allow oversigning if dh->count > number of headers with this name */
@@ -3027,25 +3036,25 @@ rspamd_dkim_sign (struct rspamd_task *task, const gchar *selector,
 
 		if (hstat.s.flags & RSPAMD_DKIM_FLAG_OVERSIGN) {
 			/* Do oversigning */
-			GPtrArray *ar;
 			guint count = 0;
 
-			ar = g_hash_table_lookup (task->raw_headers, dh->name);
-
-			if (ar) {
-				count = ar->len;
-			}
+			rh = rspamd_message_get_header_array (task, dh->name);
 
-			for (j = 0; j < count; j ++) {
-				/* Sign all existing headers */
-				rspamd_dkim_canonize_header (&ctx->common, task, dh->name, j,
-						NULL, NULL);
+			if (rh) {
+				DL_FOREACH (rh, cur) {
+					/* Sign all existing headers */
+					rspamd_dkim_canonize_header (&ctx->common, task, dh->name,
+							count,
+							NULL, NULL);
+					count++;
+				}
 			}
 
 			/* Now add one more entry to oversign */
 			if (count > 0 || !(hstat.s.flags & RSPAMD_DKIM_FLAG_OVERSIGN_EXISTING)) {
 				cur_len = (strlen (dh->name) + 1) * (count + 1);
 				headers_len += cur_len;
+
 				if (headers_len > 70 && i > 0 && i < ctx->common.hlist->len - 1) {
 					rspamd_printf_gstring (hdr, "  ");
 					headers_len = cur_len;
@@ -3057,7 +3066,9 @@ rspamd_dkim_sign (struct rspamd_task *task, const gchar *selector,
 			}
 		}
 		else {
-			if (g_hash_table_lookup (task->raw_headers, dh->name)) {
+			rh = rspamd_message_get_header_array (task, dh->name);
+
+			if (rh) {
 				if (hstat.s.count > 0) {
 
 					cur_len = (strlen (dh->name) + 1) * (hstat.s.count);
@@ -3166,7 +3177,7 @@ rspamd_dkim_sign (struct rspamd_task *task, const gchar *selector,
 	}
 	else {
 		b64_data = rspamd_encode_base64_fold (sig_buf, sig_len, 70, NULL,
-				task->nlines_type);
+				MESSAGE_FIELD (task, nlines_type));
 	}
 
 	rspamd_printf_gstring (hdr, "%s", b64_data);
diff --git a/src/libserver/dns.c b/src/libserver/dns.c
index 5277e2f6c..3b8770a7b 100644
--- a/src/libserver/dns.c
+++ b/src/libserver/dns.c
@@ -206,8 +206,8 @@ make_dns_request_task_common (struct rspamd_task *task,
 		}
 
 		if (!forced && task->dns_requests >= task->cfg->dns_max_requests) {
-			msg_info_task ("<%s> stop resolving on reaching %ud requests",
-					task->message_id, task->dns_requests);
+			msg_info_task ("stop resolving on reaching %ud requests",
+					task->dns_requests);
 		}
 
 		return TRUE;
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index ddd072882..ff332d1cc 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -478,10 +478,6 @@ rspamd_protocol_handle_headers (struct rspamd_task *task,
 				break;
 			case 's':
 			case 'S':
-				IF_HEADER (SUBJECT_HEADER) {
-					msg_debug_protocol ("read subject header, value: %V", hv);
-					task->subject = rspamd_mempool_ftokdup (task->task_pool, hv_tok);
-				}
 				IF_HEADER (SETTINGS_ID_HEADER) {
 					msg_debug_protocol ("read settings-id header, value: %V", hv);
 					task->settings_elt = rspamd_config_find_settings_name_ref (
@@ -862,7 +858,7 @@ urls_protocol_cb (gpointer key, gpointer value, gpointer ud)
 		}
 
 		msg_notice_task_encrypted ("<%s> %s: %*s; ip: %s; URL: %*s",
-			task->message_id,
+			MESSAGE_FIELD (task, message_id),
 			has_user ? "user" : "from",
 			len, user_field,
 			rspamd_inet_address_to_string (task->from_addr),
@@ -939,7 +935,7 @@ rspamd_protocol_rewrite_subject (struct rspamd_task *task)
 	}
 
 	p = c;
-	s = task->subject;
+	s = MESSAGE_FIELD (task, subject);
 
 	if (s) {
 		slen = strlen (s);
@@ -1112,7 +1108,7 @@ rspamd_metric_result_ucl (struct rspamd_task *task,
 			sobj = rspamd_metric_symbol_ucl (task, sym);
 			ucl_object_insert_key (obj, sobj, sym->name, 0, false);
 		}
-	});
+	})
 
 	if (task->cmd == CMD_CHECK_V2) {
 		ucl_object_insert_key (top, obj, "symbols", 0, false);
@@ -1290,15 +1286,15 @@ rspamd_protocol_write_ucl (struct rspamd_task *task,
 	}
 
 	if (flags & RSPAMD_PROTOCOL_URLS) {
-		if (g_hash_table_size (task->urls) > 0) {
+		if (g_hash_table_size (MESSAGE_FIELD (task, urls)) > 0) {
 			ucl_object_insert_key (top,
-					rspamd_urls_tree_ucl (task->urls, task),
+					rspamd_urls_tree_ucl (MESSAGE_FIELD (task, urls), task),
 					"urls", 0, false);
 		}
 
-		if (g_hash_table_size (task->emails) > 0) {
+		if (g_hash_table_size (MESSAGE_FIELD (task, emails)) > 0) {
 			ucl_object_insert_key (top,
-					rspamd_emails_tree_ucl (task->emails, task),
+					rspamd_emails_tree_ucl (MESSAGE_FIELD (task, emails), task),
 					"emails", 0, false);
 		}
 	}
@@ -1310,7 +1306,8 @@ rspamd_protocol_write_ucl (struct rspamd_task *task,
 	}
 
 	if (flags & RSPAMD_PROTOCOL_BASIC) {
-		ucl_object_insert_key (top, ucl_object_fromstring (task->message_id),
+		ucl_object_insert_key (top,
+				ucl_object_fromstring (MESSAGE_FIELD (task, message_id)),
 				"message-id", 0, false);
 		ucl_object_insert_key (top,
 				ucl_object_fromdouble (task->time_real_finish - task->task_timestamp),
@@ -1340,7 +1337,9 @@ rspamd_protocol_write_ucl (struct rspamd_task *task,
 					}
 					else {
 						folded_header = rspamd_header_value_fold ("DKIM-Signature",
-								dkim_sig->str, 80, task->nlines_type, NULL);
+								dkim_sig->str, 80,
+								MESSAGE_FIELD (task, nlines_type),
+								NULL);
 					}
 
 					ucl_array_append (ar,
@@ -1365,7 +1364,8 @@ rspamd_protocol_write_ucl (struct rspamd_task *task,
 				}
 				else {
 					folded_header = rspamd_header_value_fold ("DKIM-Signature",
-							dkim_sig->str, 80, task->nlines_type, NULL);
+							dkim_sig->str, 80, MESSAGE_FIELD (task, nlines_type),
+							NULL);
 				}
 
 				ucl_object_insert_key (top,
@@ -1401,15 +1401,17 @@ rspamd_protocol_http_reply (struct rspamd_http_message *msg,
 		struct rspamd_task *task, ucl_object_t **pobj)
 {
 	struct rspamd_metric_result *metric_res;
-	GHashTableIter hiter;
 	const struct rspamd_re_cache_stat *restat;
-	gpointer h, v;
+
 	ucl_object_t *top = NULL;
 	rspamd_fstring_t *reply;
 	gint flags = RSPAMD_PROTOCOL_DEFAULT;
 	struct rspamd_action *action;
 
+	/* Removed in 2.0 */
 #if 0
+	GHashTableIter hiter;
+	gpointer h, v;
 	/* Write custom headers */
 	g_hash_table_iter_init (&hiter, task->reply_headers);
 	while (g_hash_table_iter_next (&hiter, &h, &v)) {
@@ -1789,7 +1791,8 @@ rspamd_protocol_write_reply (struct rspamd_task *task, ev_tstamp timeout)
 	msg = rspamd_http_new_message (HTTP_RESPONSE);
 
 	if (rspamd_http_connection_is_encrypted (task->http_conn)) {
-		msg_info_protocol ("<%s> writing encrypted reply", task->message_id);
+		msg_info_protocol ("<%s> writing encrypted reply",
+				MESSAGE_FIELD (task, message_id));
 	}
 
 	if (!RSPAMD_TASK_IS_JSON (task)) {
diff --git a/src/libserver/roll_history.c b/src/libserver/roll_history.c
index c70246383..ee69d59d3 100644
--- a/src/libserver/roll_history.c
+++ b/src/libserver/roll_history.c
@@ -15,6 +15,7 @@
  */
 #include "config.h"
 #include "rspamd.h"
+#include "libmime/message.h"
 #include "lua/lua_common.h"
 #include "unix-std.h"
 #include "cfg_file_private.h"
@@ -139,7 +140,7 @@ rspamd_roll_history_update (struct roll_history *history,
 	row->timestamp = task->task_timestamp;
 
 	/* Strings */
-	rspamd_strlcpy (row->message_id, task->message_id,
+	rspamd_strlcpy (row->message_id, MESSAGE_FIELD (task, message_id),
 		sizeof (row->message_id));
 	if (task->user) {
 		rspamd_strlcpy (row->user, task->user, sizeof (row->user));
diff --git a/src/libserver/rspamd_symcache.c b/src/libserver/rspamd_symcache.c
index 3de339654..2acff7e6d 100644
--- a/src/libserver/rspamd_symcache.c
+++ b/src/libserver/rspamd_symcache.c
@@ -1808,7 +1808,7 @@ rspamd_symcache_process_settings (struct rspamd_task *task,
 	wl = ucl_object_lookup (task->settings, "whitelist");
 
 	if (wl != NULL) {
-		msg_info_task ("<%s> is whitelisted", task->message_id);
+		msg_info_task ("task is whitelisted");
 		task->flags |= RSPAMD_TASK_FLAG_SKIP;
 		return TRUE;
 	}
@@ -2015,9 +2015,9 @@ rspamd_symcache_process_symbols (struct rspamd_task *task,
 
 			if (!(item->type & SYMBOL_TYPE_FINE)) {
 				if (rspamd_symcache_metric_limit (task, checkpoint)) {
-					msg_info_task ("<%s> has already scored more than %.2f, so do "
+					msg_info_task ("task has already scored more than %.2f, so do "
 								   "not "
-								   "plan more checks", task->message_id,
+								   "plan more checks",
 							checkpoint->rs->score);
 					all_done = TRUE;
 					break;
diff --git a/src/libserver/spf.c b/src/libserver/spf.c
index 70db4adbd..220e7adfa 100644
--- a/src/libserver/spf.c
+++ b/src/libserver/spf.c
@@ -121,8 +121,8 @@ struct spf_dns_cb {
     do {                                                        \
         if ((rec)->nested > SPF_MAX_NESTING ||                  \
             (rec)->dns_requests > SPF_MAX_DNS_REQUESTS) {       \
-            msg_info_spf ("<%s> spf recursion limit %d is reached, domain: %s", \
-                (rec)->task->message_id, (rec)->dns_requests,   \
+            msg_info_spf ("spf recursion limit %d is reached, domain: %s", \
+                (rec)->dns_requests,   \
                 (rec)->sender_domain);                          \
             return FALSE;                                       \
         }                                                       \
@@ -823,9 +823,8 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
 				if (!(cb->addr->flags & RSPAMD_SPF_FLAG_RESOLVED)) {
 					cb->addr->flags |= RSPAMD_SPF_FLAG_PERMFAIL;
 					msg_debug_spf (
-							"<%s>: spf error for domain %s: cannot find MX"
+							"spf error for domain %s: cannot find MX"
 							" record for %s: %s",
-							task->message_id,
 							cb->rec->sender_domain,
 							cb->resolved->cur_domain,
 							rdns_strerror (reply->code));
@@ -836,9 +835,8 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
 				if (!(cb->addr->flags & RSPAMD_SPF_FLAG_RESOLVED)) {
 					cb->addr->flags |= RSPAMD_SPF_FLAG_PERMFAIL;
 					msg_debug_spf (
-							"<%s>: spf error for domain %s: cannot resolve A"
+							"spf error for domain %s: cannot resolve A"
 							" record for %s: %s",
-							task->message_id,
 							cb->rec->sender_domain,
 							cb->resolved->cur_domain,
 							rdns_strerror (reply->code));
@@ -852,9 +850,8 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
 				if (!(cb->addr->flags & RSPAMD_SPF_FLAG_RESOLVED)) {
 					cb->addr->flags |= RSPAMD_SPF_FLAG_PERMFAIL;
 					msg_debug_spf (
-							"<%s>: spf error for domain %s: cannot resolve AAAA"
+							"spf error for domain %s: cannot resolve AAAA"
 							" record for %s: %s",
-							task->message_id,
 							cb->rec->sender_domain,
 							cb->resolved->cur_domain,
 							rdns_strerror (reply->code));
@@ -866,9 +863,8 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
 			case SPF_RESOLVE_PTR:
 				if (!(cb->addr->flags & RSPAMD_SPF_FLAG_RESOLVED)) {
 					msg_debug_spf (
-							"<%s>: spf error for domain %s: cannot resolve PTR"
+							"spf error for domain %s: cannot resolve PTR"
 							" record for %s: %s",
-							task->message_id,
 							cb->rec->sender_domain,
 							cb->resolved->cur_domain,
 							rdns_strerror (reply->code));
@@ -881,9 +877,8 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
 				if (!(cb->addr->flags & RSPAMD_SPF_FLAG_RESOLVED)) {
 					cb->addr->flags |= RSPAMD_SPF_FLAG_PERMFAIL;
 					msg_debug_spf (
-							"<%s>: spf error for domain %s: cannot resolve REDIRECT"
+							"spf error for domain %s: cannot resolve REDIRECT"
 							" record for %s: %s",
-							task->message_id,
 							cb->rec->sender_domain,
 							cb->resolved->cur_domain,
 							rdns_strerror (reply->code));
@@ -893,9 +888,8 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
 			case SPF_RESOLVE_INCLUDE:
 				if (!(cb->addr->flags & RSPAMD_SPF_FLAG_RESOLVED)) {
 					msg_debug_spf (
-							"<%s>: spf error for domain %s: cannot resolve INCLUDE"
+							"spf error for domain %s: cannot resolve INCLUDE"
 							" record for %s: %s",
-							task->message_id,
 							cb->rec->sender_domain,
 							cb->resolved->cur_domain,
 							rdns_strerror (reply->code));
@@ -908,9 +902,8 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
 			case SPF_RESOLVE_EXISTS:
 				if (!(cb->addr->flags & RSPAMD_SPF_FLAG_RESOLVED)) {
 					msg_debug_spf (
-							"<%s>: spf error for domain %s: cannot resolve EXISTS"
+							"spf error for domain %s: cannot resolve EXISTS"
 							" record for %s: %s",
-							task->message_id,
 							cb->rec->sender_domain,
 							cb->resolved->cur_domain,
 							rdns_strerror (reply->code));
@@ -922,9 +915,8 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
 	else {
 		cb->addr->flags |= RSPAMD_SPF_FLAG_TEMPFAIL;
 		msg_info_spf (
-				"<%s>: spf error for domain %s: cannot resolve %s DNS record for"
+				"spf error for domain %s: cannot resolve %s DNS record for"
 				" %s: %s",
-				task->message_id,
 				cb->rec->sender_domain,
 				rspamd_spf_dns_action_to_str (cb->cur_action),
 				cb->ptr_host,
@@ -1622,8 +1614,8 @@ expand_spf_macro (struct spf_record *rec, struct spf_resolved_element *resolved,
 			else {
 				/* Something unknown */
 				msg_info_spf (
-						"<%s>: spf error for domain %s: unknown spf element",
-						task->message_id, rec->sender_domain);
+						"spf error for domain %s: unknown spf element",
+						rec->sender_domain);
 				return begin;
 			}
 			p++;
@@ -1657,9 +1649,8 @@ expand_spf_macro (struct spf_record *rec, struct spf_resolved_element *resolved,
 				break;
 			default:
 				msg_info_spf (
-						"<%s>: spf error for domain %s: unknown or "
+						"spf error for domain %s: unknown or "
 								"unsupported spf macro %c in %s",
-						task->message_id,
 						rec->sender_domain,
 						*p,
 						begin);
@@ -1740,8 +1731,8 @@ expand_spf_macro (struct spf_record *rec, struct spf_resolved_element *resolved,
 			else {
 				/* Something unknown */
 				msg_info_spf (
-						"<%s>: spf error for domain %s: unknown spf element",
-						task->message_id, rec->sender_domain);
+						"spf error for domain %s: unknown spf element",
+						rec->sender_domain);
 				return begin;
 			}
 			p++;
@@ -1836,9 +1827,8 @@ expand_spf_macro (struct spf_record *rec, struct spf_resolved_element *resolved,
 				break;
 			default:
 				msg_info_spf (
-						"<%s>: spf error for domain %s: unknown or "
+						"spf error for domain %s: unknown or "
 								"unsupported spf macro %c in %s",
-						task->message_id,
 						rec->sender_domain,
 						*p,
 						begin);
@@ -1881,10 +1871,8 @@ expand_spf_macro (struct spf_record *rec, struct spf_resolved_element *resolved,
 				delim = *p;
 			}
 			else {
-				msg_info_spf (
-						"<%s>: spf error for domain %s: unknown or "
+				msg_info_spf ("spf error for domain %s: unknown or "
 								"unsupported spf macro %c in %s",
-						task->message_id,
 						rec->sender_domain,
 						*p,
 						begin);
@@ -1939,9 +1927,8 @@ parse_spf_record (struct spf_record *rec, struct spf_resolved_element *resolved,
 				res = parse_spf_a (rec, resolved, addr);
 			}
 			else {
-				msg_info_spf (
-						"<%s>: spf error for domain %s: bad spf command %s",
-						task->message_id, rec->sender_domain, begin);
+				msg_info_spf ("spf error for domain %s: bad spf command %s",
+						rec->sender_domain, begin);
 			}
 			break;
 		case 'i':
@@ -1959,9 +1946,8 @@ parse_spf_record (struct spf_record *rec, struct spf_resolved_element *resolved,
 				res = parse_spf_ip6 (rec, addr);
 			}
 			else {
-				msg_info_spf (
-						"<%s>: spf error for domain %s: bad spf command %s",
-						task->message_id, rec->sender_domain, begin);
+				msg_info_spf ("spf error for domain %s: bad spf command %s",
+						rec->sender_domain, begin);
 			}
 			break;
 		case 'm':
@@ -1970,9 +1956,8 @@ parse_spf_record (struct spf_record *rec, struct spf_resolved_element *resolved,
 				res = parse_spf_mx (rec, resolved, addr);
 			}
 			else {
-				msg_info_spf (
-						"<%s>: spf error for domain %s: bad spf command %s",
-						task->message_id, rec->sender_domain, begin);
+				msg_info_spf ("spf error for domain %s: bad spf command %s",
+						rec->sender_domain, begin);
 			}
 			break;
 		case 'p':
@@ -1982,9 +1967,8 @@ parse_spf_record (struct spf_record *rec, struct spf_resolved_element *resolved,
 				res = parse_spf_ptr (rec, resolved, addr);
 			}
 			else {
-				msg_info_spf (
-						"<%s>: spf error for domain %s: bad spf command %s",
-						task->message_id, rec->sender_domain, begin);
+				msg_info_spf ("spf error for domain %s: bad spf command %s",
+						rec->sender_domain, begin);
 			}
 			break;
 		case 'e':
@@ -1998,9 +1982,8 @@ parse_spf_record (struct spf_record *rec, struct spf_resolved_element *resolved,
 				res = parse_spf_exists (rec, addr);
 			}
 			else {
-				msg_info_spf (
-						"<%s>: spf error for domain %s: bad spf command %s",
-						task->message_id, rec->sender_domain, begin);
+				msg_info_spf ("spf error for domain %s: bad spf command %s",
+						rec->sender_domain, begin);
 			}
 			break;
 		case 'r':
@@ -2010,9 +1993,8 @@ parse_spf_record (struct spf_record *rec, struct spf_resolved_element *resolved,
 				res = parse_spf_redirect (rec, resolved, addr);
 			}
 			else {
-				msg_info_spf (
-						"<%s>: spf error for domain %s: bad spf command %s",
-						task->message_id, rec->sender_domain, begin);
+				msg_info_spf ("spf error for domain %s: bad spf command %s",
+						rec->sender_domain, begin);
 			}
 			break;
 		case 'v':
@@ -2025,8 +2007,8 @@ parse_spf_record (struct spf_record *rec, struct spf_resolved_element *resolved,
 			}
 			break;
 		default:
-			msg_info_spf ("<%s>: spf error for domain %s: bad spf command %s",
-					task->message_id, rec->sender_domain, begin);
+			msg_info_spf ("spf error for domain %s: bad spf command %s",
+					rec->sender_domain, begin);
 			break;
 	}
 
@@ -2088,8 +2070,8 @@ start_spf_parse (struct spf_record *rec, struct spf_resolved_element *resolved,
 		/* Skip one number of record, so no we are here spf2.0/ */
 		begin += sizeof (SPF_VER2_STR);
 		if (*begin != '/') {
-			msg_info_spf ("<%s>: spf error for domain %s: sender id is invalid",
-					rec->task->message_id, rec->sender_domain);
+			msg_info_spf ("spf error for domain %s: sender id is invalid",
+					rec->sender_domain);
 		}
 		else {
 			begin++;
@@ -2099,8 +2081,7 @@ start_spf_parse (struct spf_record *rec, struct spf_resolved_element *resolved,
 	}
 	else {
*** OUTPUT TRUNCATED, 57 LINES SKIPPED ***


More information about the Commits mailing list