feat(Core/DB/Authserver): remove sha_pass_hash (#4827)

This commit is contained in:
UltraNix
2021-03-21 15:17:57 +01:00
committed by GitHub
parent e9ed6380a6
commit 485f7e7639
54 changed files with 1095 additions and 744 deletions

View File

@@ -16,7 +16,7 @@
#include "Log.h"
#include "RASocket.h"
#include "ServerMotd.h"
#include "SHA1.h"
#include "SRP6.h"
#include "Util.h"
#include "World.h"
#include <thread>
@@ -212,22 +212,21 @@ int RASocket::check_password(const std::string& user, const std::string& pass)
std::string safe_pass = pass;
Utf8ToUpperOnlyLatin(safe_pass);
std::string hash = AccountMgr::CalculateShaPassHash(safe_user, safe_pass);
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_CHECK_PASSWORD_BY_NAME);
stmt->setString(0, safe_user);
stmt->setString(1, hash);
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (!result)
if (PreparedQueryResult result = LoginDatabase.Query(stmt))
{
sLog->outRemote("Wrong password for user: %s", user.c_str());
return -1;
acore::Crypto::SRP6::Salt salt = (*result)[0].GetBinary<acore::Crypto::SRP6::SALT_LENGTH>();
acore::Crypto::SRP6::Verifier verifier = (*result)[1].GetBinary<acore::Crypto::SRP6::VERIFIER_LENGTH>();
if (acore::Crypto::SRP6::CheckLogin(safe_user, safe_pass, salt, verifier))
return 0;
}
return 0;
sLog->outRemote("Wrong password for user: %s", user.c_str());
return -1;
}
int RASocket::authenticate()