public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: kde-apps/kdepim-runtime/, kde-apps/kdepim-runtime/files/
Date: Thu, 16 Dec 2021 16:59:54 +0000 (UTC)	[thread overview]
Message-ID: <1639673978.cecff9745ecabf06913db8b591b2832a856c7401.asturm@gentoo> (raw)

commit:     cecff9745ecabf06913db8b591b2832a856c7401
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 16 15:16:01 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Dec 16 16:59:38 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cecff974

kde-apps/kdepim-runtime: POP3: Fix SSL connections

See also:
https://mail.kde.org/pipermail/distributions/2021-December/001099.html
https://invent.kde.org/pim/kdepim-runtime/-/merge_requests/63

KDE-bug: https://bugs.kde.org/show_bug.cgi?id=446751
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 ...-runtime-21.12.0-fix-pop3-ssl-connections.patch | 127 +++++++++++++++++++++
 .../kdepim-runtime-21.12.0-r1.ebuild               |  88 ++++++++++++++
 2 files changed, 215 insertions(+)

diff --git a/kde-apps/kdepim-runtime/files/kdepim-runtime-21.12.0-fix-pop3-ssl-connections.patch b/kde-apps/kdepim-runtime/files/kdepim-runtime-21.12.0-fix-pop3-ssl-connections.patch
new file mode 100644
index 000000000000..e911588dbdcb
--- /dev/null
+++ b/kde-apps/kdepim-runtime/files/kdepim-runtime-21.12.0-fix-pop3-ssl-connections.patch
@@ -0,0 +1,127 @@
+From f14fabcefb45790175e209ef8ae394def4a805e9 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Fri, 10 Dec 2021 21:55:13 +0100
+Subject: [PATCH] POP3: Fix SSL connections
+
+We need to go into ssl before trying to read from the socket, otherwise
+nothing works
+
+BUGS: 446751
+---
+ resources/pop3/pop3protocol.cpp | 72 ++++++++++++++++++++-------------
+ resources/pop3/pop3protocol.h   |  2 +
+ 2 files changed, 45 insertions(+), 29 deletions(-)
+
+diff --git a/resources/pop3/pop3protocol.cpp b/resources/pop3/pop3protocol.cpp
+index c2d01d33a..15971919e 100644
+--- a/resources/pop3/pop3protocol.cpp
++++ b/resources/pop3/pop3protocol.cpp
+@@ -535,6 +535,39 @@ Result POP3Protocol::loginPASS()
+     return Result::pass();
+ }
+ 
++Result POP3Protocol::startSsl()
++{
++    mSocket->ignoreSslErrors(); // Don't worry, errors are handled manually below
++    mSocket->startClientEncryption();
++    const bool encryptionStarted = mSocket->waitForEncrypted(s_connectTimeout);
++
++    const QSslCipher cipher = mSocket->sessionCipher();
++    const QList<QSslError> errors = mSocket->sslHandshakeErrors();
++    if (!encryptionStarted || !errors.isEmpty() || !mSocket->isEncrypted() || cipher.isNull() || cipher.usedBits() == 0) {
++        QString errorString = std::accumulate(errors.begin(), errors.end(), QString(), [](QString cur, const QSslError &error) {
++            if (!cur.isEmpty())
++                cur += QLatin1Char('\n');
++            cur += error.errorString();
++            return cur;
++        });
++
++        qCDebug(POP3_LOG) << "Initial SSL handshake failed. cipher.isNull() is" << cipher.isNull() << ", cipher.usedBits() is" << cipher.usedBits()
++                          << ", the socket says:" << mSocket->errorString() << "and the SSL errors are:" << errorString;
++        mContinueAfterSslError = false;
++        Q_EMIT sslError(KSslErrorUiData(mSocket));
++        if (!mContinueAfterSslError) {
++            if (errorString.isEmpty())
++                errorString = mSocket->errorString();
++            qCDebug(POP3_LOG) << "TLS setup has failed. Aborting." << errorString;
++            closeConnection();
++            return Result::fail(ERR_SSL_FAILURE, i18n("SSL/TLS error: %1", errorString));
++        }
++    } else {
++        qCDebug(POP3_LOG) << "TLS has been enabled.";
++    }
++    return Result::pass();
++}
++
+ Result POP3Protocol::openConnection()
+ {
+     m_try_apop = mSettings.authenticationMethod() == MailTransport::Transport::EnumAuthenticationType::APOP;
+@@ -560,6 +593,13 @@ Result POP3Protocol::openConnection()
+             return Result::fail(mSocket->error(), errorString);
+         }
+ 
++        if (mSettings.useSSL()) {
++            const Result res = startSsl();
++            if (!res.success) {
++                return res;
++            }
++        }
++
+         mConnected = true;
+ 
+         greeting_buf = new char[GREETING_BUF_LEN];
+@@ -608,35 +648,9 @@ Result POP3Protocol::openConnection()
+                                          "was unsuccessful.\nYou can "
+                                          "disable TLS in the POP account settings dialog."));
+             }
+-        }
+-        if (mSettings.useSSL() || mSettings.useTLS()) {
+-            mSocket->ignoreSslErrors(); // Don't worry, errors are handled manually below
+-            mSocket->startClientEncryption();
+-            const bool encryptionStarted = mSocket->waitForEncrypted(s_connectTimeout);
+-
+-            const QSslCipher cipher = mSocket->sessionCipher();
+-            const QList<QSslError> errors = mSocket->sslHandshakeErrors();
+-            if (!encryptionStarted || !errors.isEmpty() || !mSocket->isEncrypted() || cipher.isNull() || cipher.usedBits() == 0) {
+-                QString errorString = std::accumulate(errors.begin(), errors.end(), QString(), [](QString cur, const QSslError &error) {
+-                    if (!cur.isEmpty())
+-                        cur += QLatin1Char('\n');
+-                    cur += error.errorString();
+-                    return cur;
+-                });
+-
+-                qCDebug(POP3_LOG) << "Initial SSL handshake failed. cipher.isNull() is" << cipher.isNull() << ", cipher.usedBits() is" << cipher.usedBits()
+-                                  << ", the socket says:" << mSocket->errorString() << "and the SSL errors are:" << errorString;
+-                mContinueAfterSslError = false;
+-                Q_EMIT sslError(KSslErrorUiData(mSocket));
+-                if (!mContinueAfterSslError) {
+-                    if (errorString.isEmpty())
+-                        errorString = mSocket->errorString();
+-                    qCDebug(POP3_LOG) << "TLS setup has failed. Aborting." << errorString;
+-                    closeConnection();
+-                    return Result::fail(ERR_SSL_FAILURE, i18n("SSL/TLS error: %1", errorString));
+-                }
+-            } else {
+-                qCDebug(POP3_LOG) << "TLS has been enabled.";
++            const Result res = startSsl();
++            if (!res.success) {
++                return res;
+             }
+         }
+ 
+diff --git a/resources/pop3/pop3protocol.h b/resources/pop3/pop3protocol.h
+index 9b40b334f..d01f7ab7a 100644
+--- a/resources/pop3/pop3protocol.h
++++ b/resources/pop3/pop3protocol.h
+@@ -127,6 +127,8 @@ private:
+      */
+     Q_REQUIRED_RESULT Result loginPASS();
+ 
++    Q_REQUIRED_RESULT Result startSsl();
++
+     const Settings &mSettings;
+     QSslSocket *const mSocket;
+     unsigned short int m_iPort;
+-- 
+GitLab
+

diff --git a/kde-apps/kdepim-runtime/kdepim-runtime-21.12.0-r1.ebuild b/kde-apps/kdepim-runtime/kdepim-runtime-21.12.0-r1.ebuild
new file mode 100644
index 000000000000..a66086cea67a
--- /dev/null
+++ b/kde-apps/kdepim-runtime/kdepim-runtime-21.12.0-r1.ebuild
@@ -0,0 +1,88 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ECM_HANDBOOK="optional"
+ECM_TEST="forceoptional"
+PVCUT=$(ver_cut 1-3)
+KFMIN=5.88.0
+QTMIN=5.15.2
+VIRTUALX_REQUIRED="test"
+inherit ecm kde.org
+
+DESCRIPTION="Runtime plugin collection to extend the functionality of KDE PIM"
+HOMEPAGE="https://apps.kde.org/kontact/"
+
+LICENSE="GPL-2+ LGPL-2.1+"
+SLOT="5"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
+IUSE="speech"
+
+RESTRICT="test"
+
+# TODO kolab
+RDEPEND="
+	>=app-crypt/qca-2.3.0:2
+	dev-libs/cyrus-sasl:2
+	dev-libs/libical:=
+	dev-libs/qtkeychain:=
+	>=dev-qt/qtdbus-${QTMIN}:5
+	>=dev-qt/qtgui-${QTMIN}:5
+	>=dev-qt/qtnetwork-${QTMIN}:5
+	>=dev-qt/qtnetworkauth-${QTMIN}:5
+	>=dev-qt/qtwebengine-${QTMIN}:5[widgets]
+	>=dev-qt/qtwidgets-${QTMIN}:5
+	>=dev-qt/qtxml-${QTMIN}:5
+	>=kde-apps/akonadi-${PVCUT}:5
+	>=kde-apps/akonadi-calendar-${PVCUT}:5
+	>=kde-apps/akonadi-contacts-${PVCUT}:5
+	>=kde-apps/akonadi-mime-${PVCUT}:5
+	>=kde-apps/akonadi-notes-${PVCUT}:5
+	>=kde-apps/kalarmcal-${PVCUT}:5
+	>=kde-apps/kcalutils-${PVCUT}:5
+	>=kde-apps/kidentitymanagement-${PVCUT}:5
+	>=kde-apps/kimap-${PVCUT}:5
+	>=kde-apps/kldap-${PVCUT}:5
+	>=kde-apps/kmailtransport-${PVCUT}:5
+	>=kde-apps/kmbox-${PVCUT}:5
+	>=kde-apps/kmime-${PVCUT}:5
+	>=kde-apps/libkdepim-${PVCUT}:5
+	>=kde-apps/libkgapi-${PVCUT}:5
+	>=kde-frameworks/kcalendarcore-${KFMIN}:5
+	>=kde-frameworks/kcmutils-${KFMIN}:5
+	>=kde-frameworks/kcodecs-${KFMIN}:5
+	>=kde-frameworks/kcompletion-${KFMIN}:5
+	>=kde-frameworks/kconfig-${KFMIN}:5
+	>=kde-frameworks/kconfigwidgets-${KFMIN}:5
+	>=kde-frameworks/kcontacts-${KFMIN}:5
+	>=kde-frameworks/kcoreaddons-${KFMIN}:5
+	>=kde-frameworks/kdav-${KFMIN}:5
+	>=kde-frameworks/kholidays-${KFMIN}:5
+	>=kde-frameworks/ki18n-${KFMIN}:5
+	>=kde-frameworks/kio-${KFMIN}:5
+	>=kde-frameworks/kitemmodels-${KFMIN}:5
+	>=kde-frameworks/kjobwidgets-${KFMIN}:5
+	>=kde-frameworks/knotifications-${KFMIN}:5
+	>=kde-frameworks/knotifyconfig-${KFMIN}:5
+	>=kde-frameworks/kservice-${KFMIN}:5
+	>=kde-frameworks/ktextwidgets-${KFMIN}:5
+	>=kde-frameworks/kwidgetsaddons-${KFMIN}:5
+	>=kde-frameworks/kwindowsystem-${KFMIN}:5
+	>=kde-frameworks/kxmlgui-${KFMIN}:5
+	speech? ( >=dev-qt/qtspeech-${QTMIN}:5 )
+"
+DEPEND="${RDEPEND}
+	>=dev-qt/qtxmlpatterns-${QTMIN}:5
+	test? ( >=kde-apps/kimap-${PVCUT}:5[test] )
+"
+
+PATCHES=( "${FILESDIR}"/${P}-fix-pop3-ssl-connections.patch )
+
+src_configure() {
+	local mycmakeargs=(
+		-DCMAKE_DISABLE_FIND_PACKAGE_Libkolabxml=ON
+		$(cmake_use_find_package speech Qt5TextToSpeech)
+	)
+	ecm_src_configure
+}


             reply	other threads:[~2021-12-16 17:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16 16:59 Andreas Sturmlechner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-02-19 18:53 [gentoo-commits] repo/gentoo:master commit in: kde-apps/kdepim-runtime/, kde-apps/kdepim-runtime/files/ Andreas Sturmlechner
2018-11-11 22:10 Andreas Sturmlechner
2017-05-26 15:40 Andreas Sturmlechner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1639673978.cecff9745ecabf06913db8b591b2832a856c7401.asturm@gentoo \
    --to=asturm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox