mirror of
https://github.com/KDE/krfb
synced 2026-07-01 07:31:16 -07:00
Fix assertion error when noWallet used
Krfb fails to startup if "noWallet" is in the config since `walletOpened()` is called without a wallet, triggering the `Q_ASSERT` at the beginning of the function. Fix this by adding function to read passwords from the config directly rather than reusing the `walletOpened()` slot.
This commit is contained in:
committed by
Alexey Min
parent
3ae94343e4
commit
7a0c0bd6e1
@@ -58,7 +58,7 @@ void InvitationsRfbServer::init()
|
||||
|
||||
instance->m_wallet = nullptr;
|
||||
if (KrfbConfig::noWallet()) {
|
||||
instance->walletOpened(false);
|
||||
instance->readPasswordFromConfig();
|
||||
} else {
|
||||
instance->openKWallet();
|
||||
}
|
||||
@@ -181,23 +181,8 @@ void InvitationsRfbServer::walletOpened(bool opened)
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
qCDebug(KRFB) << "Could not open KWallet, Falling back to config file";
|
||||
KConfigGroup krfbConfig(KSharedConfig::openConfig(),QStringLiteral("Security"));
|
||||
|
||||
desktopPassword = KStringHandler::obscure(krfbConfig.readEntry(
|
||||
"desktopPassword", QString()));
|
||||
if(!desktopPassword.isEmpty()) {
|
||||
m_desktopPassword = desktopPassword;
|
||||
Q_EMIT passwordChanged(m_desktopPassword);
|
||||
}
|
||||
|
||||
unattendedPassword = KStringHandler::obscure(krfbConfig.readEntry(
|
||||
"unattendedPassword", QString()));
|
||||
if(!unattendedPassword.isEmpty()) {
|
||||
m_unattendedPassword = unattendedPassword;
|
||||
}
|
||||
|
||||
readPasswordFromConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,3 +243,23 @@ void InvitationsRfbServer::saveSecuritySettings()
|
||||
}
|
||||
KrfbConfig::self()->save();
|
||||
}
|
||||
|
||||
void InvitationsRfbServer::readPasswordFromConfig()
|
||||
{
|
||||
QString desktopPassword;
|
||||
QString unattendedPassword;
|
||||
KConfigGroup krfbConfig(KSharedConfig::openConfig(),QStringLiteral("Security"));
|
||||
|
||||
desktopPassword = KStringHandler::obscure(krfbConfig.readEntry(
|
||||
"desktopPassword", QString()));
|
||||
if(!desktopPassword.isEmpty()) {
|
||||
m_desktopPassword = desktopPassword;
|
||||
Q_EMIT passwordChanged(m_desktopPassword);
|
||||
}
|
||||
|
||||
unattendedPassword = KStringHandler::obscure(krfbConfig.readEntry(
|
||||
"unattendedPassword", QString()));
|
||||
if(!unattendedPassword.isEmpty()) {
|
||||
m_unattendedPassword = unattendedPassword;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ private:
|
||||
KWallet::Wallet *m_wallet = nullptr;
|
||||
|
||||
QString readableRandomString(int);
|
||||
void readPasswordFromConfig();
|
||||
Q_DISABLE_COPY(InvitationsRfbServer)
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user