forked from metin2/server
Removed country blocking (and exceptions)
This commit is contained in:
parent
42079d56b7
commit
00c5634c09
@ -129,8 +129,6 @@ enum
|
||||
HEADER_GD_DEC_MONARCH_MONEY = 125,
|
||||
|
||||
HEADER_GD_CHANGE_MONARCH_LORD = 126,
|
||||
HEADER_GD_BLOCK_COUNTRY_IP = 127, // 광대역 IP-Block
|
||||
HEADER_GD_BLOCK_EXCEPTION = 128, // 광대역 IP-Block 예외
|
||||
|
||||
HEADER_GD_REQ_CHANGE_GUILD_MASTER = 129,
|
||||
|
||||
@ -272,8 +270,6 @@ enum
|
||||
|
||||
HEADER_DG_CHANGE_MONARCH_LORD_ACK = 169,
|
||||
HEADER_DG_UPDATE_MONARCH_INFO = 170,
|
||||
HEADER_DG_BLOCK_COUNTRY_IP = 171, // 광대역 IP-Block
|
||||
HEADER_DG_BLOCK_EXCEPTION = 172, // 광대역 IP-Block 예외 account
|
||||
|
||||
HEADER_DG_ACK_CHANGE_GUILD_MASTER = 173,
|
||||
|
||||
@ -1379,26 +1375,6 @@ typedef struct tChangeMonarchLordACK
|
||||
char szDate[32];
|
||||
} TPacketChangeMonarchLordACK;
|
||||
|
||||
// Block Country Ip
|
||||
typedef struct tBlockCountryIp
|
||||
{
|
||||
DWORD ip_from;
|
||||
DWORD ip_to;
|
||||
} TPacketBlockCountryIp;
|
||||
|
||||
enum EBlockExceptionCommand
|
||||
{
|
||||
BLOCK_EXCEPTION_CMD_ADD = 1,
|
||||
BLOCK_EXCEPTION_CMD_DEL = 2,
|
||||
};
|
||||
|
||||
// Block Exception Account
|
||||
typedef struct tBlockException
|
||||
{
|
||||
BYTE cmd; // 1 == add, 2 == delete
|
||||
char login[LOGIN_MAX_LEN + 1];
|
||||
}TPacketBlockException;
|
||||
|
||||
typedef struct tChangeGuildMaster
|
||||
{
|
||||
DWORD dwGuildID;
|
||||
|
@ -1,214 +0,0 @@
|
||||
// vim:ts=4 sw=4
|
||||
/*********************************************************************
|
||||
* date : 2007.05.31
|
||||
* file : BlockCountry.cpp
|
||||
* author : mhh
|
||||
* description :
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "BlockCountry.h"
|
||||
|
||||
#include "DBManager.h"
|
||||
|
||||
#define DO_ALL_BLOCK_IP(iter) \
|
||||
for ((iter) = m_block_ip.begin(); (iter) != m_block_ip.end(); ++(iter))
|
||||
|
||||
#define DO_ALL_BLOCK_EXCEPTION(iter) \
|
||||
for ((iter) = m_block_exception.begin(); (iter) != m_block_exception.end(); ++(iter))
|
||||
|
||||
CBlockCountry::CBlockCountry()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
CBlockCountry::~CBlockCountry()
|
||||
{
|
||||
BLOCK_IP *block_ip;
|
||||
BLOCK_IP_VECTOR::iterator iter;
|
||||
|
||||
DO_ALL_BLOCK_IP(iter)
|
||||
{
|
||||
block_ip = *iter;
|
||||
delete block_ip;
|
||||
}
|
||||
|
||||
m_block_ip.clear();
|
||||
}
|
||||
|
||||
|
||||
bool CBlockCountry::Load()
|
||||
{
|
||||
// load blocked ip
|
||||
{
|
||||
char szQuery[256];
|
||||
snprintf(szQuery, sizeof(szQuery), "SELECT IP_FROM, IP_TO, COUNTRY_NAME FROM iptocountry");
|
||||
SQLMsg * pMsg = CDBManager::instance().DirectQuery(szQuery, SQL_ACCOUNT);
|
||||
|
||||
if (pMsg->Get()->uiNumRows == 0)
|
||||
{
|
||||
SPDLOG_ERROR(" DirectQuery failed({})", szQuery);
|
||||
delete pMsg;
|
||||
return false;
|
||||
}
|
||||
|
||||
MYSQL_ROW row;
|
||||
for (int n = 0; (row = mysql_fetch_row(pMsg->Get()->pSQLResult)) != NULL; ++n)
|
||||
{
|
||||
BLOCK_IP *block_ip = new BLOCK_IP;
|
||||
block_ip->ip_from = strtoul(row[0], NULL, 10);
|
||||
block_ip->ip_to = strtoul(row[1], NULL, 10);
|
||||
strlcpy(block_ip->country, row[2], sizeof(block_ip->country));
|
||||
|
||||
m_block_ip.push_back(block_ip);
|
||||
SPDLOG_DEBUG("BLOCKED_IP : {} - {}", block_ip->ip_from, block_ip->ip_to);
|
||||
|
||||
}
|
||||
delete pMsg;
|
||||
}
|
||||
|
||||
|
||||
// load block exception account
|
||||
{
|
||||
char szQuery[256];
|
||||
snprintf(szQuery, sizeof(szQuery), "SELECT login FROM block_exception");
|
||||
SQLMsg * pMsg = CDBManager::instance().DirectQuery(szQuery, SQL_ACCOUNT);
|
||||
|
||||
if (pMsg->Get()->uiNumRows == 0)
|
||||
{
|
||||
SPDLOG_ERROR(" DirectQuery failed({})", szQuery);
|
||||
delete pMsg;
|
||||
return true;
|
||||
}
|
||||
|
||||
MYSQL_ROW row;
|
||||
for (int n = 0; (row = mysql_fetch_row(pMsg->Get()->pSQLResult)) != NULL; ++n)
|
||||
{
|
||||
const char *login = row[0];
|
||||
|
||||
m_block_exception.push_back(strdup(login));
|
||||
|
||||
SPDLOG_DEBUG("BLOCK_EXCEPTION = {}", login);
|
||||
|
||||
}
|
||||
delete pMsg;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CBlockCountry::IsBlockedCountryIp(const char *user_ip)
|
||||
{
|
||||
BLOCK_IP* block_ip;
|
||||
BLOCK_IP_VECTOR::iterator iter;
|
||||
struct in_addr st_addr;
|
||||
|
||||
#ifndef __WIN32__
|
||||
if (0 == inet_aton(user_ip, &st_addr))
|
||||
#else
|
||||
unsigned int in_address;
|
||||
in_address = inet_addr(user_ip);
|
||||
st_addr.s_addr = in_address;
|
||||
if (INADDR_NONE == in_address)
|
||||
#endif
|
||||
return true; // 아이피가 괴상하니 일단 블럭처리
|
||||
|
||||
DO_ALL_BLOCK_IP(iter)
|
||||
{
|
||||
block_ip = *iter;
|
||||
|
||||
if (st_addr.s_addr >= block_ip->ip_from && st_addr.s_addr <= block_ip->ip_to)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CBlockCountry::SendBlockedCountryIp(CPeer *peer)
|
||||
{
|
||||
SPDLOG_DEBUG("SendBlockedCountryIp start");
|
||||
BLOCK_IP *block_ip;
|
||||
BLOCK_IP_VECTOR::iterator iter;
|
||||
TPacketBlockCountryIp packet;
|
||||
|
||||
DO_ALL_BLOCK_IP(iter)
|
||||
{
|
||||
block_ip = *iter;
|
||||
|
||||
packet.ip_from = block_ip->ip_from;
|
||||
packet.ip_to = block_ip->ip_to;
|
||||
|
||||
peer->EncodeHeader(HEADER_DG_BLOCK_COUNTRY_IP, 0, sizeof(TPacketBlockCountryIp));
|
||||
peer->Encode(&packet, sizeof(packet));
|
||||
}
|
||||
|
||||
SPDLOG_DEBUG("[DONE] CBlockCountry::SendBlockedCountryIp() : count = {}",
|
||||
m_block_ip.size());
|
||||
SPDLOG_DEBUG("SendBlockedCountryIp end");
|
||||
} /* end of CBlockCountry::SendBlockedCountryIp() */
|
||||
|
||||
|
||||
void CBlockCountry::SendBlockException(CPeer *peer)
|
||||
{
|
||||
BLOCK_EXCEPTION_VECTOR::iterator iter;
|
||||
|
||||
DO_ALL_BLOCK_EXCEPTION(iter)
|
||||
{
|
||||
const char *login = *iter;
|
||||
|
||||
this->SendBlockExceptionOne(peer, login, BLOCK_EXCEPTION_CMD_ADD);
|
||||
}
|
||||
} /* end of CBlockCountry::SendBlockException() */
|
||||
|
||||
void CBlockCountry::SendBlockExceptionOne(CPeer *peer, const char *login, BYTE cmd)
|
||||
{
|
||||
if (NULL == peer || NULL == login)
|
||||
return;
|
||||
|
||||
if (BLOCK_EXCEPTION_CMD_ADD != cmd && BLOCK_EXCEPTION_CMD_DEL != cmd)
|
||||
return;
|
||||
|
||||
TPacketBlockException packet;
|
||||
|
||||
packet.cmd = cmd;
|
||||
strlcpy(packet.login, login, sizeof(packet.login));
|
||||
|
||||
peer->EncodeHeader(HEADER_DG_BLOCK_EXCEPTION, 0, sizeof(TPacketBlockException));
|
||||
peer->Encode(&packet, sizeof(packet));
|
||||
}
|
||||
|
||||
void CBlockCountry::AddBlockException(const char *login)
|
||||
{
|
||||
BLOCK_EXCEPTION_VECTOR::iterator iter;
|
||||
DO_ALL_BLOCK_EXCEPTION(iter)
|
||||
{
|
||||
const char *saved_login = *iter;
|
||||
|
||||
if (!strcmp(saved_login, login))
|
||||
return;
|
||||
}
|
||||
|
||||
m_block_exception.push_back(strdup(login));
|
||||
return;
|
||||
}
|
||||
|
||||
void CBlockCountry::DelBlockException(const char *login)
|
||||
{
|
||||
BLOCK_EXCEPTION_VECTOR::iterator iter;
|
||||
DO_ALL_BLOCK_EXCEPTION(iter)
|
||||
{
|
||||
const char *saved_login = *iter;
|
||||
|
||||
if (!strcmp(saved_login, login))
|
||||
{
|
||||
::free((void*)saved_login);
|
||||
m_block_exception.erase(iter);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1,44 +0,0 @@
|
||||
// vim: ts=4 sw=4
|
||||
// Date : 2007.05.31
|
||||
// File : BlockCountry.h
|
||||
// Author : mhh
|
||||
// Description :
|
||||
|
||||
#ifndef __INC_METIN_II_BLOCKCOUNTRY_H__
|
||||
#define __INC_METIN_II_BLOCKCOUNTRY_H__
|
||||
|
||||
#include "Peer.h"
|
||||
|
||||
#define MAX_COUNTRY_NAME_LENGTH 50
|
||||
|
||||
class CBlockCountry : public singleton<CBlockCountry>
|
||||
{
|
||||
private:
|
||||
struct BLOCK_IP
|
||||
{
|
||||
DWORD ip_from;
|
||||
DWORD ip_to;
|
||||
char country[MAX_COUNTRY_NAME_LENGTH + 1];
|
||||
};
|
||||
|
||||
typedef std::vector<BLOCK_IP*> BLOCK_IP_VECTOR;
|
||||
BLOCK_IP_VECTOR m_block_ip;
|
||||
|
||||
typedef std::vector<const char*> BLOCK_EXCEPTION_VECTOR;
|
||||
BLOCK_EXCEPTION_VECTOR m_block_exception;
|
||||
|
||||
public:
|
||||
CBlockCountry();
|
||||
~CBlockCountry();
|
||||
|
||||
public:
|
||||
bool Load();
|
||||
bool IsBlockedCountryIp(const char *user_ip);
|
||||
void SendBlockedCountryIp(CPeer *peer);
|
||||
void SendBlockException(CPeer *peer);
|
||||
void SendBlockExceptionOne(CPeer *peer, const char *login, BYTE cmd);
|
||||
void AddBlockException(const char *login);
|
||||
void DelBlockException(const char *login);
|
||||
};
|
||||
|
||||
#endif
|
@ -17,7 +17,6 @@
|
||||
#include "ItemAwardManager.h"
|
||||
#include "Marriage.h"
|
||||
#include "Monarch.h"
|
||||
#include "BlockCountry.h"
|
||||
#include "ItemIDRangeManager.h"
|
||||
#include "Cache.h"
|
||||
#ifdef __AUCTION__
|
||||
@ -2672,17 +2671,6 @@ void CClientManager::ProcessPackets(CPeer * peer)
|
||||
ChangeMonarchLord(peer, dwHandle, (TPacketChangeMonarchLord*)data);
|
||||
break;
|
||||
|
||||
case HEADER_GD_BLOCK_COUNTRY_IP:
|
||||
SPDLOG_DEBUG("HEADER_GD_BLOCK_COUNTRY_IP received");
|
||||
CBlockCountry::instance().SendBlockedCountryIp(peer);
|
||||
CBlockCountry::instance().SendBlockException(peer);
|
||||
break;
|
||||
|
||||
case HEADER_GD_BLOCK_EXCEPTION:
|
||||
SPDLOG_DEBUG("HEADER_GD_BLOCK_EXCEPTION received");
|
||||
BlockException((TPacketBlockException*) data);
|
||||
break;
|
||||
|
||||
case HEADER_GD_REQ_SPARE_ITEM_ID_RANGE :
|
||||
SendSpareItemIDRange(peer);
|
||||
break;
|
||||
@ -4190,43 +4178,6 @@ void CClientManager::ChangeMonarchLord(CPeer * peer, DWORD dwHandle, TPacketChan
|
||||
delete pMsg;
|
||||
}
|
||||
|
||||
void CClientManager::BlockException(TPacketBlockException *data)
|
||||
{
|
||||
SPDLOG_DEBUG("[BLOCK_EXCEPTION] CMD({}) login({})", data->cmd, data->login);
|
||||
|
||||
// save sql
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
switch (data->cmd)
|
||||
{
|
||||
case BLOCK_EXCEPTION_CMD_ADD:
|
||||
snprintf(buf, sizeof(buf), "INSERT INTO block_exception VALUES('%s')", data->login);
|
||||
CDBManager::instance().AsyncQuery(buf, SQL_ACCOUNT);
|
||||
CBlockCountry::instance().AddBlockException(data->login);
|
||||
break;
|
||||
case BLOCK_EXCEPTION_CMD_DEL:
|
||||
snprintf(buf, sizeof(buf), "DELETE FROM block_exception VALUES('%s')", data->login);
|
||||
CDBManager::instance().AsyncQuery(buf, SQL_ACCOUNT);
|
||||
CBlockCountry::instance().DelBlockException(data->login);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (itertype(m_peerList) it = m_peerList.begin(); it != m_peerList.end(); ++it)
|
||||
{
|
||||
CPeer *peer = *it;
|
||||
|
||||
if (!peer->GetChannel())
|
||||
continue;
|
||||
|
||||
CBlockCountry::instance().SendBlockExceptionOne(peer, data->login, data->cmd);
|
||||
}
|
||||
}
|
||||
|
||||
void CClientManager::SendSpareItemIDRange(CPeer* peer)
|
||||
{
|
||||
peer->SendSpareItemIDRange();
|
||||
|
@ -545,7 +545,6 @@ class CClientManager : public singleton<CClientManager>
|
||||
//END_MONARCH
|
||||
|
||||
void ChangeMonarchLord(CPeer* peer, DWORD dwHandle, TPacketChangeMonarchLord* info);
|
||||
void BlockException(TPacketBlockException *data);
|
||||
|
||||
void SendSpareItemIDRange(CPeer* peer);
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "MoneyLog.h"
|
||||
#include "Marriage.h"
|
||||
#include "Monarch.h"
|
||||
#include "BlockCountry.h"
|
||||
#include "ItemIDRangeManager.h"
|
||||
#include <version.h>
|
||||
#ifdef __AUCTION__
|
||||
@ -74,7 +73,6 @@ int main()
|
||||
ItemAwardManager ItemAwardManager;
|
||||
marriage::CManager MarriageManager;
|
||||
CMonarch Monarch;
|
||||
CBlockCountry BlockCountry;
|
||||
CItemIDRangeManager ItemIDRangeManager;
|
||||
#ifdef __AUCTION__
|
||||
AuctionManager auctionManager;
|
||||
@ -84,7 +82,6 @@ int main()
|
||||
|
||||
GuildManager.Initialize();
|
||||
MarriageManager.Initialize();
|
||||
BlockCountry.Load();
|
||||
ItemIDRangeManager.Build();
|
||||
#ifdef __AUCTION__
|
||||
AuctionManager::instance().Initialize();
|
||||
|
@ -1,150 +0,0 @@
|
||||
/*********************************************************************
|
||||
* date : 2007.05.31
|
||||
* file : block_country.cpp
|
||||
* author : mhh
|
||||
* description :
|
||||
*/
|
||||
|
||||
#define _block_country_cpp_
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "constants.h"
|
||||
#include "block_country.h"
|
||||
|
||||
#define DEC_ITER(iter) std::vector<T_BLOCK_IP*>::iterator iter
|
||||
#define DO_ALL_BLOCKED_IP(iter) for ((iter)=s_blocked_ip.begin(); (iter)!=s_blocked_ip.end(); ++(iter))
|
||||
|
||||
#define DEC_EXCEPTION_ITER(iter) std::set<std::string>::iterator iter
|
||||
|
||||
|
||||
typedef struct {
|
||||
DWORD ip_from;
|
||||
DWORD ip_to;
|
||||
} T_BLOCK_IP;
|
||||
|
||||
//--------------------------------------
|
||||
// static variables
|
||||
std::vector<T_BLOCK_IP*> s_blocked_ip;
|
||||
std::set<std::string> s_block_exception;
|
||||
// static variables
|
||||
//--------------------------------------
|
||||
|
||||
|
||||
|
||||
//--------------------------------------
|
||||
// static functions
|
||||
static void __add_block_exception(const char *login)
|
||||
{
|
||||
SPDLOG_TRACE("BLOCK_EXCEPTION_ADD : {}", login);
|
||||
|
||||
DEC_EXCEPTION_ITER(iter);
|
||||
std::string string_login(login);
|
||||
|
||||
iter = s_block_exception.find(string_login);
|
||||
|
||||
// can not find
|
||||
if (iter==s_block_exception.end())
|
||||
{
|
||||
s_block_exception.insert(string_login);
|
||||
}
|
||||
}
|
||||
|
||||
static void __del_block_exception(const char *login)
|
||||
{
|
||||
SPDLOG_TRACE("BLOCK_EXCEPTION_DEL : {}", login);
|
||||
|
||||
DEC_EXCEPTION_ITER(iter);
|
||||
std::string string_login(login);
|
||||
|
||||
iter = s_block_exception.find(string_login);
|
||||
|
||||
// ok : find
|
||||
if (iter!=s_block_exception.end())
|
||||
{
|
||||
s_block_exception.erase(iter);
|
||||
}
|
||||
}
|
||||
// static functions
|
||||
//--------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
void add_blocked_country_ip(TPacketBlockCountryIp *data)
|
||||
{
|
||||
T_BLOCK_IP *block_ip = M2_NEW T_BLOCK_IP;
|
||||
|
||||
block_ip->ip_from = data->ip_from;
|
||||
block_ip->ip_to = data->ip_to;
|
||||
|
||||
s_blocked_ip.push_back(block_ip);
|
||||
|
||||
SPDLOG_TRACE("BLOCKED_IP = {} - {}", block_ip->ip_from, block_ip->ip_to);
|
||||
}
|
||||
|
||||
|
||||
void block_exception(TPacketBlockException *data)
|
||||
{
|
||||
if (NULL==data) return;
|
||||
|
||||
if (BLOCK_EXCEPTION_CMD_ADD!=data->cmd && BLOCK_EXCEPTION_CMD_DEL!=data->cmd)
|
||||
return;
|
||||
|
||||
|
||||
switch (data->cmd)
|
||||
{
|
||||
case BLOCK_EXCEPTION_CMD_ADD:
|
||||
__add_block_exception(data->login);
|
||||
break;
|
||||
case BLOCK_EXCEPTION_CMD_DEL:
|
||||
__del_block_exception(data->login);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_blocked_country_ip(const char *user_ip)
|
||||
{
|
||||
DEC_ITER(iter);
|
||||
T_BLOCK_IP *block_ip;
|
||||
DWORD ip_number;
|
||||
struct in_addr st_addr;
|
||||
|
||||
#ifndef __WIN32__
|
||||
if (0 == inet_aton(user_ip, &st_addr))
|
||||
#else
|
||||
unsigned int in_address;
|
||||
in_address = inet_addr(user_ip);
|
||||
st_addr.s_addr = in_address;
|
||||
if (INADDR_NONE == in_address)
|
||||
#endif
|
||||
{
|
||||
SPDLOG_INFO("BLOCKED_COUNTRY_IP ({}) : YES", user_ip);
|
||||
return true; // 아이피가 괴상하니 일단 블럭처리
|
||||
}
|
||||
ip_number = htonl(st_addr.s_addr);
|
||||
|
||||
DO_ALL_BLOCKED_IP(iter)
|
||||
{
|
||||
block_ip = *iter;
|
||||
if ( block_ip->ip_from <= ip_number && ip_number <= block_ip->ip_to )
|
||||
{
|
||||
SPDLOG_INFO("BLOCKED_COUNTRY_IP ({}) : YES", user_ip);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
SPDLOG_DEBUG("BLOCKED_COUNTRY_IP ({}) : NO", user_ip);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_block_exception(const char *login)
|
||||
{
|
||||
std::string login_string(login);
|
||||
std::set<std::string>::iterator iter;
|
||||
|
||||
iter = s_block_exception.find(login_string);
|
||||
if (iter != s_block_exception.end())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
/*********************************************************************
|
||||
* date : 2007.05.31
|
||||
* file : block_country.h
|
||||
* author : mhh
|
||||
* description :
|
||||
*/
|
||||
|
||||
#ifndef _block_country_h_
|
||||
#define _block_country_h_
|
||||
|
||||
|
||||
void add_blocked_country_ip(TPacketBlockCountryIp *data);
|
||||
void block_exception(TPacketBlockException *data);
|
||||
bool is_blocked_country_ip(const char *user_ip);
|
||||
bool is_block_exception(const char *login);
|
||||
|
||||
#endif // _block_country_h_
|
||||
|
@ -1198,15 +1198,6 @@ void DBManager::StopAllBilling()
|
||||
}
|
||||
}
|
||||
|
||||
void DBManager::RequestBlockException(const char *login, int cmd)
|
||||
{
|
||||
TPacketBlockException packet;
|
||||
|
||||
packet.cmd = cmd;
|
||||
strlcpy(packet.login, login, sizeof(packet.login));
|
||||
db_clientdesc->DBPacket(HEADER_GD_BLOCK_EXCEPTION, 0, &packet, sizeof(packet));
|
||||
}
|
||||
|
||||
size_t DBManager::EscapeString(char* dst, size_t dstSize, const char *src, size_t srcSize)
|
||||
{
|
||||
return m_sql_direct.EscapeString(dst, dstSize, src, srcSize);
|
||||
|
@ -111,10 +111,6 @@ class DBManager : public singleton<DBManager>
|
||||
DWORD CountQueryResult() { return m_sql.CountResult(); }
|
||||
void ResetQueryResult() { m_sql.ResetQueryFinished(); }
|
||||
|
||||
// BLOCK EXCEPTION
|
||||
void RequestBlockException(const char *login, int cmd);
|
||||
// BLOCK EXCEPTION
|
||||
|
||||
void LoadDBString();
|
||||
const std::string & GetDBString(const std::string& key);
|
||||
const std::vector<std::string> & GetGreetMessage();
|
||||
|
@ -543,20 +543,6 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!stBuf.compare(0, 15, "BLOCK_EXCEPTION"))
|
||||
{
|
||||
// BLOCK_EXCEPTION cmd(add=1, del=2) login
|
||||
std::istringstream is(stBuf);
|
||||
std::string dummy_string;
|
||||
std::string login_string;
|
||||
int cmd;
|
||||
|
||||
is >> dummy_string >> cmd >> login_string;
|
||||
|
||||
SPDLOG_DEBUG("block_exception {}:{}", login_string.c_str(), cmd);
|
||||
DBManager::instance().RequestBlockException(login_string.c_str(), cmd);
|
||||
stResult = "BLOCK_EXCEPTION_YES";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,8 +268,6 @@ protected:
|
||||
|
||||
void ChangeMonarchLord(TPacketChangeMonarchLordACK* data);
|
||||
void UpdateMonarchInfo(TMonarchInfo* data);
|
||||
void AddBlockCountryIp(TPacketBlockCountryIp * data);
|
||||
void BlockException(TPacketBlockException * data);
|
||||
|
||||
// MYSHOP_PRICE_LIST
|
||||
/// 아이템 가격정보 리스트 요청에 대한 응답 패킷(HEADER_DG_MYSHOP_PRICELIST_RES) 처리함수
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "monarch.h"
|
||||
#include "affect.h"
|
||||
#include "castle.h"
|
||||
#include "block_country.h"
|
||||
#include "motion.h"
|
||||
|
||||
|
||||
@ -1002,12 +1001,6 @@ void CInputDB::Boot(const char* data)
|
||||
|
||||
// castle_boot
|
||||
castle_boot();
|
||||
|
||||
// request blocked_country_ip
|
||||
{
|
||||
db_clientdesc->DBPacket(HEADER_GD_BLOCK_COUNTRY_IP, 0, NULL, 0);
|
||||
SPDLOG_TRACE("<sent HEADER_GD_BLOCK_COUNTRY_IP>");
|
||||
}
|
||||
}
|
||||
|
||||
EVENTINFO(quest_login_event_info)
|
||||
@ -2426,13 +2419,6 @@ int CInputDB::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
||||
UpdateMonarchInfo((TMonarchInfo*)c_pData);
|
||||
break;
|
||||
|
||||
case HEADER_DG_BLOCK_COUNTRY_IP:
|
||||
this->AddBlockCountryIp((TPacketBlockCountryIp *) c_pData);
|
||||
break;
|
||||
case HEADER_DG_BLOCK_EXCEPTION:
|
||||
this->BlockException((TPacketBlockException *) c_pData);
|
||||
break;
|
||||
|
||||
case HEADER_DG_ACK_CHANGE_GUILD_MASTER :
|
||||
this->GuildChangeMaster((TPacketChangeGuildMaster*) c_pData);
|
||||
break;
|
||||
@ -2588,16 +2574,6 @@ void CInputDB::UpdateMonarchInfo(TMonarchInfo* info)
|
||||
SPDLOG_INFO("MONARCH INFO UPDATED");
|
||||
}
|
||||
|
||||
void CInputDB::AddBlockCountryIp(TPacketBlockCountryIp * data)
|
||||
{
|
||||
add_blocked_country_ip(data);
|
||||
}
|
||||
|
||||
void CInputDB::BlockException(TPacketBlockException *data)
|
||||
{
|
||||
block_exception(data);
|
||||
}
|
||||
|
||||
void CInputDB::GuildChangeMaster(TPacketChangeGuildMaster* p)
|
||||
{
|
||||
CGuildManager::instance().ChangeMaster(p->dwGuildID);
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "arena.h"
|
||||
#include "OXEvent.h"
|
||||
#include "priv_manager.h"
|
||||
#include "block_country.h"
|
||||
#include "log.h"
|
||||
#include "horsename_manager.h"
|
||||
#include "MarkManager.h"
|
||||
@ -140,20 +139,6 @@ void CInputLogin::LoginByKey(LPDESC d, const char * data)
|
||||
char login[LOGIN_MAX_LEN + 1];
|
||||
trim_and_lower(pinfo->login, login, sizeof(login));
|
||||
|
||||
// is blocked ip?
|
||||
{
|
||||
SPDLOG_TRACE("check_blocked_country_start");
|
||||
|
||||
if (!is_block_exception(login) && is_blocked_country_ip(d->GetHostName()))
|
||||
{
|
||||
SPDLOG_DEBUG("BLOCK_COUNTRY_IP ({})", d->GetHostName());
|
||||
d->SetPhase(PHASE_CLOSE);
|
||||
return;
|
||||
}
|
||||
|
||||
SPDLOG_TRACE("check_blocked_country_end");
|
||||
}
|
||||
|
||||
if (g_bNoMoreClient)
|
||||
{
|
||||
TPacketGCLoginFailure failurePacket;
|
||||
|
@ -303,7 +303,6 @@ enum
|
||||
HEADER_GG_CHECK_CLIENT_VERSION = 21,
|
||||
HEADER_GG_BLOCK_CHAT = 22,
|
||||
|
||||
HEADER_GG_BLOCK_EXCEPTION = 24,
|
||||
HEADER_GG_SIEGE = 25,
|
||||
HEADER_GG_MONARCH_NOTICE = 26,
|
||||
HEADER_GG_MONARCH_TRANSFER = 27,
|
||||
|
Loading…
Reference in New Issue
Block a user