diff --git a/kde/plasma/plasma-nm/no-kwallet.patch b/kde/plasma/plasma-nm/no-kwallet.patch index c9d6d70e..d80b0f91 100644 --- a/kde/plasma/plasma-nm/no-kwallet.patch +++ b/kde/plasma/plasma-nm/no-kwallet.patch @@ -11,10 +11,25 @@ index 811f181..d55a1f0 100644 WindowSystem KCMUtils diff --git a/kded/CMakeLists.txt b/kded/CMakeLists.txt -index f7dd217..cfde59c 100644 +index f7dd217..69b739e 100644 --- a/kded/CMakeLists.txt +++ b/kded/CMakeLists.txt -@@ -42,7 +42,6 @@ target_link_libraries(kded_networkmanagement +@@ -8,14 +8,12 @@ target_sources(kded_networkmanagement PRIVATE + notification.cpp + monitor.cpp + passworddialog.cpp +- secretagent.cpp + service.cpp + bluetoothmonitor.h + connectivitymonitor.h + notification.h + monitor.h + passworddialog.h +- secretagent.h + service.h + modemmonitor.cpp + modemmonitor.h +@@ -42,7 +40,6 @@ target_link_libraries(kded_networkmanagement KF5::Notifications KF5::Service KF5::Solid @@ -23,628 +38,56 @@ index f7dd217..cfde59c 100644 KF5::KIOGui KF5::ModemManagerQt diff --git a/kded/secretagent.cpp b/kded/secretagent.cpp -index 8c6b394..8ec98bb 100644 +index 8c6b394..c41186f 100644 --- a/kded/secretagent.cpp +++ b/kded/secretagent.cpp -@@ -31,9 +31,7 @@ - #include - #include - #include --#include - #include -- - SecretAgent::SecretAgent(QObject *parent) - : NetworkManager::SecretAgent(QStringLiteral("org.kde.plasma.networkmanagement"), NetworkManager::SecretAgent::Capability::VpnHints, parent) - , m_openWalletFailed(false) -@@ -54,607 +52,74 @@ NMVariantMapMap SecretAgent::GetSecrets(const NMVariantMapMap &connection, - const QStringList &hints, - uint flags) +@@ -657,4 +657,4 @@ void SecretAgent::importSecretsFromPlainTextFiles() + group.deleteGroup(); + } + } +-} ++} +\ No newline at end of file +diff --git a/kded/secretagent.h b/kded/secretagent.h +index 0d83af2..297fe6d 100644 +--- a/kded/secretagent.h ++++ b/kded/secretagent.h +@@ -113,4 +113,4 @@ private: + void importSecretsFromPlainTextFiles(); + }; + +-#endif // PLASMA_NM_SECRET_AGENT_H ++#endif // PLASMA_NM_SECRET_AGENT_H +\ No newline at end of file +diff --git a/kded/service.cpp b/kded/service.cpp +index 5c0db26..b57d784 100644 +--- a/kded/service.cpp ++++ b/kded/service.cpp +@@ -14,7 +14,6 @@ + #include "connectivitymonitor.h" + #include "monitor.h" + #include "notification.h" +-#include "secretagent.h" + + #include + #include +@@ -27,7 +26,6 @@ K_PLUGIN_CLASS_WITH_JSON(NetworkManagementService, "networkmanagement.json") + class NetworkManagementServicePrivate { -- qCDebug(PLASMA_NM_KDED_LOG) << Q_FUNC_INFO; -- qCDebug(PLASMA_NM_KDED_LOG) << "Path:" << connection_path.path(); -- qCDebug(PLASMA_NM_KDED_LOG) << "Setting name:" << setting_name; -- qCDebug(PLASMA_NM_KDED_LOG) << "Hints:" << hints; -- qCDebug(PLASMA_NM_KDED_LOG) << "Flags:" << flags; -- -- const QString callId = connection_path.path() % setting_name; -- for (const SecretsRequest &request : std::as_const(m_calls)) { -- if (request == callId) { -- qCWarning(PLASMA_NM_KDED_LOG) << "GetSecrets was called again! This should not happen, cancelling first call" << connection_path.path() -- << setting_name; -- CancelGetSecrets(connection_path, setting_name); -- break; -- } -- } -- -- setDelayedReply(true); -- SecretsRequest request(SecretsRequest::GetSecrets); -- request.callId = callId; -- request.connection = connection; -- request.connection_path = connection_path; -- request.flags = static_cast(flags); -- request.hints = hints; -- request.setting_name = setting_name; -- request.message = message(); -- m_calls << request; -- -- processNext(); -- - return {}; + public: +- SecretAgent *agent = nullptr; + Notification *notification = nullptr; + Monitor *monitor = nullptr; + ConnectivityMonitor *connectivityMonitor = nullptr; +@@ -41,8 +39,6 @@ NetworkManagementService::NetworkManagementService(QObject *parent, const QVaria + + connect(this, &KDEDModule::moduleRegistered, this, &NetworkManagementService::init); + +- d->agent = new SecretAgent(this); +- connect(d->agent, &SecretAgent::secretsError, this, &NetworkManagementService::secretsError); } - void SecretAgent::SaveSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path) - { -- qCDebug(PLASMA_NM_KDED_LOG) << Q_FUNC_INFO; -- qCDebug(PLASMA_NM_KDED_LOG) << "Path:" << connection_path.path(); -- // qCDebug(PLASMA_NM_KDED_LOG) << "Setting:" << connection; -- -- setDelayedReply(true); -- SecretsRequest::Type type; -- if (hasSecrets(connection)) { -- type = SecretsRequest::SaveSecrets; -- } else { -- type = SecretsRequest::DeleteSecrets; -- } -- SecretsRequest request(type); -- request.connection = connection; -- request.connection_path = connection_path; -- request.message = message(); -- m_calls << request; -- -- processNext(); - } - - void SecretAgent::DeleteSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path) - { -- qCDebug(PLASMA_NM_KDED_LOG) << Q_FUNC_INFO; -- qCDebug(PLASMA_NM_KDED_LOG) << "Path:" << connection_path.path(); -- // qCDebug(PLASMA_NM_KDED_LOG) << "Setting:" << connection; -- -- setDelayedReply(true); -- SecretsRequest request(SecretsRequest::DeleteSecrets); -- request.connection = connection; -- request.connection_path = connection_path; -- request.message = message(); -- m_calls << request; -- -- processNext(); - } - - void SecretAgent::CancelGetSecrets(const QDBusObjectPath &connection_path, const QString &setting_name) - { -- qCDebug(PLASMA_NM_KDED_LOG) << Q_FUNC_INFO; -- qCDebug(PLASMA_NM_KDED_LOG) << "Path:" << connection_path.path(); -- qCDebug(PLASMA_NM_KDED_LOG) << "Setting name:" << setting_name; -- -- QString callId = connection_path.path() % setting_name; -- for (int i = 0; i < m_calls.size(); ++i) { -- SecretsRequest request = m_calls.at(i); -- if (request.type == SecretsRequest::GetSecrets && callId == request.callId) { -- if (m_dialog == request.dialog) { -- m_dialog = nullptr; -- } -- delete request.dialog; -- sendError(SecretAgent::AgentCanceled, QStringLiteral("Agent canceled the password dialog"), request.message); -- m_calls.removeAt(i); -- break; -- } -- } -- -- processNext(); - } - - void SecretAgent::dialogAccepted() - { -- for (int i = 0; i < m_calls.size(); ++i) { -- SecretsRequest request = m_calls[i]; -- if (request.type == SecretsRequest::GetSecrets && request.dialog == m_dialog) { -- NMStringMap tmpOpenconnectSecrets; -- NMVariantMapMap connection = request.dialog->secrets(); -- if (connection.contains(QStringLiteral("vpn"))) { -- if (connection.value(QStringLiteral("vpn")).contains(QStringLiteral("tmp-secrets"))) { -- QVariantMap vpnSetting = connection.value(QStringLiteral("vpn")); -- tmpOpenconnectSecrets = qdbus_cast(vpnSetting.take(QStringLiteral("tmp-secrets"))); -- connection.insert(QStringLiteral("vpn"), vpnSetting); -- } -- } -- -- sendSecrets(connection, request.message); -- NetworkManager::ConnectionSettings::Ptr connectionSettings = -- NetworkManager::ConnectionSettings::Ptr(new NetworkManager::ConnectionSettings(connection)); -- NetworkManager::ConnectionSettings::Ptr completeConnectionSettings; -- NetworkManager::Connection::Ptr con = NetworkManager::findConnectionByUuid(connectionSettings->uuid()); -- if (con) { -- completeConnectionSettings = con->settings(); -- } else { -- completeConnectionSettings = connectionSettings; -- } -- if (request.saveSecretsWithoutReply && completeConnectionSettings->connectionType() != NetworkManager::ConnectionSettings::Vpn) { -- bool requestOffline = true; -- if (completeConnectionSettings->connectionType() == NetworkManager::ConnectionSettings::Gsm) { -- NetworkManager::GsmSetting::Ptr gsmSetting = -- completeConnectionSettings->setting(NetworkManager::Setting::Gsm).staticCast(); -- if (gsmSetting) { -- if (gsmSetting->passwordFlags().testFlag(NetworkManager::Setting::NotSaved) // -- || gsmSetting->passwordFlags().testFlag(NetworkManager::Setting::NotRequired)) { -- requestOffline = false; -- } else if (gsmSetting->pinFlags().testFlag(NetworkManager::Setting::NotSaved) // -- || gsmSetting->pinFlags().testFlag(NetworkManager::Setting::NotRequired)) { -- requestOffline = false; -- } -- } -- } else if (completeConnectionSettings->connectionType() == NetworkManager::ConnectionSettings::Wireless) { -- NetworkManager::WirelessSecuritySetting::Ptr wirelessSecuritySetting = -- completeConnectionSettings->setting(NetworkManager::Setting::WirelessSecurity).staticCast(); -- if (wirelessSecuritySetting && wirelessSecuritySetting->keyMgmt() == NetworkManager::WirelessSecuritySetting::WpaEap -- || wirelessSecuritySetting->keyMgmt() == NetworkManager::WirelessSecuritySetting::WpaEapSuiteB192) { -- NetworkManager::Security8021xSetting::Ptr security8021xSetting = -- completeConnectionSettings->setting(NetworkManager::Setting::Security8021x).staticCast(); -- if (security8021xSetting) { -- if (security8021xSetting->eapMethods().contains(NetworkManager::Security8021xSetting::EapMethodFast) // -- || security8021xSetting->eapMethods().contains(NetworkManager::Security8021xSetting::EapMethodTtls) // -- || security8021xSetting->eapMethods().contains(NetworkManager::Security8021xSetting::EapMethodPeap)) { -- if (security8021xSetting->passwordFlags().testFlag(NetworkManager::Setting::NotSaved) -- || security8021xSetting->passwordFlags().testFlag(NetworkManager::Setting::NotRequired)) { -- requestOffline = false; -- } -- } -- } -- } -- } -- -- if (requestOffline) { -- SecretsRequest requestOffline(SecretsRequest::SaveSecrets); -- requestOffline.connection = connection; -- requestOffline.connection_path = request.connection_path; -- requestOffline.saveSecretsWithoutReply = true; -- m_calls << requestOffline; -- } -- } else if (request.saveSecretsWithoutReply && completeConnectionSettings->connectionType() == NetworkManager::ConnectionSettings::Vpn -- && !tmpOpenconnectSecrets.isEmpty()) { -- NetworkManager::VpnSetting::Ptr vpnSetting = -- completeConnectionSettings->setting(NetworkManager::Setting::Vpn).staticCast(); -- if (vpnSetting) { -- NMStringMap data = vpnSetting->data(); -- NMStringMap secrets = vpnSetting->secrets(); -- -- // Load secrets from auth dialog which are returned back to NM -- if (connection.value(QStringLiteral("vpn")).contains(QStringLiteral("secrets"))) { -- secrets.insert(qdbus_cast(connection.value(QStringLiteral("vpn")).value(QStringLiteral("secrets")))); -- } -- -- // Load temporary secrets from auth dialog which are not returned to NM -- for (const QString &key : tmpOpenconnectSecrets.keys()) { -- if (secrets.contains(QStringLiteral("save_passwords")) && secrets.value(QStringLiteral("save_passwords")) == QLatin1String("yes")) { -- data.insert(key + QLatin1String("-flags"), QString::number(NetworkManager::Setting::AgentOwned)); -- } else { -- data.insert(key + QLatin1String("-flags"), QString::number(NetworkManager::Setting::NotSaved)); -- } -- secrets.insert(key, tmpOpenconnectSecrets.value(key)); -- } -- -- vpnSetting->setData(data); -- vpnSetting->setSecrets(secrets); -- if (!con) { -- con = NetworkManager::findConnection(request.connection_path.path()); -- } -- -- if (con) { -- con->update(completeConnectionSettings->toMap()); -- } -- } -- } -- -- m_calls.removeAt(i); -- break; -- } -- } -- -- m_dialog->deleteLater(); -- m_dialog = nullptr; -- -- processNext(); - } - - void SecretAgent::dialogRejected() - { -- for (int i = 0; i < m_calls.size(); ++i) { -- SecretsRequest request = m_calls[i]; -- if (request.type == SecretsRequest::GetSecrets && request.dialog == m_dialog) { -- sendError(SecretAgent::UserCanceled, QStringLiteral("User canceled the password dialog"), request.message); -- m_calls.removeAt(i); -- break; -- } -- } -- -- m_dialog->deleteLater(); -- m_dialog = nullptr; -- -- processNext(); - } - - void SecretAgent::killDialogs() - { -- int i = 0; -- while (i < m_calls.size()) { -- SecretsRequest request = m_calls[i]; -- if (request.type == SecretsRequest::GetSecrets) { -- delete request.dialog; -- m_calls.removeAt(i); -- } -- -- ++i; -- } - } - - void SecretAgent::walletOpened(bool success) - { -- if (!success) { -- m_openWalletFailed = true; -- m_wallet->deleteLater(); -- m_wallet = nullptr; -- } else { -- m_openWalletFailed = false; -- } -- -- processNext(); - } - - void SecretAgent::walletClosed() - { -- if (m_wallet) { -- m_wallet->deleteLater(); -- } -- m_wallet = nullptr; - } - - void SecretAgent::processNext() - { -- int i = 0; -- while (i < m_calls.size()) { -- SecretsRequest &request = m_calls[i]; -- switch (request.type) { -- case SecretsRequest::GetSecrets: -- if (processGetSecrets(request)) { -- m_calls.removeAt(i); -- continue; -- } -- break; -- case SecretsRequest::SaveSecrets: -- if (processSaveSecrets(request)) { -- m_calls.removeAt(i); -- continue; -- } -- break; -- case SecretsRequest::DeleteSecrets: -- if (processDeleteSecrets(request)) { -- m_calls.removeAt(i); -- continue; -- } -- break; -- } -- ++i; -- } - } - - bool SecretAgent::processGetSecrets(SecretsRequest &request) const - { -- if (m_dialog) { -- return false; -- } -- -- NetworkManager::ConnectionSettings::Ptr connectionSettings = -- NetworkManager::ConnectionSettings::Ptr(new NetworkManager::ConnectionSettings(request.connection)); -- NetworkManager::Setting::Ptr setting = connectionSettings->setting(request.setting_name); -- -- const bool requestNew = request.flags & RequestNew; -- const bool userRequested = request.flags & UserRequested; -- const bool allowInteraction = request.flags & AllowInteraction; -- const bool isVpn = (setting->type() == NetworkManager::Setting::Vpn); -- const bool isWireGuard = (setting->type() == NetworkManager::Setting::WireGuard); -- -- if (isVpn) { -- NetworkManager::VpnSetting::Ptr vpnSetting = connectionSettings->setting(NetworkManager::Setting::Vpn).dynamicCast(); -- if (vpnSetting->serviceType() == QLatin1String("org.freedesktop.NetworkManager.ssh") && vpnSetting->data()["auth-type"] == QLatin1String("ssh-agent")) { -- QString authSock = qgetenv("SSH_AUTH_SOCK"); -- qCDebug(PLASMA_NM_KDED_LOG) << Q_FUNC_INFO << "Sending SSH auth socket" << authSock; -- -- if (authSock.isEmpty()) { -- sendError(SecretAgent::NoSecrets, QStringLiteral("SSH_AUTH_SOCK not present"), request.message); -- } else { -- NMStringMap secrets; -- secrets.insert(QStringLiteral("ssh-auth-sock"), authSock); -- -- QVariantMap secretData; -- secretData.insert(QStringLiteral("secrets"), QVariant::fromValue(secrets)); -- request.connection[request.setting_name] = secretData; -- sendSecrets(request.connection, request.message); -- } -- return true; -- } -- } -- -- NMStringMap secretsMap; -- if (!requestNew && useWallet()) { -- if (m_wallet->isOpen()) { -- if (m_wallet->hasFolder(QStringLiteral("Network Management")) && m_wallet->setFolder(QStringLiteral("Network Management"))) { -- QString key = QLatin1Char('{') % connectionSettings->uuid() % QLatin1Char('}') % QLatin1Char(';') % request.setting_name; -- m_wallet->readMap(key, secretsMap); -- } -- } else { -- qCDebug(PLASMA_NM_KDED_LOG) << Q_FUNC_INFO << "Waiting for the wallet to open"; -- return false; -- } -- } -- -- if (!secretsMap.isEmpty()) { -- setting->secretsFromStringMap(secretsMap); -- if (!(isVpn || isWireGuard) && setting->needSecrets(requestNew).isEmpty()) { -- // Enough secrets were retrieved from storage -- request.connection[request.setting_name] = setting->secretsToMap(); -- sendSecrets(request.connection, request.message); -- return true; -- } -- } -- -- if (!Configuration::self().showPasswordDialog()) { -- sendError(SecretAgent::NoSecrets, QStringLiteral("Cannot authenticate"), request.message); -- Q_EMIT secretsError(request.connection_path.path(), -- i18n("Authentication to %1 failed. Wrong password?", request.connection.value("connection").value("id").toString())); -- return true; -- } else if (isWireGuard && userRequested) { // Just return what we have -- NMVariantMapMap result; -- NetworkManager::WireGuardSetting::Ptr wireGuardSetting; -- wireGuardSetting = connectionSettings->setting(NetworkManager::Setting::WireGuard).dynamicCast(); -- // FIXME workaround when NM is asking for secrets which should be system-stored, if we send an empty map it -- // won't ask for additional secrets with AllowInteraction flag which would display the authentication dialog -- if (wireGuardSetting->secretsToMap().isEmpty()) { -- // Insert an empty secrets map as it was before I fixed it in NetworkManagerQt to make sure NM will ask again -- // with flags we need -- QVariantMap secretsMap; -- secretsMap.insert(QStringLiteral("secrets"), QVariant::fromValue(NMStringMap())); -- result.insert(QStringLiteral("wireguard"), secretsMap); -- } else { -- result.insert(QStringLiteral("wireguard"), wireGuardSetting->secretsToMap()); -- } -- sendSecrets(result, request.message); -- return true; -- } else if (requestNew || (allowInteraction && !setting->needSecrets(requestNew).isEmpty()) || (allowInteraction && userRequested) -- || (isVpn && allowInteraction)) { -- m_dialog = new PasswordDialog(connectionSettings, request.flags, request.setting_name, request.hints); -- connect(m_dialog, &PasswordDialog::accepted, this, &SecretAgent::dialogAccepted); -- connect(m_dialog, &PasswordDialog::rejected, this, &SecretAgent::dialogRejected); -- -- if (m_dialog->hasError()) { -- sendError(m_dialog->error(), m_dialog->errorMessage(), request.message); -- delete m_dialog; -- m_dialog = nullptr; -- return true; -- } else { -- request.dialog = m_dialog; -- request.saveSecretsWithoutReply = !connectionSettings->permissions().isEmpty(); -- m_dialog->show(); -- KWindowSystem::setState(m_dialog->winId(), NET::KeepAbove); -- KWindowSystem::forceActiveWindow(m_dialog->winId()); -- return false; -- } -- } else if (isVpn && userRequested) { // just return what we have -- NMVariantMapMap result; -- NetworkManager::VpnSetting::Ptr vpnSetting; -- vpnSetting = connectionSettings->setting(NetworkManager::Setting::Vpn).dynamicCast(); -- // FIXME workaround when NM is asking for secrets which should be system-stored, if we send an empty map it -- // won't ask for additional secrets with AllowInteraction flag which would display the authentication dialog -- if (vpnSetting->secretsToMap().isEmpty()) { -- // Insert an empty secrets map as it was before I fixed it in NetworkManagerQt to make sure NM will ask again -- // with flags we need -- QVariantMap secretsMap; -- secretsMap.insert(QStringLiteral("secrets"), QVariant::fromValue(NMStringMap())); -- result.insert(QStringLiteral("vpn"), secretsMap); -- } else { -- result.insert(QStringLiteral("vpn"), vpnSetting->secretsToMap()); -- } -- sendSecrets(result, request.message); -- return true; -- } else if (setting->needSecrets().isEmpty()) { -- NMVariantMapMap result; -- result.insert(setting->name(), setting->secretsToMap()); -- sendSecrets(result, request.message); -- return true; -- } else { -- sendError(SecretAgent::InternalError, QStringLiteral("Plasma-nm did not know how to handle the request"), request.message); -- return true; -- } -+ return true; - } - - bool SecretAgent::processSaveSecrets(SecretsRequest &request) const - { -- if (useWallet()) { -- if (m_wallet->isOpen()) { -- NetworkManager::ConnectionSettings connectionSettings(request.connection); -- -- if (!m_wallet->hasFolder(QStringLiteral("Network Management"))) { -- m_wallet->createFolder(QStringLiteral("Network Management")); -- } -- -- if (m_wallet->setFolder(QStringLiteral("Network Management"))) { -- for (const NetworkManager::Setting::Ptr &setting : connectionSettings.settings()) { -- NMStringMap secretsMap = setting->secretsToStringMap(); -- -- if (!secretsMap.isEmpty()) { -- QString entryName = QLatin1Char('{') % connectionSettings.uuid() % QLatin1Char('}') % QLatin1Char(';') % setting->name(); -- m_wallet->writeMap(entryName, secretsMap); -- } -- } -- } else if (!request.saveSecretsWithoutReply) { -- sendError(SecretAgent::InternalError, QStringLiteral("Could not store secrets in the wallet."), request.message); -- return true; -- } -- } else { -- qCDebug(PLASMA_NM_KDED_LOG) << Q_FUNC_INFO << "Waiting for the wallet to open"; -- return false; -- } -- } -- -- if (!request.saveSecretsWithoutReply) { -- QDBusMessage reply = request.message.createReply(); -- if (!QDBusConnection::systemBus().send(reply)) { -- qCWarning(PLASMA_NM_KDED_LOG) << "Failed put save secrets reply into the queue"; -- } -- } -- - return true; - } - - bool SecretAgent::processDeleteSecrets(SecretsRequest &request) const - { -- if (useWallet()) { -- if (m_wallet->isOpen()) { -- if (m_wallet->hasFolder(QStringLiteral("Network Management")) && m_wallet->setFolder(QStringLiteral("Network Management"))) { -- NetworkManager::ConnectionSettings connectionSettings(request.connection); -- for (const NetworkManager::Setting::Ptr &setting : connectionSettings.settings()) { -- QString entryName = QLatin1Char('{') % connectionSettings.uuid() % QLatin1Char('}') % QLatin1Char(';') % setting->name(); -- for (const QString &entry : m_wallet->entryList()) { -- if (entry.startsWith(entryName)) { -- m_wallet->removeEntry(entryName); -- } -- } -- } -- } -- } else { -- qCDebug(PLASMA_NM_KDED_LOG) << Q_FUNC_INFO << "Waiting for the wallet to open"; -- return false; -- } -- } -- -- QDBusMessage reply = request.message.createReply(); -- if (!QDBusConnection::systemBus().send(reply)) { -- qCWarning(PLASMA_NM_KDED_LOG) << "Failed put delete secrets reply into the queue"; -- } -- - return true; - } - - bool SecretAgent::useWallet() const - { -- if (m_wallet) { -- return true; -- } -- -- /* If opening of KWallet failed before, we should not try to open it again and -- * we should return false instead */ -- if (m_openWalletFailed) { -- m_openWalletFailed = false; -- return false; -- } -- -- if (KWallet::Wallet::isEnabled()) { -- m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::LocalWallet(), 0, KWallet::Wallet::Asynchronous); -- if (m_wallet) { -- connect(m_wallet, &KWallet::Wallet::walletOpened, this, &SecretAgent::walletOpened); -- connect(m_wallet, &KWallet::Wallet::walletClosed, this, &SecretAgent::walletClosed); -- return true; -- } else { -- qCWarning(PLASMA_NM_KDED_LOG) << "Error opening kwallet."; -- } -- } else if (m_wallet) { -- m_wallet->deleteLater(); -- m_wallet = nullptr; -- } -- - return false; - } - - bool SecretAgent::hasSecrets(const NMVariantMapMap &connection) const - { -- NetworkManager::ConnectionSettings connectionSettings(connection); -- for (const NetworkManager::Setting::Ptr &setting : connectionSettings.settings()) { -- if (!setting->secretsToMap().isEmpty()) { -- return true; -- } -- } -- - return false; - } - - void SecretAgent::sendSecrets(const NMVariantMapMap &secrets, const QDBusMessage &message) const - { -- QDBusMessage reply; -- reply = message.createReply(QVariant::fromValue(secrets)); -- if (!QDBusConnection::systemBus().send(reply)) { -- qCWarning(PLASMA_NM_KDED_LOG) << "Failed put the secret into the queue"; -- } - } - - void SecretAgent::importSecretsFromPlainTextFiles() - { -- KConfig config(QStringLiteral("plasma-networkmanagement"), KConfig::SimpleConfig); -- -- // No action is required when the list of secrets is empty -- if (!config.groupList().isEmpty()) { -- for (const QString &groupName : config.groupList()) { -- QString loadedUuid = groupName.split(QLatin1Char(';')).first().remove('{').remove('}'); -- QString loadedSettingType = groupName.split(QLatin1Char(';')).last(); -- NetworkManager::Connection::Ptr connection = NetworkManager::findConnectionByUuid(loadedUuid); -- if (connection) { -- NetworkManager::Setting::SecretFlags secretFlags = -- KWallet::Wallet::isEnabled() ? NetworkManager::Setting::AgentOwned : NetworkManager::Setting::None; -- QMap secrets = config.entryMap(groupName); -- NMVariantMapMap settings = connection->settings()->toMap(); -- -- for (const QString &setting : settings.keys()) { -- if (setting == QLatin1String("vpn")) { -- NetworkManager::VpnSetting::Ptr vpnSetting = -- connection->settings()->setting(NetworkManager::Setting::Vpn).staticCast(); -- if (vpnSetting) { -- // Add loaded secrets from the config file -- vpnSetting->secretsFromStringMap(secrets); -- -- NMStringMap vpnData = vpnSetting->data(); -- // Reset flags, we can't save secrets to our secret agent when KWallet is not enabled, because -- // we dropped support for plaintext files, therefore they need to be stored to NetworkManager -- for (const QString &key : vpnData.keys()) { -- if (key.endsWith(QLatin1String("-flags"))) { -- vpnData.insert(key, QString::number((int)secretFlags)); -- } -- } -- -- vpnSetting->setData(vpnData); -- settings.insert(setting, vpnSetting->toMap()); -- connection->update(settings); -- } -- } else { -- if (setting == loadedSettingType) { -- QVariantMap tmpSetting = settings.value(setting); -- // Reset flags, we can't save secrets to our secret agent when KWallet is not enabled, because -- // we dropped support for plaintext files, therefore they need to be stored to NetworkManager -- for (const QString &key : tmpSetting.keys()) { -- if (key.endsWith(QLatin1String("-flags"))) { -- tmpSetting.insert(key, (int)secretFlags); -- } -- } -- -- // Add loaded secrets from the config file -- QMap::const_iterator it = secrets.constBegin(); -- QMap::const_iterator end = secrets.constEnd(); -- for (; it != end; ++it) { -- tmpSetting.insert(it.key(), it.value()); -- } -- -- // Replace the old setting with the new one -- settings.insert(setting, tmpSetting); -- // Update the connection which re-saves secrets -- connection->update(settings); -- } -- } -- } -- } -- -- // Remove the group -- KConfigGroup group(&config, groupName); -- group.deleteGroup(); -- } -- } - } + NetworkManagementService::~NetworkManagementService() diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index 59d8ced..166a314 100644 --- a/libs/CMakeLists.txt @@ -670,7 +113,7 @@ index 1e2c3d6..9d71ad8 100644 Qt::Network qca-qt${QT_MAJOR_VERSION} diff --git a/libs/editor/uiutils.cpp b/libs/editor/uiutils.cpp -index 95d5dec..53875ac 100644 +index 95d5dec..ba99295 100644 --- a/libs/editor/uiutils.cpp +++ b/libs/editor/uiutils.cpp @@ -16,7 +16,6 @@ @@ -686,7 +129,7 @@ index 95d5dec..53875ac 100644 } - if (Configuration::self().systemConnectionsByDefault() || !KWallet::Wallet::isEnabled() || isLiveImage()) { -+ if (Configuration::self().systemConnectionsByDefault() || isLiveImage()) { ++ if (true || Configuration::self().systemConnectionsByDefault() || isLiveImage()) { auto modifySystem = NetworkManager::permissions().value(QStringLiteral("org.freedesktop.NetworkManager.settings.modify.system")); if (modifySystem == QLatin1String("yes")) { wifiSecurity->setLeapPasswordFlags(NetworkManager::Setting::SecretFlagType::None);