Changeset - 5482733ed425
[Not reviewed]
0 2 0
HanzZ - 14 years ago 2011-11-02 20:02:00
hanzz.k@gmail.com
Proper password encrypting
2 files changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
backends/libpurple/main.cpp
Show inline comments
 
@@ -589,11 +589,13 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
 
			getProtocolAndName(legacyName, name, protocol);
 

	
 
			if (password.empty()) {
 
				LOG4CXX_INFO(logger,  name.c_str() << ": Empty password");
 
				np->handleDisconnected(user, 0, "Empty password.");
 
				return;
 
			}
 

	
 
			if (!purple_find_prpl(protocol.c_str())) {
 
				LOG4CXX_INFO(logger,  name.c_str() << ": Invalid protocol '" << protocol << "'");
 
				np->handleDisconnected(user, 0, "Invalid protocol " + protocol);
 
				return;
 
			}
 
@@ -1836,6 +1838,7 @@ static int create_socket(char *host, int portno) {
 
}
 

	
 
static void transportDataReceived(gpointer data, gint source, PurpleInputCondition cond) {
 
	std::cout << "RECV\n";
 
	if (cond & PURPLE_INPUT_READ) {
 
		char buffer[65535];
 
		char *ptr = buffer;
src/mysqlbackend.cpp
Show inline comments
 
@@ -412,7 +412,7 @@ bool MySQLBackend::exec(const std::string &query) {
 
void MySQLBackend::setUser(const UserInfo &user) {
 
	std::string encrypted = user.password;
 
	if (!CONFIG_STRING(m_config, "database.encryption_key").empty()) {
 
		encrypted = Util::decryptPassword(encrypted, CONFIG_STRING(m_config, "database.encryption_key"));
 
		encrypted = Util::encryptPassword(encrypted, CONFIG_STRING(m_config, "database.encryption_key"));
 
	}
 
	*m_setUser << user.jid << user.uin << encrypted << user.language << user.encoding << user.vip << user.password;
 
	EXEC(m_setUser, setUser(user));
0 comments (0 inline, 0 general)