Don't authenticate loopback

This commit is contained in:
momo5502 2016-08-07 22:14:30 +02:00
parent 9e9967b9d1
commit 4fc7de502a
3 changed files with 178 additions and 166 deletions

View File

@ -63,8 +63,13 @@ namespace Components
return;
}
#if DEBUG
// Simply connect, if we're in debug mode, we ignore all security checks
if (address.IsLoopback()
// Simply connect, if we're in debug mode, we ignore all security checks
#ifdef DEBUG
|| true
#endif
)
{
if (!connectData.infostring().empty())
{
Game::SV_Cmd_EndTokenizedString();
@ -75,7 +80,9 @@ namespace Components
{
Network::Send(address, "error\nInvalid infostring data!");
}
#else
}
else
{
// Validate proto data
if (connectData.signature().empty() || connectData.publickey().empty() || connectData.token().empty() || connectData.infostring().empty())
{
@ -142,7 +149,7 @@ namespace Components
Logger::Print("Verified XUID %llX (%d) from %s\n", xuid, userLevel, address.GetCString());
Game::SV_DirectConnect(*address.Get());
#endif
}
}
void __declspec(naked) Auth::DirectConnectStub()

View File

@ -107,6 +107,10 @@ namespace Components
return false;
}
bool Network::Address::IsLoopback()
{
return Game::NET_IsLocalAddress(this->address);
}
bool Network::Address::IsValid()
{
return (this->GetType() != Game::netadrtype_t::NA_BAD);

View File

@ -41,6 +41,7 @@ namespace Components
bool IsLocal();
bool IsSelf();
bool IsValid();
bool IsLoopback();
void Serialize(Proto::Network::Address* protoAddress);
void Deserialize(const Proto::Network::Address& protoAddress);