From 251d8f2e0efc3dc4f1310bd9d02b735c29be4a22 Mon Sep 17 00:00:00 2001 From: Christoph Feck Date: Sat, 3 Oct 2020 12:55:34 +0200 Subject: [PATCH 1/3] GIT_SILENT Upgrade release service version to 20.08.2. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ded85e..64012f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.0) # KDE Application Version, managed by release script set (RELEASE_SERVICE_VERSION_MAJOR "20") set (RELEASE_SERVICE_VERSION_MINOR "08") -set (RELEASE_SERVICE_VERSION_MICRO "1") +set (RELEASE_SERVICE_VERSION_MICRO "2") set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}") project(krfb VERSION ${RELEASE_SERVICE_VERSION}) From 9d02f073bd28377d77e4e8204aa96b9e3a4cdd15 Mon Sep 17 00:00:00 2001 From: Christoph Feck Date: Sat, 3 Oct 2020 14:42:55 +0200 Subject: [PATCH 2/3] GIT_SILENT Update Appstream for new release --- krfb/org.kde.krfb.appdata.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/krfb/org.kde.krfb.appdata.xml b/krfb/org.kde.krfb.appdata.xml index 3110158..f0f1aca 100644 --- a/krfb/org.kde.krfb.appdata.xml +++ b/krfb/org.kde.krfb.appdata.xml @@ -151,9 +151,9 @@ KDE + - From fd362fd642491ee9b4ad42346776b2d4ec089b22 Mon Sep 17 00:00:00 2001 From: Alexey Min Date: Wed, 26 Aug 2020 15:55:44 +0300 Subject: [PATCH 3/3] Make sure to save security settings each time they are modified Settings that are modified using normal settings window, which is invoked using menu "Configure Desktop Sharing..." are always saved correctly. However some settings that are present on Krfb main window (normal password, unattended password, checkbox "enable unattended access") are not handled by KConfigDialog and there is a chance that settings might not be saved correctly (for example if application was suddenly terminated). This hopefully fixes some bugs which are present since year 2011-2014 and have 110 votes, like https://bugs.kde.org/show_bug.cgi?id=340411, maybe something else. BUG: 340411 FIXED-IN: 20.08.2 CHANGELOG: Make sure to save passwords each time they are modified --- krfb/invitationsrfbserver.cpp | 70 +++++++++++++++++++++++------------ krfb/invitationsrfbserver.h | 1 + 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/krfb/invitationsrfbserver.cpp b/krfb/invitationsrfbserver.cpp index bdbd9cb..eae2c4e 100644 --- a/krfb/invitationsrfbserver.cpp +++ b/krfb/invitationsrfbserver.cpp @@ -36,6 +36,9 @@ #include using KWallet::Wallet; +// used for KWallet folder name +static const QString s_krfbFolderName(QStringLiteral("krfb")); + //static InvitationsRfbServer *InvitationsRfbServer::instance; @@ -69,6 +72,9 @@ const QString& InvitationsRfbServer::desktopPassword() const void InvitationsRfbServer::setDesktopPassword(const QString& password) { m_desktopPassword = password; + // this is called from GUI every time desktop password is edited. + // make sure we save settings immediately each time + saveSecuritySettings(); } const QString& InvitationsRfbServer::unattendedPassword() const @@ -79,6 +85,9 @@ const QString& InvitationsRfbServer::unattendedPassword() const void InvitationsRfbServer::setUnattendedPassword(const QString& password) { m_unattendedPassword = password; + // this is called from GUI every time unattended password is edited. + // make sure we save settings immediately each time + saveSecuritySettings(); } bool InvitationsRfbServer::allowUnattendedAccess() const @@ -106,6 +115,9 @@ void InvitationsRfbServer::stop() void InvitationsRfbServer::toggleUnattendedAccess(bool allow) { m_allowUnattendedAccess = allow; + // this is called from GUI every time unattended access is toggled. + // make sure we save settings immediately each time + saveSecuritySettings(); } InvitationsRfbServer::InvitationsRfbServer() @@ -120,19 +132,11 @@ InvitationsRfbServer::InvitationsRfbServer() InvitationsRfbServer::~InvitationsRfbServer() { InvitationsRfbServer::stop(); // calling virtual funcs in destructor is bad - - KConfigGroup krfbConfig(KSharedConfig::openConfig(), "Security"); - krfbConfig.writeEntry("allowUnattendedAccess", m_allowUnattendedAccess); - + saveSecuritySettings(); + // ^^ also saves passwords in kwallet, + // do it before closing kwallet if (!KrfbConfig::noWallet() && m_wallet) { closeKWallet(); - } else { - krfbConfig.writeEntry("desktopPassword", - KStringHandler::obscure(m_desktopPassword)); - krfbConfig.writeEntry("unattendedPassword", - KStringHandler::obscure(m_unattendedPassword)); - krfbConfig.writeEntry("allowUnattendedAccess", - m_allowUnattendedAccess); } } @@ -153,13 +157,6 @@ void InvitationsRfbServer::openKWallet() void InvitationsRfbServer::closeKWallet() { if (m_wallet && m_wallet->isOpen()) { - const QString krfbFolderName = QStringLiteral("krfb"); - if ((m_wallet->currentFolder() == krfbFolderName) || - ((m_wallet->hasFolder(krfbFolderName) || m_wallet->createFolder(krfbFolderName)) && - m_wallet->setFolder(krfbFolderName)) ) { - m_wallet->writePassword(QStringLiteral("desktopSharingPassword"), m_desktopPassword); - m_wallet->writePassword(QStringLiteral("unattendedAccessPassword"), m_unattendedPassword); - } delete m_wallet; // closes the wallet m_wallet = nullptr; } @@ -170,18 +167,15 @@ void InvitationsRfbServer::walletOpened(bool opened) QString desktopPassword; QString unattendedPassword; Q_ASSERT(m_wallet); - const QString krfbFolderName = QStringLiteral("krfb"); - if( opened && - ( m_wallet->hasFolder(krfbFolderName) || m_wallet->createFolder(krfbFolderName) ) && - m_wallet->setFolder(krfbFolderName) ) { - if(m_wallet->readPassword(QStringLiteral("desktopSharingPassword"), desktopPassword)==0 && + if (opened && m_wallet->hasFolder(s_krfbFolderName) && m_wallet->setFolder(s_krfbFolderName) ) { + if (m_wallet->readPassword(QStringLiteral("desktopSharingPassword"), desktopPassword) == 0 && !desktopPassword.isEmpty()) { m_desktopPassword = desktopPassword; emit passwordChanged(m_desktopPassword); } - if(m_wallet->readPassword(QStringLiteral("unattendedAccessPassword"), unattendedPassword)==0 && + if(m_wallet->readPassword(QStringLiteral("unattendedAccessPassword"), unattendedPassword) == 0 && !unattendedPassword.isEmpty()) { m_unattendedPassword = unattendedPassword; } @@ -236,3 +230,31 @@ QString InvitationsRfbServer::readableRandomString(int length) } return str; } + +// one place to deal with all security configuration +void InvitationsRfbServer::saveSecuritySettings() +{ + KConfigGroup secConfigGroup(KSharedConfig::openConfig(), "Security"); + secConfigGroup.writeEntry("allowUnattendedAccess", m_allowUnattendedAccess); + if (KrfbConfig::noWallet()) { + // save passwords in config file only if not using kwallet integration + secConfigGroup.writeEntry("desktopPassword", KStringHandler::obscure(m_desktopPassword)); + secConfigGroup.writeEntry("unattendedPassword", KStringHandler::obscure(m_unattendedPassword)); + } else { + // using KWallet, erase possibly stored passwords from krfbrc file + secConfigGroup.deleteEntry("desktopPassword"); + secConfigGroup.deleteEntry("unattendedPassword"); + // update passwords in kwallet + if (m_wallet && m_wallet->isOpen()) { + if (!m_wallet->hasFolder(s_krfbFolderName)) { + m_wallet->createFolder(s_krfbFolderName); + } + if (m_wallet->currentFolder() != s_krfbFolderName) { + m_wallet->setFolder(s_krfbFolderName); + } + m_wallet->writePassword(QStringLiteral("desktopSharingPassword"), m_desktopPassword); + m_wallet->writePassword(QStringLiteral("unattendedAccessPassword"), m_unattendedPassword); + } + } + KrfbConfig::self()->save(); +} diff --git a/krfb/invitationsrfbserver.h b/krfb/invitationsrfbserver.h index 6b6b16d..f5641e1 100644 --- a/krfb/invitationsrfbserver.h +++ b/krfb/invitationsrfbserver.h @@ -52,6 +52,7 @@ public Q_SLOTS: void toggleUnattendedAccess(bool allow); void openKWallet(); void closeKWallet(); + void saveSecuritySettings(); protected: InvitationsRfbServer();