SyncConfig: remove obsolete caching of passwords

Passwords are cached after the initial check as temporary property
values. The explicit string members are obsolete and can be removed
together with the code using them.
This commit is contained in:
Patrick Ohly 2013-07-25 17:23:34 +02:00
parent d0f2c61b95
commit 7fa64a040c
2 changed files with 6 additions and 29 deletions

View file

@ -1736,7 +1736,7 @@ ConfigPropertyRegistry &SyncConfig::getRegistry()
InitStateString SyncConfig::getSyncUsername() const { return syncPropUsername.getProperty(*getNode(syncPropUsername)); }
void SyncConfig::setSyncUsername(const string &value, bool temporarily) { syncPropUsername.setProperty(*getNode(syncPropUsername), value, temporarily); }
InitStateString SyncConfig::getSyncPassword() const {
return syncPropPassword.getCachedProperty(*getNode(syncPropPassword), m_cachedPassword);
return syncPropPassword.getProperty(*getNode(syncPropPassword));
}
void PasswordConfigProperty::checkPassword(UserInterface &ui,
const string &serverName,
@ -1814,19 +1814,6 @@ void PasswordConfigProperty::savePassword(UserInterface &ui,
}
}
InitStateString PasswordConfigProperty::getCachedProperty(const ConfigNode &node,
const string &cachedPassword)
{
InitStateString password;
if (!cachedPassword.empty()) {
password = InitStateString(cachedPassword, true);
} else {
password = getProperty(node);
}
return password;
}
/**
* remove some unnecessary parts of server URL.
* internal use.
@ -1877,8 +1864,7 @@ ConfigPasswordKey ProxyPasswordConfigProperty::getPasswordKey(const string &desc
key.user = syncPropProxyUsername.getProperty(globalConfigNode);
return key;
}
void SyncConfig::setSyncPassword(const string &value, bool temporarily) { m_cachedPassword = ""; syncPropPassword.setProperty(*getNode(syncPropPassword), value, temporarily); }
void SyncConfig::setSyncPassword(const string &value, bool temporarily) { syncPropPassword.setProperty(*getNode(syncPropPassword), value, temporarily); }
InitState<bool> SyncConfig::getPreventSlowSync() const {
return syncPropPreventSlowSync.getPropertyValue(*getNode(syncPropPreventSlowSync));
@ -1920,9 +1906,9 @@ InitStateString SyncConfig::getProxyUsername() const { return syncPropProxyUsern
void SyncConfig::setProxyUsername(const string &value, bool temporarily) { syncPropProxyUsername.setProperty(*getNode(syncPropProxyUsername), value, temporarily); }
InitStateString SyncConfig::getProxyPassword() const {
return syncPropProxyPassword.getCachedProperty(*getNode(syncPropProxyPassword), m_cachedProxyPassword);
return syncPropProxyPassword.getProperty(*getNode(syncPropProxyPassword));
}
void SyncConfig::setProxyPassword(const string &value, bool temporarily) { m_cachedProxyPassword = ""; syncPropProxyPassword.setProperty(*getNode(syncPropProxyPassword), value, temporarily); }
void SyncConfig::setProxyPassword(const string &value, bool temporarily) { syncPropProxyPassword.setProperty(*getNode(syncPropProxyPassword), value, temporarily); }
InitState< vector<string> > SyncConfig::getSyncURL() const {
InitStateString s = syncPropSyncURL.getProperty(*getNode(syncPropSyncURL));
vector<string> urls;
@ -2635,7 +2621,7 @@ void SyncSourceConfig::setDatabaseID(const string &value, bool temporarily) { so
InitStateString SyncSourceConfig::getUser() const { return sourcePropUser.getProperty(*getNode(sourcePropUser)); }
void SyncSourceConfig::setUser(const string &value, bool temporarily) { sourcePropUser.setProperty(*getNode(sourcePropUser), value, temporarily); }
InitStateString SyncSourceConfig::getPassword() const {
return sourcePropPassword.getCachedProperty(*getNode(sourcePropPassword), m_cachedPassword);
return sourcePropPassword.getProperty(*getNode(sourcePropPassword));
}
void SyncSourceConfig::checkPassword(UserInterface &ui,
const string &serverName,
@ -2647,7 +2633,7 @@ void SyncSourceConfig::savePassword(UserInterface &ui,
FilterConfigNode& globalConfigNode) {
sourcePropPassword.savePassword(ui, serverName, globalConfigNode, m_name, getNode(sourcePropPassword));
}
void SyncSourceConfig::setPassword(const string &value, bool temporarily) { m_cachedPassword = ""; sourcePropPassword.setProperty(*getNode(sourcePropPassword), value, temporarily); }
void SyncSourceConfig::setPassword(const string &value, bool temporarily) { sourcePropPassword.setProperty(*getNode(sourcePropPassword), value, temporarily); }
InitStateString SyncSourceConfig::getURI() const { return sourcePropURI.getProperty(*getNode(sourcePropURI)); }
InitStateString SyncSourceConfig::getURINonEmpty() const {
InitStateString uri = sourcePropURI.getProperty(*getNode(sourcePropURI));

View file

@ -714,12 +714,6 @@ class PasswordConfigProperty : public ConfigProperty {
const std::string &sourceName = std::string(),
const boost::shared_ptr<FilterConfigNode> &sourceConfigNode =
boost::shared_ptr<FilterConfigNode>()) const;
/**
* return the cached value if necessary and possible
*/
virtual InitStateString getCachedProperty(const ConfigNode &node,
const std::string &cachedPassword);
};
/**
@ -1644,8 +1638,6 @@ private:
Layout m_layout;
std::string m_redirectPeerRootPath;
std::string m_cachedPassword;
std::string m_cachedProxyPassword;
ConfigWriteMode m_configWriteMode;
Bool m_ephemeral;
@ -1959,7 +1951,6 @@ class SyncSourceConfig {
std::string m_name;
SyncSourceNodes m_nodes;
std::string m_cachedPassword;
};
class SingleFileConfigTree;