commit 019fb16: [Feature] Core: Allow to construct scan tasks from raw data

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Jan 5 15:21:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-01-05 14:25:22 +0000
URL: https://github.com/rspamd/rspamd/commit/019fb16fe874bf95feddb7dd1b19b73aff31816e

[Feature] Core: Allow to construct scan tasks from raw data

---
 src/libserver/protocol.c          | 12 ++++++++++--
 src/libserver/protocol_internal.h |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index 76a41445b..45051ce51 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -351,8 +351,16 @@ rspamd_protocol_handle_headers (struct rspamd_task *task,
 
 					msg_debug_protocol ("read rcpt header, value: %V", hv);
 				}
-				else {
-					msg_debug_protocol ("wrong header: %V", hn);
+				IF_HEADER (RAW_DATA_HEADER) {
+					srch.begin = "yes";
+					srch.len = 3;
+
+					msg_debug_protocol ("read raw data header, value: %V", hv);
+
+					if (rspamd_ftok_casecmp (hv_tok, &srch) == 0) {
+						task->flags &= ~RSPAMD_TASK_FLAG_MIME;
+						msg_debug_protocol ("disable mime parsing");
+					}
 				}
 				break;
 			case 'i':
diff --git a/src/libserver/protocol_internal.h b/src/libserver/protocol_internal.h
index 756b9f68a..fb2ee115a 100644
--- a/src/libserver/protocol_internal.h
+++ b/src/libserver/protocol_internal.h
@@ -83,5 +83,6 @@
 #define FILENAME_HEADER "Filename"
 #define CERT_ISSUER_HEADER "TLS-Cert-Issuer"
 #define MAILER_HEADER "Mailer"
+#define RAW_DATA_HEADER "Raw"
 
 #endif //RSPAMD_PROTOCOL_INTERNAL_H


More information about the Commits mailing list