Hello community,

here is the log from the commit of package ksmtp for openSUSE:Factory checked 
in at 2017-12-22 13:22:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ksmtp (Old)
 and      /work/SRC/openSUSE:Factory/.ksmtp.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ksmtp"

Fri Dec 22 13:22:37 2017 rev:2 rq:559311 version:17.12.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/ksmtp/ksmtp.changes      2017-12-18 
08:56:14.664251552 +0100
+++ /work/SRC/openSUSE:Factory/.ksmtp.new/ksmtp.changes 2017-12-22 
13:22:39.424036610 +0100
@@ -1,0 +2,7 @@
+Fri Dec 22 11:25:06 UTC 2017 - fab...@ritter-vogt.de
+
+- Add patch to fix sending of emails over SSL (without STARTTLS):
+  * 0001-Fix-duplicate-authentication.patch
+  * Fixes kde#388068, kde#387926 and boo#1073975
+
+-------------------------------------------------------------------

New:
----
  0001-Fix-duplicate-authentication.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ksmtp.spec ++++++
--- /var/tmp/diff_new_pack.V9Ibhj/_old  2017-12-22 13:22:40.723973226 +0100
+++ /var/tmp/diff_new_pack.V9Ibhj/_new  2017-12-22 13:22:40.723973226 +0100
@@ -26,6 +26,8 @@
 Group:          System/GUI/KDE
 Url:            http://www.kde.org
 Source0:        %{name}-%{version}.tar.xz
+# PATCH-FIX-UPSTREAM
+Patch1:         0001-Fix-duplicate-authentication.patch
 BuildRequires:  cyrus-sasl-devel
 BuildRequires:  extra-cmake-modules >= 1.0.0
 BuildRequires:  kcoreaddons-devel
@@ -74,6 +76,7 @@
 
 %prep
 %setup -q
+%patch1 -p1
 
 %build
   %cmake_kf5 -d build -- -DBUILD_TESTING=ON

++++++ 0001-Fix-duplicate-authentication.patch ++++++
>From fbf5bf91eb903ec0c13d7319886634a6468a0345 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fab...@ritter-vogt.de>
Date: Fri, 22 Dec 2017 11:02:01 +0100
Subject: [PATCH] Fix duplicate authentication

Summary:
The response to EHLO triggers an authentication command, but with TLS
two EHLOs are sent: For the 220 from the server and after TLS negotiation.
However, sending it twice results in an unexpected "503 already authenticated"
response which ends up getting parsed by the SendJob, causing confusion.

By leaving the EHLO-resending to the SessionPrivate, the state can be properly
tracked.

BUG: 387926
BUG: 388068

Reviewers: mlaurent, dvratil

Subscribers: lbeltrame, cgiboudeaux

Differential Revision: https://phabricator.kde.org/D9476
---
 src/session.cpp       | 29 +++++++++++++++++++----------
 src/session_p.h       |  1 +
 src/sessionthread.cpp |  1 -
 3 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/src/session.cpp b/src/session.cpp
index 861419d..4320adc 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -80,6 +80,19 @@ void SessionPrivate::setAuthenticationMethods(const 
QList<QByteArray> &authMetho
     }
 }
 
+void SessionPrivate::startHandshake()
+{
+    QByteArray cmd;
+    if (!m_ehloRejected) {
+         cmd = "EHLO ";
+    } else {
+         cmd = "HELO ";
+    }
+    setState(Session::Handshake);
+    const auto hostname = m_customHostname.isEmpty() ? m_thread->hostName() : 
m_customHostname;
+    sendData(cmd + QUrl::toAce(hostname));
+}
+
 
 
 Session::Session(const QString &hostName, quint16 port, QObject *parent)
@@ -277,15 +290,7 @@ void SessionPrivate::responseReceived(const ServerResponse 
&r)
 
     if (m_state == Session::Ready) {
         if (r.isCode(22) || m_ehloRejected) {
-            QByteArray cmd;
-            if (!m_ehloRejected) {
-                cmd = "EHLO ";
-            } else {
-                cmd = "HELO ";
-            }
-            setState(Session::Handshake);
-            const auto hostname = m_customHostname.isEmpty() ? 
m_thread->hostName() : m_customHostname;
-            sendData(cmd + QUrl::toAce(hostname));
+            startHandshake();
             return;
         }
     }
@@ -346,7 +351,11 @@ KTcpSocket::SslVersion 
SessionPrivate::negotiatedEncryption() const
 
 void SessionPrivate::encryptionNegotiationResult(bool encrypted, 
KTcpSocket::SslVersion version)
 {
-    Q_UNUSED(encrypted);
+    if (encrypted) {
+        // Get the updated auth methods
+        startHandshake();
+    }
+
     m_sslVersion = version;
 }
 
diff --git a/src/session_p.h b/src/session_p.h
index 875f7be..90151f6 100644
--- a/src/session_p.h
+++ b/src/session_p.h
@@ -73,6 +73,7 @@ private Q_SLOTS:
 
 private:
 
+    void startHandshake();
     void startNext();
     void startSocketTimer();
     void stopSocketTimer();
diff --git a/src/sessionthread.cpp b/src/sessionthread.cpp
index 1e4db8b..c195826 100644
--- a/src/sessionthread.cpp
+++ b/src/sessionthread.cpp
@@ -223,7 +223,6 @@ void SessionThread::sslConnected()
     } else {
         qCDebug(KSMTP_LOG) << "TLS negotiation done.";
 
-        QMetaObject::invokeMethod(this, "sendData", Qt::QueuedConnection, 
Q_ARG(QByteArray, "EHLO " + QUrl::toAce(hostName())));
         Q_EMIT encryptionNegotiationResult(true, 
m_socket->negotiatedSslVersion());
     }
 }
-- 
2.15.0


Reply via email to