[frameworks/kwallet] src/runtime/kwalletd: Fix localWallet with external backend
Marco Martin <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 1058fc093187564cee124d4444248044676fbb4d by Marco Martin, on behalf of Nicolas Fella.
Committed on 27/07/2026 at 10:14.
Pushed by nicolasfella into branch 'master'.
Fix localWallet with external backend
ksecretd (optionally) differentiates between local and network wallet,
but with the FDO bridge no such distinction can be made.
Currently we always read kwalletrc for the local wallet name, which
will give wrong results for external backends.
Check if ksecretd is used, and if so use the same code as it does to
get the local wallet.
If it's not used, ask the active backend for the default collection.
M +15 -2 src/runtime/kwalletd/kwalletd.cpp
https://invent.kde.org/frameworks/kwallet/-/commit/1058fc093187564cee124d4444248044676fbb4d
diff --git a/src/runtime/kwalletd/kwalletd.cpp b/src/runtime/kwalletd/kwalletd.cpp
index 7e800bee..f4b11156 100644
--- a/src/runtime/kwalletd/kwalletd.cpp
+++ b/src/runtime/kwalletd/kwalletd.cpp
@@ -1113,8 +1113,21 @@ QString KWalletD::networkWallet()
QString KWalletD::localWallet()
{
KConfig cfg(QStringLiteral("kwalletrc"));
- KConfigGroup walletGroup(&cfg, QStringLiteral("Wallet"));
- return walletGroup.readEntry(QStringLiteral("Local Wallet"), networkWallet());
+ KConfigGroup ksecretdGroup(&cfg, QStringLiteral("KSecretD"));
+ const bool ksecretdEnabled = ksecretdGroup.readEntry("Enabled", true);
+
+ if (ksecretdEnabled) {
+ return KWallet::Wallet::LocalWallet(); // keep in sync with KSecretD::localWallet()
+ } else {
+ bool ok;
+ const QString defaultWallet = m_backend->defaultCollection(&ok);
+
+ if (!ok) {
+ sendErrorReply(QDBusError::Failed, QStringLiteral("Failed to query default collection"));
+ return {};
+ }
+ return defaultWallet;
+ }
}
#include "moc_kwalletd.cpp"