aboutsummaryrefslogtreecommitdiff
path: root/src/server/authserver/Server/AuthSocket.cpp
diff options
context:
space:
mode:
authorleak <leakzx@googlemail.com>2011-12-31 20:14:38 +0100
committerleak <leakzx@googlemail.com>2011-12-31 20:14:38 +0100
commit73cf793e56b0750f717f31d91f54fdf94ff88682 (patch)
tree2df88688ff0c8149d2fd6343c782346f89bab52e /src/server/authserver/Server/AuthSocket.cpp
parentff8874574f61cf92d6a05fb3c834406651ba0aab (diff)
Core/DBLayer: Refactor prepared statement defines Note:
The new format for the middle section is a 3-letter upper case abbreviation of the sql command being executed (select -> SEL, update -> UPD, etc.) {DB}_{SEL/INS/UPD/DEL/REP}_{Summary of data changed}
Diffstat (limited to 'src/server/authserver/Server/AuthSocket.cpp')
-rwxr-xr-xsrc/server/authserver/Server/AuthSocket.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp
index c24012efcef..1ad951a5ffe 100755
--- a/src/server/authserver/Server/AuthSocket.cpp
+++ b/src/server/authserver/Server/AuthSocket.cpp
@@ -283,7 +283,7 @@ void AuthSocket::_SetVSFields(const std::string& rI)
v_hex = v.AsHexStr();
s_hex = s.AsHexStr();
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SET_VS);
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_VS);
stmt->setString(0, v_hex);
stmt->setString(1, s_hex);
stmt->setString(2, _login);
@@ -348,10 +348,10 @@ bool AuthSocket::_HandleLogonChallenge()
pkt << (uint8)0x00;
// Verify that this IP is not in the ip_banned table
- LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_SET_EXPIREDIPBANS));
+ LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS));
const std::string& ip_address = socket().get_remote_address();
- PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_IPBANNED);
+ PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED);
stmt->setString(0, ip_address);
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (result)
@@ -363,7 +363,7 @@ bool AuthSocket::_HandleLogonChallenge()
{
// Get the account details from the account table
// No SQL injection (prepared statement)
- stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_LOGONCHALLENGE);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGONCHALLENGE);
stmt->setString(0, _login);
PreparedQueryResult res2 = LoginDatabase.Query(stmt);
@@ -393,10 +393,10 @@ bool AuthSocket::_HandleLogonChallenge()
if (!locked)
{
//set expired bans to inactive
- LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_SET_EXPIREDACCBANS));
+ LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPIRED_ACCOUNT_BANS));
// If the account is banned, reject the logon attempt
- stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCBANNED);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED);
stmt->setUInt32(0, fields[1].GetUInt32());
PreparedQueryResult banresult = LoginDatabase.Query(stmt);
if (banresult)
@@ -596,7 +596,7 @@ bool AuthSocket::_HandleLogonProof()
// No SQL injection (escaped user name) and IP address as received by socket
const char *K_hex = K.AsHexStr();
- PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SET_LOGONPROOF);
+ PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LOGONPROOF);
stmt->setString(0, K_hex);
stmt->setString(1, socket().get_remote_address().c_str());
stmt->setUInt32(2, GetLocaleByName(_localizationName));
@@ -644,11 +644,11 @@ bool AuthSocket::_HandleLogonProof()
if (MaxWrongPassCount > 0)
{
//Increment number of failed logins by one and if it reaches the limit temporarily ban that account or IP
- PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SET_FAILEDLOGINS);
+ PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_FAILEDLOGINS);
stmt->setString(0, _login);
LoginDatabase.Execute(stmt);
- stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_FAILEDLOGINS);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_FAILEDLOGINS);
stmt->setString(0, _login);
if (PreparedQueryResult loginfail = LoginDatabase.Query(stmt))
@@ -663,7 +663,7 @@ bool AuthSocket::_HandleLogonProof()
if (WrongPassBanType)
{
uint32 acc_id = (*loginfail)[0].GetUInt32();
- stmt = LoginDatabase.GetPreparedStatement(LOGIN_SET_ACCAUTOBANNED);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_AUTO_BANNED);
stmt->setUInt32(0, acc_id);
stmt->setUInt32(1, WrongPassBanTime);
LoginDatabase.Execute(stmt);
@@ -673,7 +673,7 @@ bool AuthSocket::_HandleLogonProof()
}
else
{
- stmt = LoginDatabase.GetPreparedStatement(LOGIN_SET_IPAUTOBANNED);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_IP_AUTO_BANNED);
stmt->setString(0, socket().get_remote_address());
stmt->setUInt32(1, WrongPassBanTime);
LoginDatabase.Execute(stmt);
@@ -723,7 +723,7 @@ bool AuthSocket::_HandleReconnectChallenge()
_login = (const char*)ch->I;
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_SESSIONKEY);
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_SESSIONKEY);
stmt->setString(0, _login);
PreparedQueryResult result = LoginDatabase.Query(stmt);
@@ -807,7 +807,7 @@ bool AuthSocket::_HandleRealmList()
// Get the user id (else close the connection)
// No SQL injection (prepared statement)
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCIDBYNAME);
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME);
stmt->setString(0, _login);
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (!result)
@@ -838,7 +838,7 @@ bool AuthSocket::_HandleRealmList()
uint8 AmountOfCharacters;
// No SQL injection. id of realm is controlled by the database.
- stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_NUMCHARSONREALM);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_NUM_CHARS_ON_REALM);
stmt->setUInt32(0, i->second.m_ID);
stmt->setUInt32(1, id);
result = LoginDatabase.Query(stmt);