(svn r22367) -Codechange: send ClientSockets instead of ClientInfos to the admin "core" as they send IP addresses to the admin "bots"

This commit is contained in:
rubidium 2011-04-22 16:03:13 +00:00
parent c61abe0019
commit 146d532d51
3 changed files with 13 additions and 12 deletions

View File

@ -206,10 +206,11 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientJoin(ClientID clien
return NETWORK_RECV_STATUS_OKAY;
}
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo(const NetworkClientInfo *ci)
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo(const NetworkClientSocket *cs)
{
Packet *p = new Packet(ADMIN_PACKET_SERVER_CLIENT_INFO);
const NetworkClientInfo *ci = cs->GetInfo();
p->Send_uint32(ci->client_id);
p->Send_string(const_cast<NetworkAddress &>(ci->client_address).GetHostname());
p->Send_string(ci->client_name);
@ -570,14 +571,14 @@ DEF_ADMIN_RECEIVE_COMMAND(Server, ADMIN_PACKET_ADMIN_POLL)
case ADMIN_UPDATE_CLIENT_INFO:
/* The admin is requesting client info. */
const NetworkClientInfo *ci;
const NetworkClientSocket *cs;
if (d1 == UINT32_MAX) {
FOR_ALL_CLIENT_INFOS(ci) {
this->SendClientInfo(ci);
FOR_ALL_CLIENT_SOCKETS(cs) {
this->SendClientInfo(cs);
}
} else {
ci = NetworkClientInfo::GetByClientID((ClientID)d1);
if (ci != NULL) this->SendClientInfo(ci);
cs = NetworkClientSocket::GetByClientID((ClientID)d1);
if (cs != NULL) this->SendClientInfo(cs);
}
break;
@ -654,14 +655,14 @@ DEF_ADMIN_RECEIVE_COMMAND(Server, ADMIN_PACKET_ADMIN_CHAT)
* @param ci the client info.
* @param new_client if this is a new client, send the respective packet too.
*/
void NetworkAdminClientInfo(const NetworkClientInfo *ci, bool new_client)
void NetworkAdminClientInfo(const NetworkClientSocket *cs, bool new_client)
{
ServerNetworkAdminSocketHandler *as;
FOR_ALL_ADMIN_SOCKETS(as) {
if (as->update_frequency[ADMIN_UPDATE_CLIENT_INFO] & ADMIN_FREQUENCY_AUTOMATIC) {
as->SendClientInfo(ci);
as->SendClientInfo(cs);
if (new_client) {
as->SendClientJoin(ci->client_id);
as->SendClientJoin(cs->client_id);
}
}
}

View File

@ -50,7 +50,7 @@ public:
NetworkRecvStatus SendDate();
NetworkRecvStatus SendClientJoin(ClientID client_id);
NetworkRecvStatus SendClientInfo(const NetworkClientInfo *ci);
NetworkRecvStatus SendClientInfo(const NetworkClientSocket *cs);
NetworkRecvStatus SendClientUpdate(const NetworkClientInfo *ci);
NetworkRecvStatus SendClientQuit(ClientID client_id);
NetworkRecvStatus SendClientError(ClientID client_id, NetworkErrorCode error);
@ -85,7 +85,7 @@ public:
#define FOR_ALL_ADMIN_SOCKETS_FROM(var, start) FOR_ALL_ITEMS_FROM(ServerNetworkAdminSocketHandler, adminsocket_index, var, start)
#define FOR_ALL_ADMIN_SOCKETS(var) FOR_ALL_ADMIN_SOCKETS_FROM(var, 0)
void NetworkAdminClientInfo(const NetworkClientInfo *ci, bool new_client = false);
void NetworkAdminClientInfo(const NetworkClientSocket *cs, bool new_client = false);
void NetworkAdminClientUpdate(const NetworkClientInfo *ci);
void NetworkAdminClientQuit(ClientID client_id);
void NetworkAdminClientError(ClientID client_id, NetworkErrorCode error_code);

View File

@ -979,7 +979,7 @@ DEF_GAME_RECEIVE_COMMAND(Server, PACKET_CLIENT_MAP_OK)
}
}
NetworkAdminClientInfo(this->GetInfo(), true);
NetworkAdminClientInfo(this, true);
/* also update the new client with our max values */
this->SendConfigUpdate();