* fixed MAJOR security problem with in-game commands ("-cmd") (scripts that had no #permission=... assigned could be executed by everyone)

* fixed possible endless loop in ObjMgr::RemoveAll() if already deleted objects were incorrectly removed (real problem source is somewhere else!)
* fixed MyCharacter::HasSpell() - returned false in almost all cases
* bump to version 13.51
This commit is contained in:
false_genesis 2008-03-10 17:27:25 +00:00
parent 1e39771e5f
commit 513064638d
10 changed files with 40 additions and 39 deletions

View File

@ -1215,7 +1215,7 @@ void DefScriptPackage::My_Run(std::string line, std::string username)
}
if(scperm > 0) // skip "invisible" scripts (without any permission set) completely.
if(scperm >= 0) // skip "invisible" scripts (without any permission set) completely.
{
if(usrperm < scperm)
{
@ -1227,10 +1227,12 @@ void DefScriptPackage::My_Run(std::string line, std::string username)
RunScript("_nopermission",&Set);
return;
}
else
{
Interpret(curSet);
}
}
Interpret(curSet);
}

View File

@ -46,8 +46,8 @@ void PseuInstanceRunnable::sleep(uint32 msecs)
PseuInstance::PseuInstance(PseuInstanceRunnable *run)
{
_runnable=run;
_ver="PseuWoW Alpha Build 13.5" DEBUG_APPENDIX;
_ver_short="A13.5" DEBUG_APPENDIX;
_ver="PseuWoW Alpha Build 13.51" DEBUG_APPENDIX;
_ver_short="A13.51" DEBUG_APPENDIX;
_wsession=NULL;
_rsession=NULL;
_scp=NULL;

View File

@ -145,7 +145,7 @@ void WorldSession::SendCastSpell(uint32 spellid, bool nocheck)
SendWorldPacket(packet);
logdetail("Casting spell %u on target "I64FMT,spellid,my->GetTarget());
if(!known)
logcustom(1,RED," - WARNING: spell is NOT known!");
logcustom(1,LRED," - WARNING: spell is NOT known!");
}
void WorldSession::SendWhoListRequest(uint32 minlvl, uint32 maxlvl, uint32 racemask, uint32 classmask, std::string name, std::string guildname, std::vector<uint32> *zonelist, std::vector<std::string> *strlist)

View File

@ -47,6 +47,11 @@ void ObjMgr::Remove(uint64 guid)
_obj.erase(guid); // now delete the obj from the mgr
delete o; // and delete the obj itself
}
else
{
_obj.erase(guid);
logcustom(2,LRED,"ObjMgr::Remove("I64FMT") - not existing",guid);
}
}
// -- Object part --

View File

@ -39,16 +39,15 @@ void Object::Create( uint64 guid )
WorldObject::WorldObject()
{
_x = _y = _z = _o = 0;
_m = 0;
}
void WorldObject::SetPosition(float x, float y, float z, float o)
{
_x = x;
_y = y;
_z = z;
_o = o;
_wpos.x = x;
_wpos.y = y;
_wpos.z = z;
_wpos.o = o;
}
void WorldObject::SetPosition(float x, float y, float z, float o, uint16 _map)

View File

@ -5,6 +5,7 @@
#include "ObjectDefines.h"
#include "common.h"
#include "HelperDefs.h"
#include "World.h"
enum TYPE
{
@ -113,10 +114,13 @@ public:
virtual ~WorldObject ( ) {}
void SetPosition(float x, float y, float z, float o, uint16 _map);
void SetPosition(float x, float y, float z, float o);
inline float GetX(void) { return _x; }
inline float GetY(void) { return _y; }
inline float GetZ(void) { return _z; }
inline float GetO(void) { return _o; }
inline void SetPosition(WorldPosition& wp) { _wpos = wp; }
inline void SetPosition(WorldPosition& wp, uint16 mapid) { SetPosition(wp); _m = mapid; }
inline WorldPosition GetPosition(void) {return _wpos; }
inline float GetX(void) { return _wpos.x; }
inline float GetY(void) { return _wpos.y; }
inline float GetZ(void) { return _wpos.z; }
inline float GetO(void) { return _wpos.o; }
float GetDistance(WorldObject *obj);
float GetDistance2d(float x, float y);
float GetDistance(float x, float y, float z);
@ -125,7 +129,7 @@ public:
protected:
WorldObject();
float _x,_y,_z,_o; // coords, orientation
WorldPosition _wpos; // coords, orientation
uint16 _m; // map
};

