Commit 339c1fb0 authored by Raine Makelainen's avatar Raine Makelainen

Merge branch 'jb46655' into 'master'

[qmf] Use socket's local address for HELO and EHLO messages. Fixes JB#46655

See merge request !33
parents e6a00933 dd47d764
From f1d94263e07c729a55abf227ca7a3fc4137a4445 Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Tue, 23 Jul 2019 11:44:27 +0300
Subject: [PATCH 18/18] Use socket's local address for HELO and EHLO messages
Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
src/plugins/messageservices/smtp/smtpclient.cpp | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/plugins/messageservices/smtp/smtpclient.cpp b/src/plugins/messageservices/smtp/smtpclient.cpp
index 19f69880..0300dcf1 100644
--- a/src/plugins/messageservices/smtp/smtpclient.cpp
+++ b/src/plugins/messageservices/smtp/smtpclient.cpp
@@ -81,11 +81,14 @@ static QByteArray messageId(const QByteArray& domainName, quint32 addressCompone
'>').toLatin1();
}
-static QByteArray localName()
+static QByteArray localName(const QHostAddress &hostAddress)
{
+
QByteArray result(QHostInfo::localDomainName().toLatin1());
if (!result.isEmpty())
return result;
+ if (!hostAddress.isNull())
+ return "[" + hostAddress.toString().toLatin1() + "]";
QList<QHostAddress> addresses(QNetworkInterface::allAddresses());
if (addresses.isEmpty())
return "localhost.localdomain";
@@ -317,7 +320,7 @@ void SmtpClient::connected(QMailTransport::EncryptType encryptType)
#ifndef QT_NO_SSL
if ((smtpCfg.smtpEncryption() == QMailTransport::Encrypt_TLS) && (status == TLS)) {
// We have entered TLS mode - restart the SMTP dialog
- QByteArray ehlo("EHLO " + localName());
+ QByteArray ehlo("EHLO " + localName(transport->socket().localAddress()));
sendCommand(ehlo);
status = Helo;
}
@@ -460,7 +463,7 @@ void SmtpClient::nextAction(const QString &response)
capabilities.clear();
// We need to know if extensions are supported
- QByteArray ehlo("EHLO " + localName());
+ QByteArray ehlo("EHLO " + localName(transport->socket().localAddress()));
sendCommand(ehlo);
status = Helo;
} else {
@@ -472,7 +475,7 @@ void SmtpClient::nextAction(const QString &response)
{
if (responseCode == 500) {
// EHLO is not implemented by this server - fallback to HELO
- QByteArray ehlo("HELO " + localName());
+ QByteArray ehlo("HELO " + localName(transport->socket().localAddress()));
sendCommand(ehlo);
} else if (responseCode == 250) {
if (domainName.isEmpty()) {
@@ -703,7 +706,7 @@ void SmtpClient::nextAction(const QString &response)
operationFailed(QMailServiceAction::Status::ErrConfiguration, response);
}
// Restart the authentication process
- QByteArray ehlo("EHLO " + localName());
+ QByteArray ehlo("EHLO " + localName(transport->socket().localAddress()));
sendCommand(ehlo);
status = Helo;
} else {
--
2.21.0
......@@ -45,6 +45,7 @@ Patch14: 0014-Prevent-push-enabled-status-to-go-out-of-sync.patch
Patch15: 0015-Check-if-IDLE-connection-needs-to-be-established-aft.patch
Patch16: 0016-Revert-Fix-bundled-zlib-detection.patch
Patch17: 0017-Add-signature-settings-in-account.patch
Patch18: 0018-Use-socket-s-local-address-for-HELO-and-EHLO-message.patch
%description
The Qt Messaging Framework, QMF, consists of a C++ library and daemon server
......@@ -167,6 +168,7 @@ This package contains the tests for Qt Messaging Framework (QMF).
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%build
......
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