0
0
mirror of https://github.com/PHPMailer/PHPMailer.git synced 2024-09-20 18:03:04 +02:00
This commit is contained in:
Jim Jagielski 2017-12-12 13:50:56 -05:00
commit 4f62497920
2 changed files with 10 additions and 6 deletions

View File

@ -1,5 +1,7 @@
# PHPMailer Change Log
* Correct DKIM canonicalization of line breaks for header & body - thanks to @themichaelhall
## Version 6.0.2 (November 29th 2017)
* Don't make max line length depend on line break format
* Improve Travis-CI config - thanks to Filippo Tessarotto

View File

@ -4049,7 +4049,7 @@ class PHPMailer
// Normalise to \n
$text = str_replace(["\r\n", "\r"], "\n", $text);
// Now convert LE as needed
if ("\n" !== static::$LE) {
if ("\n" !== $breaktype) {
$text = str_replace("\n", $breaktype, $text);
}
@ -4154,6 +4154,7 @@ class PHPMailer
/**
* Generate a DKIM canonicalization header.
* Uses the 'relaxed' algorithm from RFC6376 section 3.4.2.
* Canonicalized headers should *always* use CRLF, regardless of mailer setting.
*
* @see https://tools.ietf.org/html/rfc6376#section-3.4.2
*
@ -4189,12 +4190,13 @@ class PHPMailer
$lines[$key] = trim($heading, " \t") . ':' . trim($value, " \t");
}
return implode(static::$LE, $lines);
return implode("\r\n", $lines);
}
/**
* Generate a DKIM canonicalization body.
* Uses the 'simple' algorithm from RFC6376 section 3.4.3.
* Canonicalized bodies should *always* use CRLF, regardless of mailer setting.
*
* @see https://tools.ietf.org/html/rfc6376#section-3.4.3
*
@ -4205,13 +4207,13 @@ class PHPMailer
public function DKIM_BodyC($body)
{
if (empty($body)) {
return static::$LE;
return "\r\n";
}
// Normalize line endings
$body = static::normalizeBreaks($body);
// Normalize line endings to CRLF
$body = static::normalizeBreaks($body, "\r\n");
//Reduce multiple trailing line breaks to a single one
return rtrim($body, "\r\n") . static::$LE;
return rtrim($body, "\r\n") . "\r\n";
}
/**