File 0001-Don-t-require-password-when-changing-settings.patch of Package kwalletmanager

From cadbae12c08d7031c83a7af04bed4b8f8a517382 Mon Sep 17 00:00:00 2001
From: Christophe Marin <christophe@krop.fr>
Date: Thu, 15 Feb 2024 19:16:54 +0100
Subject: [PATCH] Don't require password when changing settings

See https://bugzilla.suse.com/show_bug.cgi?id=1217190
The kauth helper is useless and doesn't improve security.

---
 CMakeLists.txt                    |  8 ++++----
 src/CMakeLists.txt                |  4 ++--
 src/konfigurator/CMakeLists.txt   | 32 ++++++++++++++++---------------
 src/konfigurator/konfigurator.cpp | 29 ----------------------------
 src/konfigurator/konfigurator.h   |  1 -
 5 files changed, 23 insertions(+), 51 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2f11288..9530f2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,10 +32,10 @@ ecm_setup_version(${RELEASE_SERVICE_VERSION} VARIABLE_PREFIX KWALLETMANAGER
                   VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/src/kwalletmanager_version.h"
 )
 
-option(ENABLE_KAUTH "Enable KAuth support (Disabled for Flatpak builds)" ON)
-if (ENABLE_KAUTH)
-    find_package(KF6 ${KF_MIN_VERSION} REQUIRED Auth)
-endif()
+# option(ENABLE_KAUTH "Enable KAuth support (Disabled for Flatpak builds)" ON)
+# if (ENABLE_KAUTH)
+#     find_package(KF6 ${KF_MIN_VERSION} REQUIRED Auth)
+# endif()
 
 find_package(KF6 ${KF_MIN_VERSION} REQUIRED
     Archive
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 69ff480..4281c9a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-if (ENABLE_KAUTH)
+# if (ENABLE_KAUTH)
     add_subdirectory(konfigurator)
-endif()
+# endif()
 add_subdirectory(manager)
diff --git a/src/konfigurator/CMakeLists.txt b/src/konfigurator/CMakeLists.txt
index cba7512..778ebcd 100644
--- a/src/konfigurator/CMakeLists.txt
+++ b/src/konfigurator/CMakeLists.txt
@@ -10,7 +10,6 @@ ki18n_wrap_ui(kcm_kwallet5 walletconfigwidget.ui )
 
 target_link_libraries(kcm_kwallet5
     Qt6::Core
-    KF6::AuthCore
     KF6::CoreAddons
     KF6::KCMUtils
     KF6::Wallet
@@ -20,19 +19,22 @@ target_link_libraries(kcm_kwallet5
 
 install(TARGETS kcm_kwallet5  DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/kcms/systemsettings_qwidgets)
 
-########### kauth helper ################
-add_executable(kcm_kwallet_helper5)
-target_sources(kcm_kwallet_helper5 PRIVATE savehelper.cpp savehelper.h)
-
-target_link_libraries(kcm_kwallet_helper5
-    Qt6::Core
-    KF6::AuthCore
-    KF6::Wallet
-    KF6::CoreAddons
-)
+# The helper is not improving security and was disabled.
+# See https://bugzilla.suse.com/show_bug.cgi?id=1217190
 
-install(TARGETS kcm_kwallet_helper5 DESTINATION ${KAUTH_HELPER_INSTALL_DIR})
-
-kauth_install_helper_files(kcm_kwallet_helper5 org.kde.kcontrol.kcmkwallet5 root)
-kauth_install_actions(org.kde.kcontrol.kcmkwallet5 kwallet.actions)
+########### kauth helper ################
+# add_executable(kcm_kwallet_helper5)
+# target_sources(kcm_kwallet_helper5 PRIVATE savehelper.cpp savehelper.h)
+#
+# target_link_libraries(kcm_kwallet_helper5
+#     Qt6::Core
+#     KF6::AuthCore
+#     KF6::Wallet
+#     KF6::CoreAddons
+# )
+
+# install(TARGETS kcm_kwallet_helper5 DESTINATION ${KAUTH_HELPER_INSTALL_DIR})
+
+# kauth_install_helper_files(kcm_kwallet_helper5 org.kde.kcontrol.kcmkwallet5 root)
+# kauth_install_actions(org.kde.kcontrol.kcmkwallet5 kwallet.actions)
 
diff --git a/src/konfigurator/konfigurator.cpp b/src/konfigurator/konfigurator.cpp
index cc5e4a5..dfe70bc 100644
--- a/src/konfigurator/konfigurator.cpp
+++ b/src/konfigurator/konfigurator.cpp
@@ -7,15 +7,11 @@
 #include "../kwalletmanager_version.h"
 #include "konfigurator.h"
 
-#include <KAuth/Action>
-#include <KAuth/ActionReply>
-#include <KAuth/ExecuteJob>
 #include <KConfigGroup>
 #include <KMessageBox>
 #include <KPluginFactory>
 #include <KWallet>
 #include <QInputDialog>
-#include <kauth_version.h>
 
 #include <KAboutData>
 
@@ -39,7 +35,6 @@ KWalletConfig::KWalletConfig(QObject *parent, const KPluginMetaData &data)
       , _wcw(new WalletConfigWidget(widget()))
       , _cfg(KSharedConfig::openConfig(QStringLiteral("kwalletrc"), KConfig::NoGlobals))
 {
-  setAuthActionName(QStringLiteral("org.kde.kcontrol.kcmkwallet5.save"));
     auto vbox = new QVBoxLayout(widget());
     vbox->setContentsMargins(0, 0, 0, 0);
     vbox->addWidget(_wcw);
@@ -238,30 +233,6 @@ void KWalletConfig::load()
 
 void KWalletConfig::save()
 {
-    QVariantMap args;
-    KAuth::Action action(QLatin1String("org.kde.kcontrol.kcmkwallet5.save"));
-    action.setHelperId(QStringLiteral("org.kde.kcontrol.kcmkwallet5"));
-
-    widget()->window()->winId();
-    action.setParentWindow(widget()->window()->windowHandle());
-    if (!action.isValid()) {
-        qDebug() << "There's no authAction, not saving settings";
-        return;
-    }
-    action.setArguments(args);
-
-    KAuth::ExecuteJob *j = action.execute();
-
-    if (!j->exec()) {
-        if (j->error() == KAuth::ActionReply::AuthorizationDeniedError) {
-            KMessageBox::error(widget(), i18n("Permission denied."), i18n("KDE Wallet Control Module"));
-        } else {
-            KMessageBox::error(widget(), i18n("Error while authenticating action:\n%1", j->errorString()), i18n("KDE Wallet Control Module"));
-        }
-        load();
-        return;
-    }
-
     KConfigGroup config(_cfg, QStringLiteral("Wallet"));
     config.writeEntry("Enabled", _wcw->_enabled->isChecked());
     config.writeEntry("Launch Manager", _wcw->_launchManager->isChecked());
diff --git a/src/konfigurator/konfigurator.h b/src/konfigurator/konfigurator.h
index 8075727..5ed884f 100644
--- a/src/konfigurator/konfigurator.h
+++ b/src/konfigurator/konfigurator.h
@@ -9,7 +9,6 @@
 #include <KCModule>
 #include <KSharedConfig>
 #include "ui_walletconfigwidget.h"
-#include <KAuth/Action>
 
 class WalletConfigWidget : public QWidget, public Ui::WalletConfigWidget
 {
-- 
2.43.0

openSUSE Build Service is sponsored by