D-Bus server: password not stored in GNOME keyring or KWallet (FDO #66110)
When clients like the GTK sync-ui stored a password, it was always stored as plain text in the config.ini file by the syncevo-dbus-server. The necessary code for redirecting the password storage in a keyring (GNOME or KWallet) simply wasn't called in that case. The command line tool, even when using the D-Bus server to run the operation, had the necessary code active and thus was not affected.
This commit is contained in:
parent
8bc48fd7d8
commit
0a8b3f1f48
1 changed files with 28 additions and 3 deletions
|
@ -311,13 +311,38 @@ void Session::setNamedConfig(const std::string &configName,
|
|||
for ( it = sourceFilters.begin(); it != sourceFilters.end(); it++ ) {
|
||||
from->setConfigFilter(false, it->first, it->second);
|
||||
}
|
||||
// run without dedicated user interface and thus without
|
||||
// interactive password requests here (not needed)
|
||||
|
||||
// We need no interactive user interface, but we do need to handle
|
||||
// storing passwords in a keyring here.
|
||||
boost::shared_ptr<SyncContext> syncConfig(new SyncContext(configName));
|
||||
syncConfig->prepareConfigForWrite();
|
||||
syncConfig->copy(*from, NULL);
|
||||
|
||||
syncConfig->preFlush(syncConfig->getUserInterfaceNonNull());
|
||||
class KeyringUI : public UserInterface {
|
||||
InitStateString m_keyring;
|
||||
public:
|
||||
KeyringUI(const InitStateString &keyring) :
|
||||
m_keyring(keyring)
|
||||
{}
|
||||
|
||||
// Implement UserInterface.
|
||||
virtual bool savePassword(const std::string &passwordName,
|
||||
const std::string &password,
|
||||
const ConfigPasswordKey &key)
|
||||
{
|
||||
return GetSavePasswordSignal()(m_keyring, passwordName, password, key);
|
||||
}
|
||||
virtual void readStdin(std::string &content) { SE_THROW("not implemented"); }
|
||||
virtual std::string askPassword(const std::string &passwordName,
|
||||
const std::string &descr,
|
||||
const ConfigPasswordKey &key)
|
||||
{
|
||||
SE_THROW("not implemented");
|
||||
return "";
|
||||
}
|
||||
|
||||
} ui(syncConfig->getKeyring());
|
||||
syncConfig->preFlush(ui);
|
||||
syncConfig->flush();
|
||||
m_setConfig = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue