Jonathan A. Zdziarski wrote:
> best to call this release 3.8.0 instead of 3.6.9, as I had been
> originally planning. Don't be fooled, though - it's very similar to 3.6,
> but has been optimized significantly and some important bugfixes have
> been made.

If you are running (or intend to run) 3.8.0 *AND* you are using LMTP or SMTP (as
opposed to running the client directly from a delivery script), *AND* you are
using the quarantine feature, you will need to apply the attached patch.  This
replaces my previous patch on this topic, as I discovered a few more spots that
needed fixing.

<backstory>
Because of the way that the LMTP/SMTP support is currently structured, the
headers of an e-mail are stored internally to dspam with CRLF pairs (to make it
easier to transmit this information later to the next hop, presumably).
Unfortunately, these CRLF pairs are not correctly stripped out when saving the
message to the quarantine mbox file.  This mixed EOL behavior breaks the WebUI.
 The symptoms are:

1) You cannot view the message out of quarantine (just shows an empty box);

2) You cannot release a false positive from quarantine (or indeed delete only
some messages);

3) You can "Delete All" messages from quarantine.

This patch simply papers over this corrupted mbox file problem.  The correct fix
would be to abstract out all of the LMTP/SMTP handling code into a mini-MTA.
Internally, the message should be stored as an array of headers, plus a block of
body content.  Only during the actual LMTP/SMTP message transferral should the
headers be sent with CRLF.  Such an abstraction should also be the preferable
way to deal with the transmission of lines containing only a single period
(which need to be doubled *only* during the SMTP/LMTP transaction).

The on-disk representation, e.g. as an mbox file for quarantine purposes, should
never have mixed end of line CRLF, but rather must be LF only.
</backstory>

One other thing this patch fixes is the behavior where graphs wouldn't display
correctly if no messages were received over a 24 hour period (rare in this day
and age).

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Blvd
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747
--- webui.orig/cgi-bin/dspam.cgi	2007-02-14 13:18:59.000000000 -0500
+++ webui/cgi-bin/dspam.cgi	2007-03-27 16:43:46.000000000 -0400
@@ -531,10 +532,13 @@
   foreach my $period (qw( daily weekly )) {
     my $uc_period=uc($period);
     my $hk="DATA_$uc_period";
-    my %lst=();
+    my %lst=(
+	spam => [],
+	nonspam => [],
+	title	=> []
+    );
     foreach my $hr (sort {$a->{idx}<=>$b->{idx}} (values %{$Stats{$period}})) {
       foreach my $type (qw( spam nonspam title )) {
-        (exists $lst{$type}) || ($lst{$type}=[]);
         push(@{$lst{$type}},$hr->{$type});
         my $totk="";
         if ($type eq "spam") { $totk="S"; }
@@ -546,9 +550,9 @@
       }
     }
     $DATA{$hk}=join("_",
-		join(",",@{$lst{spam}}),
-		join(",",@{$lst{nonspam}}),
-		join(",",@{$lst{title}}),
+		join(",",@{$lst{spam}}    || [0]),
+		join(",",@{$lst{nonspam}} || [0]),
+		join(",",@{$lst{title}}   || [0]),
 	);
   }
 
@@ -698,7 +702,7 @@
   }
   open(FILE, "<$MAILBOX");
   while(<FILE>) {
-    chomp;
+    s/\r?\n$//;
     push(@buffer, $_);
   }
   close(FILE);
@@ -759,7 +763,7 @@
 
   open(FILE, "<$MAILBOX");
   while(<FILE>) {
-    chomp;
+    s/\r?\n$//;
     push(@buffer, $_);
   }
   close(FILE);
@@ -839,7 +843,7 @@
 
   open(FILE, "<$MAILBOX");
   while(<FILE>) {
-    chomp;
+    s/\r?\n//;
     push(@buffer, $_);
   }
   close(FILE);
@@ -907,7 +911,7 @@
   }
   open(FILE, "<$MAILBOX");
   while(<FILE>) {
-    chomp;
+    s/\r?\n//;
     push(@buffer, $_);
   }
   close(FILE);
@@ -980,7 +984,7 @@
   $rowclass="rowEven";
   open(FILE, "<$MAILBOX");
   while(<FILE>) {
-    chomp;
+    s/\r?\n//;
     if ($_ ne "") {
       if ($mode eq "") { 
         if ($_ =~ /^From /) {

Reply via email to