diff --git a/src/dbus/server/session.cpp b/src/dbus/server/session.cpp index f4f729d2..12b5bb75 100644 --- a/src/dbus/server/session.cpp +++ b/src/dbus/server/session.cpp @@ -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 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; }