From 87c8752bc1755371dcc670bda50993327a7551cd Mon Sep 17 00:00:00 2001 From: HanzZ Date: Wed, 24 Aug 2011 00:18:51 +0200 Subject: [PATCH] Do not create users entry in getPassword --- include/transport/userregistry.h | 1 + src/usermanager.cpp | 4 ---- src/userregistry.cpp | 4 +++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/transport/userregistry.h b/include/transport/userregistry.h index 63d14a1e..5b922985 100644 --- a/include/transport/userregistry.h +++ b/include/transport/userregistry.h @@ -102,6 +102,7 @@ class UserRegistry : public Swift::UserRegistry { mutable std::map users; mutable Config *config; + std::string empty; }; } diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 67257792..b47b962b 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -164,10 +164,6 @@ void UserManager::handlePresence(Swift::Presence::ref presence) { res.password = m_userRegistry->getUserPassword(userkey); } - if (res.password.empty()) { - m_userRegistry->onPasswordInvalid(presence->getFrom()); - } - // Unregistered users are not able to login if (!registered) { LOG4CXX_WARN(logger, "Unregistered user " << userkey << " tried to login"); diff --git a/src/userregistry.cpp b/src/userregistry.cpp index bfdb8faf..c6287faf 100644 --- a/src/userregistry.cpp +++ b/src/userregistry.cpp @@ -117,7 +117,9 @@ void UserRegistry::onPasswordInvalid(const Swift::JID &user) { } const std::string &UserRegistry::getUserPassword(const std::string &barejid) { - return users[barejid].password; + if (users.find(barejid) != users.end()) + return users[barejid].password; + return empty; } }