Fwd: Re: [Exim] Pseudo-rejection of Spam using local_scan()

Góra strony
Delete this message
Reply to this message
Autor: Pete Gonzalez
Data:  
Dla: exim-users
Temat: Fwd: Re: [Exim] Pseudo-rejection of Spam using local_scan()
Apparently the attachment was deleted from my previous message,
so I'm pasting the text inline.

-Pete

-----------------Forwarded Message--------------
To: exim-users@???
From: Pete Gonzalez <pgonzalez@???>
Subject: Re: [Exim] Pseudo-rejection of Spam using local_scan()
Date: Sat, 26 Jun 2004 14:49:38 -0400

At 10:19 PM 6/24/2004, you wrote:
>followed by "250 OK id=...". Another approach would be to resend the
>rejected e-mail, but then local_scan() will get called recursively,
>requiring extra headers to distinguish the already-scanned mail.
>So apparently my choice is between dealing with that problem, or
>hacking at Exim's receive.c to implement a new code such as
>LOCAL_SCAN_FAKE_REJECT.


Attached is a patch that adds the LOCAL_SCAN_FAKE_REJECT behavior
described in my previous e-mail. Since it adds a new enum, this
patch should not break compatibility with previous local_scan()
shared libraries.

-Pete

[ exim-FakeReject.patch of type application/octet-stream deleted ]
___________________

diff -Nau src/original/local_scan.h src/local_scan.h
--- src/original/local_scan.h    Thu Jun 24 22:49:57 2004
+++ src/local_scan.h    Thu Jun 24 22:51:24 2004
@@ -28,7 +28,8 @@
    LOCAL_SCAN_REJECT,              /* Permanent rejection */
    LOCAL_SCAN_REJECT_NOLOGHDR,     /* Permanent rejection, no log header */
    LOCAL_SCAN_TEMPREJECT,          /* Temporary rejection */
-  LOCAL_SCAN_TEMPREJECT_NOLOGHDR  /* Temporary rejection, no log header */
+  LOCAL_SCAN_TEMPREJECT_NOLOGHDR, /* Temporary rejection, no log header */
+  LOCAL_SCAN_FAKE_REJECT          /* Fake 550 rejection, but deliver anyway */
  };



Common subdirectories: src/original/new and src/new
Common subdirectories: src/original/original and src/original
diff -Nau src/original/receive.c src/receive.c
--- src/original/receive.c    Thu Jun 24 21:44:59 2004
+++ src/receive.c    Thu Jun 24 22:51:28 2004
@@ -2608,6 +2608,28 @@
      }
    rc = LOCAL_SCAN_ACCEPT;
    }
+else if (rc == LOCAL_SCAN_FAKE_REJECT)
+  {
+  rc = LOCAL_SCAN_ACCEPT;
+
+  if (smtp_input && !smtp_batched_input)
+    {
+    errmsg = US"550 Administrative prohibition";
+    if (local_scan_data != NULL)
+      {
+      errmsg = local_scan_data;  /* use local_scan_data as custom message */
+      local_scan_data = NULL;
+      }
+
+    smtp_respond(550, TRUE, errmsg);
+    errmsg = NULL;
+    smtp_reply = US"";           /* Indicate reply already sent */
+    }
+  else
+    {
+      /* Fake reject only makes sense in SMTP mode -- issue warning? */
+    }
+  }


/* Message accepted: remove newlines in local_scan_data because otherwise
the spool file gets corrupted. Ensure that all recipients are qualified. */