Open common and search service.h
Add:
Open db/src and search Peerbase.cpp
Search:
Add bellow:
Open game/src and search desc_p2p.cpp
Search:
Add bellow:
Search:
Add bellow:
Open input.cpp
Search:
Add bellow:
Add:
C++:
#define ENABLE_PORT_SECURITY
Open db/src and search Peerbase.cpp
Search:
C++:
bool CPeerBase::Accept(socket_t fd_accept)
{
struct sockaddr_in peer;
if ((m_fd = socket_accept(fd_accept, &peer)) == INVALID_SOCKET)
{
Destroy();
return false;
}
Add bellow:
C++:
#ifdef ENABLE_PORT_SECURITY
if (strcmp(inet_ntoa(peer.sin_addr), "127.0.0.1")) // refuse if remote host != localhost (only the same machine must be able to connect in here)
{
sys_log(0, "BLOCK CONNECTION FROM %s", inet_ntoa(peer.sin_addr));
Destroy();
return false;
}
#endif
Open game/src and search desc_p2p.cpp
Search:
C++:
#include "desc_p2p.h"
Add bellow:
C++:
#ifdef ENABLE_PORT_SECURITY
#include "config.h"
#endif
Search:
C++:
m_iMinInputBufferLen = 1024 * 1024;
Add bellow:
C++:
#ifdef ENABLE_PORT_SECURITY
if (strcmp(host, g_szPublicIP)) // refuse if remote host != public ip (only the same machine must be able to connect in here)
{
sys_log(0, "SYSTEM: new p2p connection from [%s] to [%s] fd: %d BLOCKED", host, g_szPublicIP, m_sock);
SetPhase(PHASE_CLOSE);
return true;
}
#endif
Open input.cpp
Search:
C++:
int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
{
if (bHeader == 10) // ??? ??
return 0;
if (bHeader == HEADER_CG_TEXT)
{
Add bellow:
C++:
#ifdef ENABLE_PORT_SECURITY
if (IsEmptyAdminPage() || !IsAdminPage(inet_ntoa(d->GetAddr().sin_addr))) // block if adminpage is not set or if not admin
{
sys_log(0, "SOCKET_CMD: BLOCK FROM(%s)", d->GetHostName());
return -1;
}
#endif


