Changeset - 87c8752bc175
[Not reviewed]
0 3 0
HanzZ - 14 years ago 2011-08-24 00:18:51
hanzz.k@gmail.com
Do not create users entry in getPassword
3 files changed with 3 insertions and 4 deletions:
0 comments (0 inline, 0 general)
include/transport/userregistry.h
Show inline comments
 
@@ -99,9 +99,10 @@ class UserRegistry : public Swift::UserRegistry {
 
			std::string password;
 
			Swift::ServerFromClientSession *session;
 
		} Sess;
 

	
 
		mutable std::map<std::string, Sess> users;
 
		mutable Config *config;
 
		std::string empty;
 
};
 

	
 
}
src/usermanager.cpp
Show inline comments
 
@@ -161,16 +161,12 @@ void UserManager::handlePresence(Swift::Presence::ref presence) {
 
					registered = true;
 
				}
 
			}
 
			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");
 
			return;
 
		}
 

	
src/userregistry.cpp
Show inline comments
 
@@ -114,10 +114,12 @@ void UserRegistry::onPasswordInvalid(const Swift::JID &user) {
 
	else {
 
		LOG4CXX_INFO(logger, key << ": onPasswordInvalid called for invalid user");
 
	}
 
}
 

	
 
const std::string &UserRegistry::getUserPassword(const std::string &barejid) {
 
	if (users.find(barejid) != users.end())
 
		return users[barejid].password;
 
	return empty;
 
}
 

	
 
}
0 comments (0 inline, 0 general)