Re: [exim] Return temporary error after DATA but store mail?

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Tony Finch
Dátum:  
Címzett: Michael Haardt
CC: exim-users
Tárgy: Re: [exim] Return temporary error after DATA but store mail?
On Fri, 20 May 2005, Michael Haardt wrote:
>
> I need something like "fakedefer".


Try this untested patch.

Tony.
--
<fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}--- exim-src/src/acl.c 17 May 2005 15:00:04 -0000 1.32
+++ exim-src/src/acl.c  20 May 2005 10:41:23 -0000
@@ -421,7 +427,7 @@
 #ifdef WITH_CONTENT_SCAN
   CONTROL_NO_MBOX_UNSPOOL,
 #endif
-  CONTROL_FAKEREJECT, CONTROL_NO_MULTILINE };
+  CONTROL_FAKEREJECT, CONTROL_FAKEDEFER, CONTROL_NO_MULTILINE };
 
 /* Bit map vector of which controls are not allowed at certain times. For
 each control, there's a bitmap of dis-allowed times. For some, it is easier to
@@ -502,6 +508,7 @@
   { US"no_mbox_unspool",        CONTROL_NO_MBOX_UNSPOOL, FALSE},
 #endif
   { US"fakereject",             CONTROL_FAKEREJECT, TRUE},
+  { US"fakedefer",              CONTROL_FAKEDEFER, TRUE},
   { US"submission",             CONTROL_SUBMISSION, TRUE}
   };
 
@@ -2102,18 +2378,19 @@
       break;
 
       case CONTROL_FAKEREJECT:
-      fake_reject = TRUE;
+      case CONTROL_FAKEDEFER:
+      fake_response = (control_type == CONTROL_FAKEREJECT) ? FAIL : DEFER;
       if (*p == '/')
         {
         uschar *pp = p + 1;
         while (*pp != 0) pp++;
-        fake_reject_text = expand_string(string_copyn(p+1, pp-p-1));
+        fake_response_text = expand_string(string_copyn(p+1, pp-p-1));
         p = pp;
         }
        else
         {
         /* Explicitly reset to default string */
-        fake_reject_text = US"Your message has been rejected but is being kept for evaluation.\nIf it was a legitimate message, it may still be deliv
+        fake_response_text = US"Your message has been rejected but is being kept for evaluation.\nIf it was a legitimate message, it may still be del
         }
       break;
 
@@ -2407,6 +2684,10 @@
       rc = mime_regex(&arg);
     break;
 #endif
+
+    case ACLC_RATELIMIT:
+      rc = acl_ratelimit(arg, log_msgptr);
+    break;
 
     case ACLC_RECIPIENTS:
     rc = match_address_list(addr->address, TRUE, TRUE, &arg, NULL, -1, 0,
--- exim-src/src/globals.c      10 May 2005 10:19:11 -0000      1.24
+++ exim-src/src/globals.c      20 May 2005 10:41:24 -0000
@@ -512,8 +512,8 @@
 BOOL    extract_addresses_remove_arguments = TRUE;
 uschar *extra_local_interfaces = NULL;
 
-BOOL    fake_reject            = FALSE;
-uschar *fake_reject_text       = US"Your message has been rejected but is being kept for evaluation.\nIf it was a legitimate message, it may still be
+int     fake_response          = OK;
+uschar *fake_response_text     = US"Your message has been rejected but is being kept for evaluation.\nIf it was a legitimate message, it may still be
 int     filter_n[FILTER_VARIABLE_COUNT];
 BOOL    filter_running         = FALSE;
 int     filter_sn[FILTER_VARIABLE_COUNT];
--- exim-src/src/globals.h      10 May 2005 10:19:11 -0000      1.16
+++ exim-src/src/globals.h      20 May 2005 10:41:24 -0000
@@ -309,8 +309,8 @@
 extern BOOL    extract_addresses_remove_arguments; /* Controls -t behaviour */
 extern uschar *extra_local_interfaces; /* Local, non-listen interfaces */
 
-extern BOOL    fake_reject;            /* TRUE if fake reject is to be given */
-extern uschar *fake_reject_text;       /* Option for the fakereject control statement: can contain user defined message. Default is in globals.c. */
+extern int     fake_response;          /* Fake FAIL or DEFER response to data */
+extern uschar *fake_response_text;     /* User defined message for the above. Default is in globals.c. */
 extern int     filter_n[FILTER_VARIABLE_COUNT]; /* filter variables */
 extern BOOL    filter_running;         /* TRUE while running a filter */
 extern int     filter_sn[FILTER_VARIABLE_COUNT]; /* variables set by system filter */
--- exim-src/src/receive.c      17 May 2005 15:00:04 -0000      1.17
+++ exim-src/src/receive.c      20 May 2005 10:41:24 -0000
@@ -3477,8 +3477,9 @@
     {
     if (smtp_reply == NULL)
       {
-      if (fake_reject)
-        smtp_respond(550,TRUE,fake_reject_text);
+      if (fake_response != OK)
+        smtp_respond(fake_response == DEFER ? 450 : 550,
+                    TRUE, fake_response_text);
       else
         smtp_printf("250 OK id=%s\r\n", message_id);
       if (host_checking)
@@ -3487,8 +3488,9 @@
       }
     else if (smtp_reply[0] != 0)
       {
-      if (fake_reject && (smtp_reply[0] == '2'))
-        smtp_respond(550,TRUE,fake_reject_text);
+      if (fake_response != OK && (smtp_reply[0] == '2'))
+        smtp_respond(fake_response == DEFER ? 450 : 550,
+                    TRUE, fake_response_text);
       else
         smtp_printf("%.1024s\r\n", smtp_reply);
       }
--- exim-src/src/smtp_in.c      27 Apr 2005 13:29:32 -0000      1.17
+++ exim-src/src/smtp_in.c      20 May 2005 10:41:25 -0000
@@ -809,7 +809,7 @@
 acl_warn_headers = NULL;
 queue_only_policy = FALSE;
 deliver_freeze = FALSE;                              /* Can be set by ACL */
-fake_reject = FALSE;                                 /* Can be set by ACL */
+fake_response = OK;                                  /* Can be set by ACL */
 #ifdef WITH_CONTENT_SCAN
 no_mbox_unspool = FALSE;                             /* Can be set by ACL */
 #endif
--- exim-src/exim_monitor/em_globals.c  29 Apr 2005 11:54:23 -0000      1.6
+++ exim-src/exim_monitor/em_globals.c  20 May 2005 10:41:23 -0000
@@ -145,7 +145,7 @@
 BOOL    dont_deliver           = FALSE;
 
 #ifdef WITH_CONTENT_SCAN
-BOOL   fake_reject             = FALSE;
+int     fake_response          = OK;
 #endif
 
 header_line *header_last       = NULL;