Commit 67701e56 authored by pvuorela's avatar pvuorela

Merge branch 'tspecials' into 'master'

[messagingframework] Add missing slash character as protected in header parameters. Contributes to JB#51533

See merge request !48
parents cd6ea7c6 8bd77a0e
From a5191e0ebbbbf6b8f3636394f24499bd34f3fba6 Mon Sep 17 00:00:00 2001
From: Damien Caliste <dcaliste@free.fr>
Date: Wed, 2 Sep 2020 16:58:12 +0200
Subject: [PATCH] Add missing slash character as protected in header parameters
For some reason the '/' character that is defined as a protected
character in RFC2045 for values of parameters in header
Content-Type field, was missing. As a result the protocol
parameter for multipart/signed emails was not escaped which
is faulty and was confusing some email clients.
Change-Id: Id9d43b883187317ec152eea56819822612bfe307
---
src/libraries/qmfclient/qmailmessage.cpp | 3 ++-
tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/libraries/qmfclient/qmailmessage.cpp b/src/libraries/qmfclient/qmailmessage.cpp
index 71491f1a..38d1eee3 100644
--- a/src/libraries/qmfclient/qmailmessage.cpp
+++ b/src/libraries/qmfclient/qmailmessage.cpp
@@ -1956,7 +1956,8 @@ void QMailMessageHeaderFieldPrivate::setParameterEncoded(const QByteArray& name)
static QByteArray protectedParameter(const QByteArray& value)
{
QRegExp whitespace(QLatin1String("\\s+"));
- QRegExp tspecials = QRegExp(QLatin1String("[<>\\[\\]\\(\\)\\?:;@\\\\,=]"));
+ // See list in RFC2045: https://tools.ietf.org/html/rfc2045#page-12
+ QRegExp tspecials = QRegExp(QLatin1String("[<>\\[\\]\\(\\)\\?:;@\\\\,=/]"));
if ((whitespace.indexIn(value) != -1) ||
(tspecials.indexIn(value) != -1))
diff --git a/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp b/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp
index 34d8ae63..7f3f0eef 100644
--- a/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp
+++ b/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp
@@ -574,6 +574,14 @@ void tst_QMailMessageHeaderField::setParameter()
QVERIFY( header2.isParameterEncoded(name) == false );
QCOMPARE( header3.parameter(name), oversize );
QVERIFY( header3.isParameterEncoded(name) == false );
+
+ QMailMessageHeaderField header4("Content-Type: multipart/signed");
+ name = "protocol";
+ parameter = "application/pgp-signature";
+
+ header4.setParameter(name, parameter);
+ QCOMPARE( header4.toString(), QByteArray("Content-Type: multipart/signed;"
+ " protocol=\"application/pgp-signature\"") );
}
void tst_QMailMessageHeaderField::isParameterEncoded()
--
2.26.2
......@@ -53,6 +53,7 @@ Patch21: 0021-Set-new-IMAP-folders-to-inherit-SynchronizationEnabl.patch
Patch22: 0022-Set-qmf-accountscheck-to-be-run-by-the-booster.patch
Patch23: 0023-Retrieve-message-lists-based-on-the-folder-sync-poli.patch
Patch24: 0024-Apply-folder-policy-to-always-on-connection.patch
Patch25: 0025-Add-missing-slash-character-as-protected-in-header-p.patch
%description
The Qt Messaging Framework, QMF, consists of a C++ library and daemon server
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment