mirror of
https://github.com/mangosfour/server.git
synced 2025-12-27 19:37:04 +00:00
[0014] Updated realmd to use account_access. This allows for different security levels per account for each realm in realmlist.
This commit is contained in:
parent
cca3dfd883
commit
1597b90686
11 changed files with 97 additions and 30 deletions
|
|
@ -828,15 +828,14 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
|||
QueryResult* result =
|
||||
LoginDatabase.PQuery("SELECT "
|
||||
"id, " //0
|
||||
"gmlevel, " //1
|
||||
"sessionkey, " //2
|
||||
"last_ip, " //3
|
||||
"locked, " //4
|
||||
"v, " //5
|
||||
"s, " //6
|
||||
"expansion, " //7
|
||||
"mutetime, " //8
|
||||
"locale " //9
|
||||
"sessionkey, " //1
|
||||
"last_ip, " //2
|
||||
"locked, " //3
|
||||
"v, " //4
|
||||
"s, " //5
|
||||
"expansion, " //6
|
||||
"mutetime, " //7
|
||||
"locale " //8
|
||||
"FROM account "
|
||||
"WHERE username = '%s'",
|
||||
safe_account.c_str());
|
||||
|
|
@ -857,13 +856,13 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
|||
|
||||
Field* fields = result->Fetch ();
|
||||
|
||||
expansion = ((sWorld.getConfig(CONFIG_UINT32_EXPANSION) > fields[7].GetUInt8()) ? fields[7].GetUInt8() : sWorld.getConfig(CONFIG_UINT32_EXPANSION));
|
||||
expansion = ((sWorld.getConfig(CONFIG_UINT32_EXPANSION) > fields[6].GetUInt8()) ? fields[6].GetUInt8() : sWorld.getConfig(CONFIG_UINT32_EXPANSION));
|
||||
|
||||
N.SetHexStr ("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7");
|
||||
g.SetDword (7);
|
||||
|
||||
v.SetHexStr(fields[5].GetString());
|
||||
s.SetHexStr (fields[6].GetString());
|
||||
v.SetHexStr(fields[4].GetString());
|
||||
s.SetHexStr (fields[5].GetString());
|
||||
m_s = s;
|
||||
|
||||
const char* sStr = s.AsHexStr (); //Must be freed by OPENSSL_free()
|
||||
|
|
@ -877,9 +876,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
|||
OPENSSL_free ((void*) vStr);
|
||||
|
||||
///- Re-check ip locking (same check as in realmd).
|
||||
if (fields[4].GetUInt8 () == 1) // if ip is locked
|
||||
if (fields[3].GetUInt8 () == 1) // if ip is locked
|
||||
{
|
||||
if (strcmp (fields[3].GetString (), GetRemoteAddress ().c_str ()))
|
||||
if (strcmp (fields[2].GetString (), GetRemoteAddress ().c_str ()))
|
||||
{
|
||||
packet.Initialize (SMSG_AUTH_RESPONSE, 2);
|
||||
packet.WriteBit(false);
|
||||
|
|
@ -898,16 +897,35 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
|||
if(security > SEC_ADMINISTRATOR) // prevent invalid security settings in DB
|
||||
security = SEC_ADMINISTRATOR;
|
||||
|
||||
K.SetHexStr (fields[2].GetString ());
|
||||
K.SetHexStr (fields[1].GetString ());
|
||||
|
||||
time_t mutetime = time_t (fields[8].GetUInt64 ());
|
||||
time_t mutetime = time_t (fields[7].GetUInt64 ());
|
||||
|
||||
locale = LocaleConstant (fields[9].GetUInt8 ());
|
||||
locale = LocaleConstant (fields[8].GetUInt8 ());
|
||||
if (locale >= MAX_LOCALE)
|
||||
locale = LOCALE_enUS;
|
||||
|
||||
delete result;
|
||||
|
||||
// Checks gmlevel per Realm
|
||||
result =
|
||||
LoginDatabase.PQuery ("SELECT "
|
||||
"RealmID, " //0
|
||||
"gmlevel " //1
|
||||
"FROM account_access "
|
||||
"WHERE id = '%d'"
|
||||
" AND (RealmID = '%d'"
|
||||
" OR RealmID = '-1')",
|
||||
id, realmID);
|
||||
if(!result)
|
||||
security = 0;
|
||||
else
|
||||
{
|
||||
fields = result->Fetch ();
|
||||
security = fields[1].GetInt32();
|
||||
delete result;
|
||||
}
|
||||
|
||||
// Re-check account ban (same check as in realmd)
|
||||
QueryResult *banresult =
|
||||
LoginDatabase.PQuery ("SELECT 1 FROM account_banned WHERE id = %u AND active = 1 AND (unbandate > UNIX_TIMESTAMP() OR unbandate = bandate)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue