feat(Core/Network): Add conf to allow/disallow storing IP address (#7168)

* feat(Core/Network): Add conf to allow/disallow storing the IP address

* cherry-pick commit (68bf7e6d12)

Co-Authored-By: Giacomo Pozzoni <giacomopoz@gmail.com>
This commit is contained in:
Kitzunu
2021-08-19 00:20:07 +02:00
committed by GitHub
parent a43d76ede4
commit 556d91a2ea
6 changed files with 42 additions and 16 deletions

View File

@@ -503,9 +503,10 @@ bool AuthSession::HandleLogonProof()
// Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account
// No SQL injection (escaped user name) and IP address as received by socket
std::string address = sConfigMgr->GetOption<bool>("AllowLoggingIPAddressesInDatabase", true, true) ? GetRemoteIpAddress().to_string() : "0.0.0.0";
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LOGONPROOF);
stmt->setBinary(0, _sessionKey);
stmt->setString(1, GetRemoteIpAddress().to_string());
stmt->setString(1, address);
stmt->setUInt32(2, GetLocaleByName(_localizationName));
stmt->setString(3, _os);
stmt->setString(4, _accountInfo.Login);