Merge branch 'master' into 4.x

Conflicts:
	src/server/authserver/Server/AuthSocket.cpp
	src/server/game/Entities/Object/Object.cpp
	src/server/game/Entities/Player/Player.cpp
	src/server/game/Entities/Unit/Unit.cpp
	src/server/game/Handlers/AuctionHouseHandler.cpp
	src/server/game/Handlers/CharacterHandler.cpp
	src/server/game/Handlers/MovementHandler.cpp
	src/server/game/Miscellaneous/SharedDefines.h
	src/server/game/Spells/Spell.cpp
	src/server/game/Spells/SpellEffects.cpp
This commit is contained in:
Spp
2012-01-31 11:49:53 +01:00
491 changed files with 15328 additions and 4368 deletions

View File

@@ -209,7 +209,7 @@ AuthSocket::~AuthSocket(void) {}
// Accept the connection and set the s random value for SRP6
void AuthSocket::OnAccept(void)
{
sLog->outBasic("Accepting connection from '%s'", socket().get_remote_address().c_str());
sLog->outBasic("'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort());
}
void AuthSocket::OnClose(void)
@@ -247,7 +247,7 @@ void AuthSocket::OnRead()
// Report unknown packets in the error log
if (i == AUTH_TOTAL_COMMANDS)
{
sLog->outError("[Auth] got unknown packet from '%s'", socket().get_remote_address().c_str());
sLog->outError("[Auth] got unknown packet from '%s'", socket().getRemoteAddress().c_str());
socket().shutdown();
return;
}
@@ -349,14 +349,14 @@ bool AuthSocket::_HandleLogonChallenge()
// Verify that this IP is not in the ip_banned table
LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS));
const std::string& ip_address = socket().get_remote_address();
const std::string& ip_address = socket().getRemoteAddress();
PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED);
stmt->setString(0, ip_address);
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (result)
{
pkt << uint8(WOW_FAIL_BANNED);
sLog->outBasic("[AuthChallenge] Banned ip %s tried to login!", ip_address.c_str());
pkt << (uint8)WOW_FAIL_BANNED;
sLog->outBasic("'%s:%d' [AuthChallenge] Banned ip tries to login!",socket().getRemoteAddress().c_str(), socket().getRemotePort());
}
else
{
@@ -402,13 +402,13 @@ bool AuthSocket::_HandleLogonChallenge()
{
if ((*banresult)[0].GetUInt64() == (*banresult)[1].GetUInt64())
{
pkt << uint8(WOW_FAIL_BANNED);
sLog->outBasic("[AuthChallenge] Banned account %s tried to login!", _login.c_str());
pkt << (uint8)WOW_FAIL_BANNED;
sLog->outBasic("'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
}
else
{
pkt << uint8(WOW_FAIL_SUSPENDED);
sLog->outBasic("[AuthChallenge] Temporarily banned account %s tried to login!", _login.c_str());
pkt << (uint8)WOW_FAIL_SUSPENDED;
sLog->outBasic("'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
}
}
else
@@ -483,7 +483,9 @@ bool AuthSocket::_HandleLogonChallenge()
for (int i = 0; i < 4; ++i)
_localizationName[i] = ch->country[4-i-1];
sLog->outBasic("[AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", _login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName));
sLog->outBasic("'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(),
_login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName)
);
}
}
}
@@ -584,7 +586,7 @@ bool AuthSocket::_HandleLogonProof()
// Check if SRP6 results match (password is correct), else send an error
if (!memcmp(M.AsByteArray(), lp.M1, 20))
{
sLog->outBasic("User '%s' successfully authenticated", _login.c_str());
sLog->outBasic("'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
// Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account
// No SQL injection (escaped user name) and IP address as received by socket
@@ -592,7 +594,7 @@ bool AuthSocket::_HandleLogonProof()
PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LOGONPROOF);
stmt->setString(0, K_hex);
stmt->setString(1, socket().get_remote_address().c_str());
stmt->setString(1, socket().getRemoteAddress().c_str());
stmt->setUInt32(2, GetLocaleByName(_localizationName));
stmt->setString(3, _login);
LoginDatabase.Execute(stmt);
@@ -620,7 +622,7 @@ bool AuthSocket::_HandleLogonProof()
char data[4] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 };
socket().send(data, sizeof(data));
sLog->outBasic("[AuthChallenge] account %s tried to login with wrong password!", _login.c_str());
sLog->outBasic("'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
uint32 MaxWrongPassCount = ConfigMgr::GetIntDefault("WrongPass.MaxCount", 0);
if (MaxWrongPassCount > 0)
@@ -650,17 +652,18 @@ bool AuthSocket::_HandleLogonProof()
stmt->setUInt32(1, WrongPassBanTime);
LoginDatabase.Execute(stmt);
sLog->outBasic("[AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times",
_login.c_str(), WrongPassBanTime, failed_logins);
sLog->outBasic("'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times",
socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str(), WrongPassBanTime, failed_logins);
}
else
{
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_IP_AUTO_BANNED);
stmt->setString(0, socket().get_remote_address());
stmt->setString(0, socket().getRemoteAddress());
stmt->setUInt32(1, WrongPassBanTime);
LoginDatabase.Execute(stmt);
sLog->outBasic("[AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times", socket().get_remote_address().c_str(), WrongPassBanTime, _login.c_str(), failed_logins);
sLog->outBasic("'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times",
socket().getRemoteAddress().c_str(), socket().getRemotePort(), socket().getRemoteAddress().c_str(), WrongPassBanTime, _login.c_str(), failed_logins);
}
}
}
@@ -712,7 +715,7 @@ bool AuthSocket::_HandleReconnectChallenge()
// Stop if the account is not found
if (!result)
{
sLog->outError("[ERROR] user %s tried to login and we cannot find his session key in the database.", _login.c_str());
sLog->outError("'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
socket().shutdown();
return false;
}
@@ -771,7 +774,7 @@ bool AuthSocket::_HandleReconnectProof()
}
else
{
sLog->outError("[ERROR] user %s tried to login, but session invalid.", _login.c_str());
sLog->outError("'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
socket().shutdown();
return false;
}
@@ -793,7 +796,7 @@ bool AuthSocket::_HandleRealmList()
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (!result)
{
sLog->outError("[ERROR] user %s tried to login and we cannot find him in the database.", _login.c_str());
sLog->outError("'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
socket().shutdown();
return false;
}

View File

@@ -31,7 +31,7 @@ RealmSocket::Session::Session(void) {}
RealmSocket::Session::~Session(void) { }
RealmSocket::RealmSocket(void) : input_buffer_(4096), session_(NULL), remote_address_()
RealmSocket::RealmSocket(void) : input_buffer_(4096), session_(NULL), _remoteAddress()
{
reference_counting_policy().value(ACE_Event_Handler::Reference_Counting_Policy::ENABLED);
@@ -63,7 +63,8 @@ int RealmSocket::open(void * arg)
return -1;
}
remote_address_ = addr.get_host_addr();
_remoteAddress = addr.get_host_addr();
_remotePort = addr.get_port_number();
// Register with ACE Reactor
if (Base::open(arg) == -1)
@@ -89,9 +90,14 @@ int RealmSocket::close(int)
return 0;
}
const std::string& RealmSocket::get_remote_address(void) const
const std::string& RealmSocket::getRemoteAddress(void) const
{
return remote_address_;
return _remoteAddress;
}
const uint16 RealmSocket::getRemotePort(void) const
{
return _remotePort;
}
size_t RealmSocket::recv_len(void) const

View File

@@ -52,7 +52,9 @@ public:
bool send(const char *buf, size_t len);
const std::string& get_remote_address(void) const;
const std::string& getRemoteAddress(void) const;
const uint16 getRemotePort(void) const;
virtual int open(void *);
@@ -70,7 +72,8 @@ private:
ACE_Message_Block input_buffer_;
Session* session_;
std::string remote_address_;
std::string _remoteAddress;
uint16 _remotePort;
};
#endif /* __REALMSOCKET_H__ */