commit 2abae80: [Minor] Fix config-less tests

Vsevolod Stakhov vsevolod at highsecure.ru
Tue May 19 16:35:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-05-19 17:29:31 +0100
URL: https://github.com/rspamd/rspamd/commit/2abae809e489587cfe319f92a21d7895492c4618 (HEAD -> master)

[Minor] Fix config-less tests

---
 src/libmime/mime_headers.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c
index 786d43a6a..fec23927e 100644
--- a/src/libmime/mime_headers.c
+++ b/src/libmime/mime_headers.c
@@ -44,6 +44,11 @@ rspamd_mime_header_check_special (struct rspamd_task *task,
 	struct rspamd_received_header *recv;
 	const gchar *p, *end;
 	gchar *id;
+	gint max_recipients = -1;
+
+	if (task->cfg) {
+		max_recipients = task->cfg->max_recipients;
+	}
 
 	h = rspamd_icase_hash (rh->name, strlen (rh->name), 0xdeadbabe);
 
@@ -63,25 +68,25 @@ rspamd_mime_header_check_special (struct rspamd_task *task,
 	case 0x76F31A09F4352521ULL:	/* to */
 		MESSAGE_FIELD (task, rcpt_mime) = rspamd_email_address_from_mime (task->task_pool,
 				rh->decoded, strlen (rh->decoded),
-				MESSAGE_FIELD (task, rcpt_mime), task->cfg->max_recipients);
+				MESSAGE_FIELD (task, rcpt_mime), max_recipients);
 		rh->flags |= RSPAMD_HEADER_TO|RSPAMD_HEADER_RCPT|RSPAMD_HEADER_UNIQUE;
 		break;
 	case 0x7EB117C1480B76ULL:	/* cc */
 		MESSAGE_FIELD (task, rcpt_mime) = rspamd_email_address_from_mime (task->task_pool,
 				rh->decoded, strlen (rh->decoded),
-				MESSAGE_FIELD (task, rcpt_mime), task->cfg->max_recipients);
+				MESSAGE_FIELD (task, rcpt_mime), max_recipients);
 		rh->flags |= RSPAMD_HEADER_CC|RSPAMD_HEADER_RCPT|RSPAMD_HEADER_UNIQUE;
 		break;
 	case 0xE4923E11C4989C8DULL:	/* bcc */
 		MESSAGE_FIELD (task, rcpt_mime) = rspamd_email_address_from_mime (task->task_pool,
 				rh->decoded, strlen (rh->decoded),
-				MESSAGE_FIELD (task, rcpt_mime), task->cfg->max_recipients);
+				MESSAGE_FIELD (task, rcpt_mime), max_recipients);
 		rh->flags |= RSPAMD_HEADER_BCC|RSPAMD_HEADER_RCPT|RSPAMD_HEADER_UNIQUE;
 		break;
 	case 0x41E1985EDC1CBDE4ULL:	/* from */
 		MESSAGE_FIELD (task, from_mime) = rspamd_email_address_from_mime (task->task_pool,
 				rh->decoded, strlen (rh->decoded),
-				MESSAGE_FIELD (task, from_mime), task->cfg->max_recipients);
+				MESSAGE_FIELD (task, from_mime), max_recipients);
 		rh->flags |= RSPAMD_HEADER_FROM|RSPAMD_HEADER_SENDER|RSPAMD_HEADER_UNIQUE;
 		break;
 	case 0x43A558FC7C240226ULL:	/* message-id */ {


More information about the Commits mailing list