]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Avoid code duplication
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 11 Jun 2020 14:26:32 +0000 (15:26 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 11 Jun 2020 14:26:32 +0000 (15:26 +0100)
src/libmime/message.c
src/libmime/mime_parser.c

index eec9925524cb71898709d445a38f284e2394ed8c..f2f22f6fe1fbdb3e35dc36ce6aaa43693baab2b7 100644 (file)
@@ -1127,26 +1127,22 @@ rspamd_message_parse (struct rspamd_task *task)
         * Exim somehow uses mailbox format for messages being scanned:
         * From xxx@xxx.com Fri May 13 19:08:48 2016
         *
-        * So we check if a task has non-http format then we check for such a line
-        * at the beginning to avoid errors
+        * So we check if a task has this line to avoid possible issues
         */
-       if (task->cmd != CMD_CHECK_V2 || (task->protocol_flags &
-                       RSPAMD_TASK_PROTOCOL_FLAG_LOCAL_CLIENT)) {
-               if (len > sizeof ("From ") - 1) {
-                       if (memcmp (p, "From ", sizeof ("From ") - 1) == 0) {
-                               /* Skip to CRLF */
-                               msg_info_task ("mailbox input detected, enable workaround");
-                               p += sizeof ("From ") - 1;
-                               len -= sizeof ("From ") - 1;
-
-                               while (len > 0 && *p != '\n') {
-                                       p ++;
-                                       len --;
-                               }
-                               while (len > 0 && g_ascii_isspace (*p)) {
-                                       p ++;
-                                       len --;
-                               }
+       if (len > sizeof ("From ") - 1) {
+               if (memcmp (p, "From ", sizeof ("From ") - 1) == 0) {
+                       /* Skip to CRLF */
+                       msg_info_task ("mailbox input detected, enable workaround");
+                       p += sizeof ("From ") - 1;
+                       len -= sizeof ("From ") - 1;
+
+                       while (len > 0 && *p != '\n') {
+                               p ++;
+                               len --;
+                       }
+                       while (len > 0 && g_ascii_isspace (*p)) {
+                               p ++;
+                               len --;
                        }
                }
        }
index 4fc37ad3d7b32f513e729ed6944eadefbe64b76e..f386e8c6bd8d52b719ae6952a1d6f594e5d6d6e6 100644 (file)
@@ -1301,34 +1301,6 @@ rspamd_mime_parse_message (struct rspamd_task *task,
                /* Top level message */
                p = task->msg.begin;
                len = task->msg.len;
-               /* Skip any space characters to avoid some bad messages to be unparsed */
-               while (len > 0 && g_ascii_isspace (*p)) {
-                       p ++;
-                       len --;
-               }
-               /*
-                * Exim somehow uses mailbox format for messages being scanned:
-                * From x@x.com Fri May 13 19:08:48 2016
-                *
-                * Need to check that for all inputs due to proxy
-                */
-               if (len > sizeof ("From ") - 1) {
-                       if (memcmp (p, "From ", sizeof ("From ") - 1) == 0) {
-                               /* Skip to CRLF */
-                               msg_info_task ("mailbox input detected, enable workaround");
-                               p += sizeof ("From ") - 1;
-                               len -= sizeof ("From ") - 1;
-
-                               while (len > 0 && *p != '\n') {
-                                       p ++;
-                                       len --;
-                               }
-                               while (len > 0 && g_ascii_isspace (*p)) {
-                                       p ++;
-                                       len --;
-                               }
-                       }
-               }
 
                str.str = (gchar *)p;
                str.len = len;