log_message on a "discard" verb was not working for the DATA or non-SMTP
[exim.git] / src / src / receive.c
index f69e4b673c8a43b20552b20dbc064bf4cf88d4f7..ccd90b8a7548d5db7bc457598d2a951555520092 100644 (file)
@@ -1,10 +1,10 @@
-/* $Cambridge: exim/src/src/receive.c,v 1.7 2004/12/17 14:52:44 ph10 Exp $ */
+/* $Cambridge: exim/src/src/receive.c,v 1.10 2005/01/27 15:57:51 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2004 */
+/* Copyright (c) University of Cambridge 1995 - 2005 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 /* Code for receiving a message and setting up spool files. */
@@ -1115,6 +1115,7 @@ BOOL yield = FALSE;
 BOOL resents_exist = FALSE;
 uschar *resent_prefix = US"";
 uschar *blackholed_by = NULL;
+uschar *blackhole_log_msg = US"";
 
 flock_t lock_data;
 error_block *bad_addresses = NULL;
@@ -2869,6 +2870,8 @@ else
         {
         recipients_count = 0;
         blackholed_by = US"DATA ACL";
+        if (log_msg != NULL) 
+          blackhole_log_msg = string_sprintf(": %s", log_msg); 
         }
       else if (rc != OK)
         {
@@ -2896,6 +2899,7 @@ else
       {
       recipients_count = 0;
       blackholed_by = US"non-SMTP ACL";
+      if (log_msg != NULL) blackhole_log_msg = string_sprintf(": %s", log_msg); 
       }
     else if (rc != OK)
       {
@@ -3394,29 +3398,21 @@ if (smtp_input)
     {
     if (smtp_reply == NULL)
       {
-#ifndef WITH_CONTENT_SCAN
-      smtp_printf("250 OK id=%s\r\n", message_id);
-#else      
-        if (fake_reject)
-          smtp_respond(550,TRUE,fake_reject_text);
-        else  
-          smtp_printf("250 OK id=%s\r\n", message_id);      
-#endif     
+      if (fake_reject)
+        smtp_respond(550,TRUE,fake_reject_text);
+      else  
+        smtp_printf("250 OK id=%s\r\n", message_id);      
       if (host_checking)
         fprintf(stdout,
           "\n**** SMTP testing: that is not a real message id!\n\n");
       }
-#ifndef WITH_CONTENT_SCAN
-    else if (smtp_reply[0] != 0) smtp_printf("%.1024s\r\n", smtp_reply);
-#else
     else if (smtp_reply[0] != 0)
       {
-        if (fake_reject && (smtp_reply[0] == '2'))
-          smtp_respond(550,TRUE,fake_reject_text);
-        else 
-          smtp_printf("%.1024s\r\n", smtp_reply);
-      };
-#endif
+      if (fake_reject && (smtp_reply[0] == '2'))
+        smtp_respond(550,TRUE,fake_reject_text);
+      else 
+        smtp_printf("%.1024s\r\n", smtp_reply);
+      }
     }
 
   /* For batched SMTP, generate an error message on failure, and do
@@ -3437,7 +3433,7 @@ if (blackholed_by != NULL)
   uschar *detail = (local_scan_data != NULL)?
     string_printing(local_scan_data) :
     string_sprintf("(%s discarded recipients)", blackholed_by);
-  log_write(0, LOG_MAIN, "=> blackhole %s", detail);
+  log_write(0, LOG_MAIN, "=> blackhole %s%s", detail, blackhole_log_msg);
   log_write(0, LOG_MAIN, "Completed");
   message_id[0] = 0;
   }