Tweak Avast scanner interface
[exim.git] / src / src / malware.c
index 9099c8a5b9e0ca9cafe303a1526b15b71101e06b..167f47f2c05b79e4c057c652632e22e965a78ae1 100644 (file)
@@ -1574,6 +1574,8 @@ malware_internal(uschar **listptr, uschar *eml_filename, BOOL faking)
                goto endloop;                   /* require a 200 */
 
            sendreq:
+             {
+             int len;
              /* Check for another option to send. Newline-terminate it. */
              if ((scanrequest = string_nextinlist(&av_scanner_work, &sep,
                                NULL, 0)))
@@ -1583,18 +1585,22 @@ malware_internal(uschar **listptr, uschar *eml_filename, BOOL faking)
                }
              else
                {
-               scanrequest = string_sprintf("SCAN %s/scan/%s\r\n",
+               scanrequest = string_sprintf("SCAN %s/scan/%s\n",
                    spool_directory, message_id);
                avast_stage = AVA_RSP;          /* just sent command */
                }
 
              /* send config-cmd or scan-request to socket */
-             if (send(sock, scanrequest, Ustrlen(scanrequest), 0) < 0)
+             len = Ustrlen(scanrequest);
+             if (send(sock, scanrequest, len, 0) < 0)
+               {
+               scanrequest[len-1] = '\0';
                return m_errlog_defer_3(scanent, string_sprintf(
-                     "unable to send scan request to socket (%s): %s",
-                     scanner_options, strerror(errno)),
-                     sock);
+                     "unable to send request '%s' to socket (%s): %s",
+                     scanrequest, scanner_options, strerror(errno)), sock);
+               }
              break;
+             }
 
            case AVA_RSP:
              if (Ustrncmp(buf, "210", 3) == 0)