Package: spamass-milter
Version: 0.4.0-2

Referring to the discussion at 
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7785, it is still unclear 
whether this bug will be fixed in Mail::DKIM or in spamassassin 4.0.

For the time being, I have tested the patch provided by Henrik Krohns 
(https://savannah.nongnu.org/bugs/download.php?file_id=48244) attached to bug 
report "#57626: Folded headers not keeping CRLF newlines” 
(https://savannah.nongnu.org/bugs/index.php?57626) to spamass-milter 0.4.0-2. 
It works and the milter reports DKIM status correctly.

Would be great if you could integrate the patch “header_crlf” to 
debian/patches/series.

header_crlf:

<snip>

Description: Spamass-milter doesn't properly maintain CRLF in folded header 
newlines.
Origin: https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7785
Bug: #7785
Author: Henrik Krohns, Matthieu Schapranow 
<schapra...@hpi.de<mailto:schapra...@hpi.de>>
Forwarded: no
--- a/spamass-milter.cpp
+++ b/spamass-milter.cpp
@@ -1206,7 +1206,23 @@ mlfi_header(SMFICTX* ctx, char* headerf,
     assassin->set_subject(headerv);

   // assemble header to be written to SpamAssassin
-  string header = string(headerf) + ": " + headerv + "\r\n";
+  string header = headerv;
+
+  // Replace all LF with CRLF
+  // As milter documentation says:
+  //     headerv    Header field value.  The content of the header may
+  //       include folded white space, i.e., multiple lines with following
+  //       white space where lines are separated by LF (not CR/LF).  The
+  //       trailing line terminator (CR/LF) is removed.
+  // Need to make sure folded header line breaks are sent to SA as CRLF
+  string::size_type idx = header.size();
+  while ( (idx = header.rfind("\n", idx)) != string::npos )
+  {
+     header.replace(idx,1,"\r\n");
+  }
+
+  // final assembly
+  header = string(headerf) + ": " + header + "\r\n";

   try {
     // write to SpamAssassin client

</snip>

Thanks,

Matthieu Schapranow

Reply via email to