From d82b75f76010d80141665f5050c075cfd5308ed6 Mon Sep 17 00:00:00 2001 From: east Date: Fri, 14 Aug 2015 16:46:01 +0200 Subject: [PATCH] log/info for security token protocol --- src/engine/server/server.cpp | 6 +++--- src/engine/shared/network.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 56ff718a5..0e1fb769e 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -1024,7 +1024,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket) net_addr_str(m_NetServer.ClientAddr(ClientID), aAddrStr, sizeof(aAddrStr), true); char aBuf[256]; - str_format(aBuf, sizeof(aBuf), "player is ready. ClientID=%x addr=%s", ClientID, aAddrStr); + str_format(aBuf, sizeof(aBuf), "player is ready. ClientID=%x addr=%s secure=%s", ClientID, aAddrStr, m_NetServer.HasSecurityToken(ClientID)?"yes":"no"); Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf); m_aClients[ClientID].m_State = CClient::STATE_READY; GameServer()->OnClientConnected(ClientID); @@ -1758,8 +1758,8 @@ void CServer::ConStatus(IConsole::IResult *pResult, void *pUser) { const char *pAuthStr = pThis->m_aClients[i].m_Authed == CServer::AUTHED_ADMIN ? "(Admin)" : pThis->m_aClients[i].m_Authed == CServer::AUTHED_MOD ? "(Mod)" : ""; - str_format(aBuf, sizeof(aBuf), "id=%d addr=%s name='%s' score=%d client=%d %s", i, aAddrStr, - pThis->m_aClients[i].m_aName, pThis->m_aClients[i].m_Score, ((CGameContext *)(pThis->GameServer()))->m_apPlayers[i]->m_ClientVersion, pAuthStr); + str_format(aBuf, sizeof(aBuf), "id=%d addr=%s name='%s' score=%d client=%d secure=%s %s", i, aAddrStr, + pThis->m_aClients[i].m_aName, pThis->m_aClients[i].m_Score, ((CGameContext *)(pThis->GameServer()))->m_apPlayers[i]->m_ClientVersion, pThis->m_NetServer.HasSecurityToken(i) ? "yes":"no", pAuthStr); } else str_format(aBuf, sizeof(aBuf), "id=%d addr=%s connecting", i, aAddrStr); diff --git a/src/engine/shared/network.h b/src/engine/shared/network.h index ea0e0c506..589daffce 100644 --- a/src/engine/shared/network.h +++ b/src/engine/shared/network.h @@ -221,6 +221,7 @@ public: // anti spoof void DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken); void SetUnknownSeq() { m_UnknownSeq = true; } + SECURITY_TOKEN SecurityToken() const { return m_SecurityToken; } }; class CConsoleNetConnection @@ -325,6 +326,7 @@ public: // status requests const NETADDR *ClientAddr(int ClientID) const { return m_aSlots[ClientID].m_Connection.PeerAddress(); } + bool HasSecurityToken(int ClientID) const { return m_aSlots[ClientID].m_Connection.SecurityToken() != NET_SECURITY_TOKEN_UNSUPPORTED; } NETSOCKET Socket() const { return m_Socket; } class CNetBan *NetBan() const { return m_pNetBan; } int NetType() const { return m_Socket.type; }