- case AVA_HELO:
- if (Ustrncmp(buf, "220", 3) != 0)
- goto endloop; /* require a 220 */
- goto sendreq;
-
- case AVA_OPT:
- if (Ustrncmp(buf, "210", 3) == 0)
- break; /* ignore 210 responses */
- if (Ustrncmp(buf, "200", 3) != 0)
- goto endloop; /* require a 200 */
-
- sendreq:
- /* Check for another option to send. Newline-terminate it. */
- if ((scanrequest = string_nextinlist(&av_scanner_work, &sep,
- NULL, 0)))
- {
- scanrequest = string_sprintf("%s\n", scanrequest);
- avast_stage = AVA_OPT; /* just sent option */
- }
- else
- {
- scanrequest = string_sprintf("SCAN %s/scan/%s\r\n",
- spool_directory, message_id);
- avast_stage = AVA_CMD; /* just sent command */
- }
-
- /* send config-cmd or scan-request to socket */
-
- if (send(sock, scanrequest, Ustrlen(scanrequest), 0) < 0)
- return m_errlog_defer_3(scanent,
- string_sprintf("unable to send scan request to socket (%s): %s",
- scanner_options, strerror(errno)),
- sock);
- break;
-
- case AVA_CMD:
- if (Ustrncmp(buf, "210", 3) == 0)
- break; /* ignore 210 responses */
+ DEBUG(D_acl) debug_printf("got from avast: %s\n", buf);
+ switch (avast_stage)
+ {
+ case AVA_HELO:
+ if (Ustrncmp(buf, "220", 3) != 0)
+ goto endloop; /* require a 220 */
+ goto sendreq;
+
+ case AVA_OPT:
+ if (Ustrncmp(buf, "210", 3) == 0)
+ break; /* ignore 210 responses */
+ if (Ustrncmp(buf, "200", 3) != 0)
+ goto endloop; /* require a 200 */
+
+ sendreq:
+ /* Check for another option to send. Newline-terminate it. */
+ if ((scanrequest = string_nextinlist(&av_scanner_work, &sep,
+ NULL, 0)))
+ {
+ scanrequest = string_sprintf("%s\n", scanrequest);
+ avast_stage = AVA_OPT; /* just sent option */
+ }
+ else
+ {
+ scanrequest = string_sprintf("SCAN %s/scan/%s\r\n",
+ spool_directory, message_id);
+ avast_stage = AVA_RSP; /* just sent command */
+ }