diff options
author | Nefertumm <nefertumtg@gmail.com> | 2017-06-30 16:56:29 -0300 |
---|---|---|
committer | Nefertumm <nefertumtg@gmail.com> | 2017-06-30 16:56:29 -0300 |
commit | c599c7e42e8781deaab38ae913cc5e86c1d18446 (patch) | |
tree | f78ed78f0a29b7a0154999b27599dbc99cc4dbbc | |
parent | 5015e401f7f0d3ca42aa78aa310195156e388349 (diff) |
Tabs
6 files changed, 31 insertions, 31 deletions
diff --git a/data/sql/updates/pending_db_auth/rev_1498796201292521600.sql b/data/sql/updates/pending_db_auth/rev_1498796201292521600.sql index 30603d366f..7fd9186b16 100644 --- a/data/sql/updates/pending_db_auth/rev_1498796201292521600.sql +++ b/data/sql/updates/pending_db_auth/rev_1498796201292521600.sql @@ -20,4 +20,4 @@ CREATE TABLE ip2nationCountries ( lon float NOT NULL default '0', PRIMARY KEY (code), KEY code (code) -);
\ No newline at end of file +); diff --git a/data/sql/updates/pending_db_world/rev_1498796247453520600.sql b/data/sql/updates/pending_db_world/rev_1498796247453520600.sql index b23adb935d..aecf0fd2d9 100644 --- a/data/sql/updates/pending_db_world/rev_1498796247453520600.sql +++ b/data/sql/updates/pending_db_world/rev_1498796247453520600.sql @@ -6,4 +6,4 @@ DROP TABLE IF EXISTS ip2nationCountries; DELETE FROM `command` WHERE `name` in ('account lock', 'account lock ip', 'account lock country'); INSERT INTO `command` (`name`,`security`,`help`) VALUES ('account lock ip', 0, 'Syntax: .account lock ip [on|off]\nAllow login from account only from current used IP or remove this requirement.'), -('account lock country', 0, 'Syntax: .account lock country [on|off]\nAllow login from account only from current used Country or remove this requirement.');
\ No newline at end of file +('account lock country', 0, 'Syntax: .account lock country [on|off]\nAllow login from account only from current used Country or remove this requirement.'); diff --git a/modules/worldengine/nucleus/src/Database/Implementation/LoginDatabase.cpp b/modules/worldengine/nucleus/src/Database/Implementation/LoginDatabase.cpp index c0caa98667..76d7fdc196 100644 --- a/modules/worldengine/nucleus/src/Database/Implementation/LoginDatabase.cpp +++ b/modules/worldengine/nucleus/src/Database/Implementation/LoginDatabase.cpp @@ -28,7 +28,7 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_UPD_VS, "UPDATE account SET v = ?, s = ? WHERE username = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_LOGONPROOF, "UPDATE account SET sessionkey = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE username = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_LOGONCHALLENGE, "SELECT a.sha_pass_hash, a.id, a.locked, a.last_ip, aa.gmlevel, a.v, a.s FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.username = ?", CONNECTION_SYNCH); - PrepareStatement(LOGIN_SEL_LOGON_COUNTRY, "SELECT country FROM ip2nation WHERE ip < ? ORDER BY ip DESC LIMIT 0,1", CONNECTION_SYNCH); + PrepareStatement(LOGIN_SEL_LOGON_COUNTRY, "SELECT country FROM ip2nation WHERE ip < ? ORDER BY ip DESC LIMIT 0,1", CONNECTION_SYNCH); PrepareStatement(LOGIN_UPD_FAILEDLOGINS, "UPDATE account SET failed_logins = failed_logins + 1 WHERE username = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_SEL_FAILEDLOGINS, "SELECT id, failed_logins FROM account WHERE username = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME, "SELECT id FROM account WHERE username = ?", CONNECTION_SYNCH); @@ -50,7 +50,7 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC); - PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY, "UPDATE account SET lock_country = ? WHERE id = ?", CONNECTION_ASYNC); + PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY, "UPDATE account SET lock_country = ? WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_PASSWORD, "UPDATE account SET v = 0, s = 0, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? , mutereason = ? , muteby = ? WHERE id = ?", CONNECTION_ASYNC); @@ -78,6 +78,6 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC); - PrepareStatement(LOGIN_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH); + PrepareStatement(LOGIN_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_AUTOBROADCAST, "SELECT id, weight, text FROM autobroadcast WHERE realmid = ? OR realmid = -1", CONNECTION_SYNCH); } diff --git a/modules/worldengine/nucleus/src/Database/Implementation/LoginDatabase.h b/modules/worldengine/nucleus/src/Database/Implementation/LoginDatabase.h index 81accdc04b..d745d44c8f 100644 --- a/modules/worldengine/nucleus/src/Database/Implementation/LoginDatabase.h +++ b/modules/worldengine/nucleus/src/Database/Implementation/LoginDatabase.h @@ -46,7 +46,7 @@ enum LoginDatabaseStatements LOGIN_UPD_VS, LOGIN_UPD_LOGONPROOF, LOGIN_SEL_LOGONCHALLENGE, - LOGIN_SEL_LOGON_COUNTRY, + LOGIN_SEL_LOGON_COUNTRY, LOGIN_UPD_FAILEDLOGINS, LOGIN_SEL_FAILEDLOGINS, LOGIN_SEL_ACCOUNT_ID_BY_NAME, @@ -70,7 +70,7 @@ enum LoginDatabaseStatements LOGIN_INS_REALM_CHARACTERS_INIT, LOGIN_UPD_EXPANSION, LOGIN_UPD_ACCOUNT_LOCK, - LOGIN_UPD_ACCOUNT_LOCK_CONTRY, + LOGIN_UPD_ACCOUNT_LOCK_CONTRY, LOGIN_UPD_USERNAME, LOGIN_UPD_PASSWORD, LOGIN_UPD_MUTE_TIME, @@ -98,7 +98,7 @@ enum LoginDatabaseStatements LOGIN_SEL_ACCOUNT_WHOIS, LOGIN_SEL_REALMLIST_SECURITY_LEVEL, LOGIN_DEL_ACCOUNT, - LOGIN_SEL_IP2NATION_COUNTRY, + LOGIN_SEL_IP2NATION_COUNTRY, LOGIN_SEL_AUTOBROADCAST, MAX_LOGINDATABASE_STATEMENTS diff --git a/src/authserver/Server/AuthSocket.cpp b/src/authserver/Server/AuthSocket.cpp index 378de41f1e..6905f3b569 100644 --- a/src/authserver/Server/AuthSocket.cpp +++ b/src/authserver/Server/AuthSocket.cpp @@ -417,32 +417,32 @@ bool AuthSocket::_HandleLogonChallenge() else ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account IP matches"); } - else + else { ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str()); - std::string accountCountry = fields[3].GetString(); - if (accountCountry.empty() || accountCountry == "00") - ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is not locked to country", _login.c_str()); - else if (!accountCountry.empty()) + std::string accountCountry = fields[3].GetString(); + if (accountCountry.empty() || accountCountry == "00") + ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is not locked to country", _login.c_str()); + else if (!accountCountry.empty()) { uint32 ip = inet_addr(ip_address.c_str()); EndianConvertReverse(ip); stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY); stmt->setUInt32(0, ip); - if (PreparedQueryResult sessionCountryQuery = LoginDatabase.Query(stmt)) - { - std::string loginCountry = (*sessionCountryQuery)[0].GetString(); - ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is locked to country: '%s' Player country is '%s'", _login.c_str(), accountCountry.c_str(), loginCountry.c_str()); - if (loginCountry != accountCountry) - { - ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account country differs."); - pkt << uint8(WOW_FAIL_UNLOCKABLE_LOCK); - locked = true; - } - else - ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account country matches"); - } + if (PreparedQueryResult sessionCountryQuery = LoginDatabase.Query(stmt)) + { + std::string loginCountry = (*sessionCountryQuery)[0].GetString(); + ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is locked to country: '%s' Player country is '%s'", _login.c_str(), accountCountry.c_str(), loginCountry.c_str()); + if (loginCountry != accountCountry) + { + ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account country differs."); + pkt << uint8(WOW_FAIL_UNLOCKABLE_LOCK); + locked = true; + } + else + ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account country matches"); + } else ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] IP2NATION Table empty"); } diff --git a/src/scripts/Commands/cs_account.cpp b/src/scripts/Commands/cs_account.cpp index 45e97ac2f6..4b6ba7d79f 100644 --- a/src/scripts/Commands/cs_account.cpp +++ b/src/scripts/Commands/cs_account.cpp @@ -248,9 +248,9 @@ public: if (!param.empty()) { - if (param == "on") - { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY); + if (param == "on") + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY); uint32 ip = inet_addr(handler->GetSession()->GetRemoteAddress().c_str()); EndianConvertReverse(ip); stmt->setUInt32(0, ip); @@ -275,8 +275,8 @@ public: { PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY); stmt->setString(0, "00"); - stmt->setUInt32(1, handler->GetSession()->GetAccountId()); - LoginDatabase.Execute(stmt); + stmt->setUInt32(1, handler->GetSession()->GetAccountId()); + LoginDatabase.Execute(stmt); handler->PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED); } return true; |