Proper password encrypting
This commit is contained in:
parent
f6b01c4f4d
commit
5482733ed4
2 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Add table
Reference in a new issue