Rebase resync

This commit is contained in:
Antz 2020-02-17 09:19:44 +00:00
parent a0797532e8
commit 1997c1e903
3106 changed files with 11118 additions and 627576 deletions

View file

@ -1,4 +1,4 @@
/*
/**
* This code is part of MaNGOS. Contributor & Copyright details are in AUTHORS/THANKS.
*
* This program is free software; you can redistribute it and/or modify
@ -164,7 +164,7 @@ int WorldSocket::SendPacket(const WorldPacket& pct)
return -1;
// Dump outgoing packet.
sLog.outWorldPacketDump(uint32(get_handle()), pct.GetOpcode(), LookupOpcodeName(pct.GetOpcode()), &pct, false);
sLog.outWorldPacketDump(uint32(get_handle()), pct.GetOpcode(), pct.GetOpcodeName(), &pct, false);
ServerPktHeader header(pct.size() + 2, pct.GetOpcode());
m_Crypt.EncryptSend((uint8*)header.header, header.getHeaderLength());
@ -498,7 +498,7 @@ int WorldSocket::handle_input_header(void)
header.size -= 4;
ACE_NEW_RETURN(m_RecvWPct, WorldPacket((uint16) header.cmd, header.size), -1);
ACE_NEW_RETURN(m_RecvWPct, WorldPacket(Opcodes(header.cmd), header.size), -1);
if (header.size > 0)
{
@ -677,7 +677,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
return -1;
// Dump received packet.
sLog.outWorldPacketDump(uint32(get_handle()), new_pct->GetOpcode(), LookupOpcodeName(new_pct->GetOpcode()), new_pct, true);
sLog.outWorldPacketDump(uint32(get_handle()), new_pct->GetOpcode(), new_pct->GetOpcodeName(), new_pct, true);
try
{
@ -828,14 +828,15 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
QueryResult* result =
LoginDatabase.PQuery("SELECT "
"id, " //0
"sessionkey, " //1
"last_ip, " //2
"locked, " //3
"v, " //4
"s, " //5
"expansion, " //6
"mutetime, " //7
"locale " //8
"gmlevel," //1
"sessionkey, " //2
"last_ip, " //3
"locked, " //4
"v, " //5
"s, " //6
"expansion, " //7
"mutetime, " //8
"locale " //9
"FROM account "
"WHERE username = '%s'",
safe_account.c_str());
@ -856,13 +857,13 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
Field* fields = result->Fetch ();
expansion = ((sWorld.getConfig(CONFIG_UINT32_EXPANSION) > fields[6].GetUInt8()) ? fields[6].GetUInt8() : sWorld.getConfig(CONFIG_UINT32_EXPANSION));
expansion = ((sWorld.getConfig(CONFIG_UINT32_EXPANSION) > fields[7].GetUInt8()) ? fields[7].GetUInt8() : sWorld.getConfig(CONFIG_UINT32_EXPANSION));
N.SetHexStr ("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7");
g.SetDword (7);
N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7");
g.SetDword(7);
v.SetHexStr(fields[4].GetString());
s.SetHexStr (fields[5].GetString());
v.SetHexStr(fields[5].GetString());
s.SetHexStr(fields[6].GetString());
m_s = s;
const char* sStr = s.AsHexStr (); //Must be freed by OPENSSL_free()
@ -876,9 +877,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
OPENSSL_free ((void*) vStr);
///- Re-check ip locking (same check as in realmd).
if (fields[3].GetUInt8 () == 1) // if ip is locked
if (fields[4].GetUInt8 () == 1) // if ip is locked
{
if (strcmp (fields[2].GetString (), GetRemoteAddress ().c_str ()))
if (strcmp (fields[3].GetString(), GetRemoteAddress().c_str()))
{
packet.Initialize (SMSG_AUTH_RESPONSE, 2);
packet.WriteBit(false);
@ -897,35 +898,16 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
if(security > SEC_ADMINISTRATOR) // prevent invalid security settings in DB
security = SEC_ADMINISTRATOR;
K.SetHexStr (fields[1].GetString ());
K.SetHexStr (fields[2].GetString());
time_t mutetime = time_t (fields[7].GetUInt64 ());
time_t mutetime = time_t (fields[8].GetUInt64());
locale = LocaleConstant (fields[8].GetUInt8 ());
locale = LocaleConstant (fields[9].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)"
@ -943,12 +925,12 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
delete banresult;
sLog.outError ("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
sLog.outError("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
return -1;
}
// Check locked state for server
AccountTypes allowedAccountType = sWorld.GetPlayerSecurityLimit ();
AccountTypes allowedAccountType = sWorld.GetPlayerSecurityLimit();
if (allowedAccountType > SEC_PLAYER && AccountTypes(security) < allowedAccountType)
{