ACL: Ensure that acl_smtp_notquit is called for a conndrop between data-go-ahead...
[exim.git] / src / src / smtp_in.c
index 8994c6edb8d2b242861987c97be2f6c4a54aca20..09356c23115d3d7a71be033d3842c306a321940f 100644 (file)
@@ -352,15 +352,15 @@ if (smtp_inptr >= smtp_inend)
 return *smtp_inptr++;
 }
 
-#ifndef DISABLE_DKIM
 void
 smtp_get_cache(void)
 {
+#ifndef DISABLE_DKIM
 int n = smtp_inend - smtp_inptr;
 if (n > 0)
   dkim_exim_verify_feed(smtp_inptr, n);
-}
 #endif
+}
 
 
 /* Get a byte from the smtp input, in CHUNKING mode.  Handle ack of the
@@ -399,7 +399,7 @@ for(;;)
   if (chunking_state == CHUNKING_LAST)
     {
 #ifndef DISABLE_DKIM
-    dkim_exim_verify_feed(".\r\n", 3); /* for consistency with .-term MAIL */
+    dkim_exim_verify_feed(NULL, 0);    /* notify EOD */
 #endif
     return EOD;
     }
@@ -3057,12 +3057,11 @@ smtp_exit_function_called = TRUE;
 
 /* Call the not-QUIT ACL, if there is one, unless no reason is given. */
 
-if (acl_smtp_notquit != NULL && reason != NULL)
+if (acl_smtp_notquit && reason)
   {
   smtp_notquit_reason = reason;
-  rc = acl_check(ACL_WHERE_NOTQUIT, NULL, acl_smtp_notquit, &user_msg,
-    &log_msg);
-  if (rc == ERROR)
+  if ((rc = acl_check(ACL_WHERE_NOTQUIT, NULL, acl_smtp_notquit, &user_msg,
+                     &log_msg)) == ERROR)
     log_write(0, LOG_MAIN|LOG_PANIC, "ACL for not-QUIT returned ERROR: %s",
       log_msg);
   }
@@ -3072,9 +3071,11 @@ responses are all internal, they should always fit in the buffer, but code a
 warning, just in case. Note that string_vformat() still leaves a complete
 string, even if it is incomplete. */
 
-if (code != NULL && defaultrespond != NULL)
+if (code && defaultrespond)
   {
-  if (user_msg == NULL)
+  if (user_msg)
+    smtp_respond(code, 3, TRUE, user_msg);
+  else
     {
     uschar buffer[128];
     va_list ap;
@@ -3084,8 +3085,6 @@ if (code != NULL && defaultrespond != NULL)
     smtp_printf("%s %s\r\n", code, buffer);
     va_end(ap);
     }
-  else
-    smtp_respond(code, 3, TRUE, user_msg);
   mac_smtp_fflush();
   }
 }