log/info for security token protocol

This commit is contained in:
east 2015-08-14 16:46:01 +02:00
parent a084f1e31e
commit d82b75f760
2 changed files with 5 additions and 3 deletions

View file

@ -1024,7 +1024,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
net_addr_str(m_NetServer.ClientAddr(ClientID), aAddrStr, sizeof(aAddrStr), true); net_addr_str(m_NetServer.ClientAddr(ClientID), aAddrStr, sizeof(aAddrStr), true);
char aBuf[256]; 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); Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);
m_aClients[ClientID].m_State = CClient::STATE_READY; m_aClients[ClientID].m_State = CClient::STATE_READY;
GameServer()->OnClientConnected(ClientID); 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)" : const char *pAuthStr = pThis->m_aClients[i].m_Authed == CServer::AUTHED_ADMIN ? "(Admin)" :
pThis->m_aClients[i].m_Authed == CServer::AUTHED_MOD ? "(Mod)" : ""; 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, 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, pAuthStr); 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 else
str_format(aBuf, sizeof(aBuf), "id=%d addr=%s connecting", i, aAddrStr); str_format(aBuf, sizeof(aBuf), "id=%d addr=%s connecting", i, aAddrStr);

View file

@ -221,6 +221,7 @@ public:
// anti spoof // anti spoof
void DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken); void DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken);
void SetUnknownSeq() { m_UnknownSeq = true; } void SetUnknownSeq() { m_UnknownSeq = true; }
SECURITY_TOKEN SecurityToken() const { return m_SecurityToken; }
}; };
class CConsoleNetConnection class CConsoleNetConnection
@ -325,6 +326,7 @@ public:
// status requests // status requests
const NETADDR *ClientAddr(int ClientID) const { return m_aSlots[ClientID].m_Connection.PeerAddress(); } 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; } NETSOCKET Socket() const { return m_Socket; }
class CNetBan *NetBan() const { return m_pNetBan; } class CNetBan *NetBan() const { return m_pNetBan; }
int NetType() const { return m_Socket.type; } int NetType() const { return m_Socket.type; }