View File

@ -56,6 +56,15 @@ void MyCharacter::RemoveSpell(uint32 spellid)
}
}
bool MyCharacter::HasSpell(uint32 spellid)
{
for(std::vector<SpellBookEntry>::iterator i=_spells.begin(); i != _spells.end(); i++)
if(i->id == spellid)
return true;
return false;
}
uint16 MyCharacter::GetSpellSlot(uint32 spellid)
{
for(std::vector<SpellBookEntry>::iterator i=_spells.begin(); i != _spells.end(); i++)

View File

@ -118,26 +118,7 @@
#define TRADE_SLOT_COUNT 7
#define TRADE_SLOT_TRADED_COUNT 6
#define TRADE_SLOT_NONTRADED 6
enum MovementFlags
{
MOVEMENTFLAG_FORWARD = 0x1,
MOVEMENTFLAG_BACKWARD = 0x2,
MOVEMENTFLAG_STRAFE_LEFT = 0x4,
MOVEMENTFLAG_STRAFE_RIGHT = 0x8,
MOVEMENTFLAG_LEFT = 0x10,
MOVEMENTFLAG_RIGHT = 0x20,
MOVEMENTFLAG_PITCH_UP = 0x40,
MOVEMENTFLAG_PITCH_DOWN = 0x80,
MOVEMENTFLAG_WALK = 0x100,
MOVEMENTFLAG_JUMPING = 0x2000,
MOVEMENTFLAG_FALLING = 0x4000,
MOVEMENTFLAG_SWIMMING = 0x200000,
MOVEMENTFLAG_ONTRANSPORT = 0x2000000,
MOVEMENTFLAG_SPLINE = 0x4000000
};
#define TRADE_SLOT_NONTRADED 6
struct PlayerEnumItem
{
@ -208,7 +189,7 @@ public:
void ClearSpells(void) { _spells.clear(); }
uint64 GetTarget(void) { return _target; }
void SetTarget(uint64 guid) { _target = guid; } // should only be called by WorldSession::SendSetSelection() !!
bool HasSpell(uint32 spellid) { return GetSpellSlot(spellid) != 0; }
bool HasSpell(uint32 spellid);
uint16 GetSpellSlot(uint32 spellid);
private:

View File

@ -333,7 +333,7 @@ void WorldSession::_ValuesUpdate(uint64 uguid, WorldPacket& recvPacket)
}
else
{
logcustom(1,RED,"Got UpdateObject_Values for unknown object "I64FMT,uguid);
logcustom(1,LRED,"Got UpdateObject_Values for unknown object "I64FMT,uguid);
tyid = GetTypeIdByGuid(uguid); // can cause problems with TYPEID_CONTAINER!!
valuesCount = GetValuesCountByTypeId(tyid);
}

View File

@ -213,6 +213,7 @@ void WorldSession::HandleWorldPacket(WorldPacket *packet)
}
catch (ByteBufferException bbe)
{
logerror("Exception while handling opcode %u [%s]!",packet->GetOpcode(),GetOpcodeName(packet->GetOpcode()));
logerror("WorldSession: ByteBufferException");
logerror("ByteBuffer reported: attempt to \"%s\" %u bytes at position %u out of total %u bytes. (wpos=%u)",
bbe.action, bbe.readsize, bbe.rpos, bbe.cursize, bbe.wpos);
@ -223,7 +224,7 @@ void WorldSession::HandleWorldPacket(WorldPacket *packet)
}
catch (...)
{
logerror("Exception while handling opcode %u!",packet->GetOpcode());
logerror("Exception while handling opcode %u [%s]!",packet->GetOpcode(),GetOpcodeName(packet->GetOpcode()));
logerror("Data: pktsize=%u, handler=0x%X queuesize=%u",packet->size(),table[hpos].handler,pktQueue.size());
logerror("Packet Hexdump:");
logerror("%s",toHexDump((uint8*)packet->contents(),packet->size(),true).c_str());