1
0
kwalletmanager/0001-Don-t-require-password-when-changing-settings.patch

163 lines
5.6 KiB
Diff

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 | 28 ---------------------------
src/konfigurator/konfigurator.h | 1 -
5 files changed, 23 insertions(+), 50 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 13beb4d..1cd4988 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,10 +35,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 6591fec..7a7bfc2 100644
--- a/src/konfigurator/konfigurator.cpp
+++ b/src/konfigurator/konfigurator.cpp
@@ -7,9 +7,6 @@
#include "konfigurator.h"
#include "../kwalletmanager_version.h"
-#include <KAuth/Action>
-#include <KAuth/ActionReply>
-#include <KAuth/ExecuteJob>
#include <KConfigGroup>
#include <KMessageBox>
#include <KPluginFactory>
@@ -38,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);
@@ -233,30 +229,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 fa508c1..987434e 100644
--- a/src/konfigurator/konfigurator.h
+++ b/src/konfigurator/konfigurator.h
@@ -7,7 +7,6 @@
#ifndef _KWALLETKONFIGURATOR_H
#define _KWALLETKONFIGURATOR_H
#include "ui_walletconfigwidget.h"
-#include <KAuth/Action>
#include <KCModule>
#include <KSharedConfig>
--
2.46.0