I merged in the latest CVS trunk to my personal repository and discovered that Jonathan has committed yet a different way to try and handle embedded CR's during SMTP/LMTP transaction. Unfortunately, what he committed breaks viewing messages in the quarantine in the "relay" operational mode. This is the change I'm talking about:

revision 1.237
date: 2006-12-12 10:33:45 -0500;  author: jonz;  state: Exp;  lines: +2 -2
fixed message corruption problems with direct delivery

...snip...

--- src/dspam.c 18 Aug 2006 15:00:31 -0000      1.236
+++ src/dspam.c 12 Dec 2006 15:33:45 -0000      1.237
@@ -762,7 +762,7 @@

   /* Reassemble message from components */

-  copyback = _ds_assemble_message (CTX->message);
+  copyback = _ds_assemble_message (CTX->message, (USE_LMTP || USE_SMTP) ? "\r\n" : 
"\n");
   buffer_clear (message);
   buffer_cat (message, copyback);
   free (copyback);

Unfortunately, this means that the quarantine mbox file will have embedded "\r" characters, since a spam message is not written out to quarantine until *after* this point. The "Broken lineStripping" option has no effect on this at all (that only deals with incoming messages).

At this point, I merely patched dspam.cgi to be more forgiving of EOL characters:

Index: dspam.cgi
===================================================================
--- dspam.cgi   (revision 31)
+++ dspam.cgi   (revision 34)
@@ -843,7 +843,7 @@

   open(FILE, "<$MAILBOX");
   while(<FILE>) {
-    chomp;
+    s/\r?\n//;
     push(@buffer, $_);
   }
   close(FILE);
@@ -984,7 +984,7 @@
   $rowclass="rowEven";
   open(FILE, "<$MAILBOX");
   while(<FILE>) {
-    chomp;
+    s/\r?\n//;
     if ($_ ne "") {
       if ($mode eq "") {
         if ($_ =~ /^From /) {

which has the appropriate effect. The best long term solution would be (as I suggested back in November) to write a small MTA routine which would handle all of the SMTP/LMTP protocol issues (both LF => CRLF and the bare '.' handling) on an internal normalized message format. Then delivery via SMTP/LMTP would be correct and delivery via STDOUT or quarantine would also be correct.

Consider this a warning not to run TRUNK code in production... :(

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748

Reply via email to