[Mimedefang] Greylisting++

Jonas Eckerman jonas_lists at frukt.org
Wed Jul 11 10:32:03 EDT 2007


David F. Skoll wrote:

>> BTW, David, would it be fairly easy to add a new filter_headers() call
>> that happens after the headers are decoded, but before the body is
>> decoded?

> It would, but I hestiate to do it.

If the intent is to save work, a filter callback done before the 
body is decoded could be done from "do_scan" in mimedefang.pl, 
wich wouldn't require any extra milter callbacks.

I actually started on implementing a callback called 
"filter_prescan", but other things stole my time.

It would simply be something like this in do_scan in mimedefang.pl:

---8<---
--- mimedefang.pl	Tue Jun 12 01:30:45 2007
+++ mimedefang.pl	Wed Jul 11 16:30:42 2007
@@ -5451,6 +5451,19 @@
  	return -1;
      }

+    # Call pre-MIME-load filter if defined
+    if (defined(&filter_prescan)) {
+	push_status_tag("In filter_prescan");
+	filter_prescan();
+	pop_status_tag();
+	if (message_rejected()) {
+	    md_syslog('debug', "$MsgID: filter_prescan rejected message.");
+	    signal_unchanged();
+	    signal_complete();
+	    return;
+	}
+    }
+
      my $entity;
      my $parser;
      if (defined(&filter_create_parser)) {
---8<---

That should give the filter code the opportunity to reject after 
DATA but before the MIME decoding.

Please note that the code above is a sketch that I never got 
around to actually testing or finalizing.

Regards
/JOnas Eckerman
-- 
Jonas Eckerman, FSDB & Fruktträdet
http://whatever.frukt.org/
http://www.fsdb.org/
http://www.frukt.org/




More information about the MIMEDefang mailing list