mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[8496] Resolve some #include cycles and unsafe code.
* Common.h -> Threading.h -> Errors.h -> Common.h * Remove reduncdent #include "ByteBuffer.h" in headers * Remove redundent #include "Auth/BigNumber.h" in headers * Avoid multyply data copy at use some now dropped functions in BigNumber. * Avoid copy fixed byte count from byte arrays with unknown real size created from BigNumber.
This commit is contained in:
parent
b276b05363
commit
50d426e72c
13 changed files with 12 additions and 27 deletions
|
|
@ -20,7 +20,6 @@
|
||||||
#define MANGOS_GRIDNOTIFIERS_H
|
#define MANGOS_GRIDNOTIFIERS_H
|
||||||
|
|
||||||
#include "ObjectGridLoader.h"
|
#include "ObjectGridLoader.h"
|
||||||
#include "ByteBuffer.h"
|
|
||||||
#include "UpdateData.h"
|
#include "UpdateData.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,6 @@ enum PhaseMasks
|
||||||
|
|
||||||
class WorldPacket;
|
class WorldPacket;
|
||||||
class UpdateData;
|
class UpdateData;
|
||||||
class ByteBuffer;
|
|
||||||
class WorldSession;
|
class WorldSession;
|
||||||
class Creature;
|
class Creature;
|
||||||
class Player;
|
class Player;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
#include "Utilities/UnorderedMap.h"
|
#include "Utilities/UnorderedMap.h"
|
||||||
#include "Policies/ThreadingModel.h"
|
#include "Policies/ThreadingModel.h"
|
||||||
|
|
||||||
#include "ByteBuffer.h"
|
|
||||||
#include "UpdateData.h"
|
#include "UpdateData.h"
|
||||||
|
|
||||||
#include "GridDefines.h"
|
#include "GridDefines.h"
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,11 @@
|
||||||
#ifndef __UPDATEDATA_H
|
#ifndef __UPDATEDATA_H
|
||||||
#define __UPDATEDATA_H
|
#define __UPDATEDATA_H
|
||||||
|
|
||||||
|
#include "ByteBuffer.h"
|
||||||
|
|
||||||
class WorldPacket;
|
class WorldPacket;
|
||||||
|
|
||||||
|
|
||||||
enum OBJECT_UPDATE_TYPE
|
enum OBJECT_UPDATE_TYPE
|
||||||
{
|
{
|
||||||
UPDATETYPE_VALUES = 0,
|
UPDATETYPE_VALUES = 0,
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@
|
||||||
#include "ByteBuffer.h"
|
#include "ByteBuffer.h"
|
||||||
#include "Opcodes.h"
|
#include "Opcodes.h"
|
||||||
#include "Database/DatabaseEnv.h"
|
#include "Database/DatabaseEnv.h"
|
||||||
|
#include "Auth/BigNumber.h"
|
||||||
#include "Auth/Sha1.h"
|
#include "Auth/Sha1.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
#include "WorldSocketMgr.h"
|
#include "WorldSocketMgr.h"
|
||||||
|
|
|
||||||
|
|
@ -480,9 +480,9 @@ bool AuthSocket::_HandleLogonChallenge()
|
||||||
pkt << uint8(1);
|
pkt << uint8(1);
|
||||||
pkt.append(g.AsByteArray(), 1);
|
pkt.append(g.AsByteArray(), 1);
|
||||||
pkt << uint8(32);
|
pkt << uint8(32);
|
||||||
pkt.append(N.AsByteArray(), 32);
|
pkt.append(N.AsByteArray(32), 32);
|
||||||
pkt.append(s.AsByteArray(), s.GetNumBytes());// 32 bytes
|
pkt.append(s.AsByteArray(), s.GetNumBytes());// 32 bytes
|
||||||
pkt.append(unk3.AsByteArray(), 16);
|
pkt.append(unk3.AsByteArray(16), 16);
|
||||||
uint8 securityFlags = 0;
|
uint8 securityFlags = 0;
|
||||||
pkt << uint8(securityFlags); // security flags (0x0...0x04)
|
pkt << uint8(securityFlags); // security flags (0x0...0x04)
|
||||||
|
|
||||||
|
|
@ -807,7 +807,7 @@ bool AuthSocket::_HandleReconnectChallenge()
|
||||||
pkt << (uint8) AUTH_RECONNECT_CHALLENGE;
|
pkt << (uint8) AUTH_RECONNECT_CHALLENGE;
|
||||||
pkt << (uint8) 0x00;
|
pkt << (uint8) 0x00;
|
||||||
_reconnectProof.SetRand(16 * 8);
|
_reconnectProof.SetRand(16 * 8);
|
||||||
pkt.append(_reconnectProof.AsByteBuffer()); // 16 bytes random
|
pkt.append(_reconnectProof.AsByteArray(16),16); // 16 bytes random
|
||||||
pkt << (uint64) 0x00 << (uint64) 0x00; // 16 bytes zeros
|
pkt << (uint64) 0x00 << (uint64) 0x00; // 16 bytes zeros
|
||||||
SendBuf((char const*)pkt.contents(), pkt.size());
|
SendBuf((char const*)pkt.contents(), pkt.size());
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -186,21 +186,6 @@ uint8 *BigNumber::AsByteArray(int minSize)
|
||||||
return _array;
|
return _array;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer BigNumber::AsByteBuffer()
|
|
||||||
{
|
|
||||||
ByteBuffer ret(GetNumBytes());
|
|
||||||
ret.append(AsByteArray(), GetNumBytes());
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<uint8> BigNumber::AsByteVector()
|
|
||||||
{
|
|
||||||
std::vector<uint8> ret;
|
|
||||||
ret.resize(GetNumBytes());
|
|
||||||
memcpy(&ret[0], AsByteArray(), GetNumBytes());
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *BigNumber::AsHexStr()
|
const char *BigNumber::AsHexStr()
|
||||||
{
|
{
|
||||||
return BN_bn2hex(_bn);
|
return BN_bn2hex(_bn);
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
#define _AUTH_BIGNUMBER_H
|
#define _AUTH_BIGNUMBER_H
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "ByteBuffer.h"
|
|
||||||
|
|
||||||
struct bignum_st;
|
struct bignum_st;
|
||||||
|
|
||||||
|
|
@ -83,8 +82,6 @@ class BigNumber
|
||||||
|
|
||||||
uint32 AsDword();
|
uint32 AsDword();
|
||||||
uint8* AsByteArray(int minSize = 0);
|
uint8* AsByteArray(int minSize = 0);
|
||||||
ByteBuffer AsByteBuffer();
|
|
||||||
std::vector<uint8> AsByteVector();
|
|
||||||
|
|
||||||
const char *AsHexStr();
|
const char *AsHexStr();
|
||||||
const char *AsDecStr();
|
const char *AsDecStr();
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Auth/Sha1.h"
|
#include "Auth/Sha1.h"
|
||||||
|
#include "Auth/BigNumber.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
Sha1Hash::Sha1Hash()
|
Sha1Hash::Sha1Hash()
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <openssl/crypto.h>
|
#include <openssl/crypto.h>
|
||||||
#include "Auth/BigNumber.h"
|
|
||||||
|
class BigNumber;
|
||||||
|
|
||||||
class Sha1Hash
|
class Sha1Hash
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Threading.h"
|
#include "Threading.h"
|
||||||
|
#include "Errors.h"
|
||||||
#include <ace/OS_NS_unistd.h>
|
#include <ace/OS_NS_unistd.h>
|
||||||
#include <ace/Sched_Params.h>
|
#include <ace/Sched_Params.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@
|
||||||
#include <ace/TSS_T.h>
|
#include <ace/TSS_T.h>
|
||||||
#include "ace/Atomic_Op.h"
|
#include "ace/Atomic_Op.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "Errors.h"
|
|
||||||
|
|
||||||
namespace ACE_Based
|
namespace ACE_Based
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8495"
|
#define REVISION_NR "8496"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue