removed ponintless ENABLE_PORT_SECURITY define & reorganized config loading
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#ifndef __INC_METIN_II_LENGTH_H__
|
||||
#define __INC_METIN_II_LENGTH_H__
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
#define WORD_MAX 0xffff
|
||||
enum EMisc
|
||||
@@ -708,15 +708,15 @@ enum EMisc2
|
||||
|
||||
typedef struct SItemPos
|
||||
{
|
||||
BYTE window_type;
|
||||
WORD cell;
|
||||
uint8_t window_type;
|
||||
uint16_t cell;
|
||||
SItemPos ()
|
||||
{
|
||||
window_type = INVENTORY;
|
||||
cell = WORD_MAX;
|
||||
}
|
||||
|
||||
SItemPos (BYTE _window_type, WORD _cell)
|
||||
SItemPos (uint8_t _window_type, WORD _cell)
|
||||
{
|
||||
window_type = _window_type;
|
||||
cell = _cell;
|
||||
@@ -792,5 +792,3 @@ typedef enum
|
||||
} EShopCoinType;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#define ENABLE_AUTODETECT_INTERNAL_IP
|
||||
#define ENABLE_PROXY_IP
|
||||
#define ENABLE_PORT_SECURITY
|
||||
#define _IMPROVED_PACKET_ENCRYPTION_ // 패킷 암호화 개선
|
||||
//#define __AUCTION__
|
||||
#define __PET_SYSTEM__
|
||||
|
||||
@@ -11,8 +11,8 @@ template <typename T> class singleton
|
||||
singleton()
|
||||
{
|
||||
assert(!ms_singleton);
|
||||
long offset = (long) (T*) 1 - (long) (singleton <T>*) (T*) 1;
|
||||
ms_singleton = (T*) ((long) this + offset);
|
||||
intptr_t offset = (intptr_t) (T*) 1 - (intptr_t) (singleton <T>*) (T*) 1;
|
||||
ms_singleton = (T*) ((intptr_t) this + offset);
|
||||
}
|
||||
|
||||
virtual ~singleton()
|
||||
|
||||
@@ -146,7 +146,7 @@ bool CClientManager::Initialize()
|
||||
|
||||
if (!CConfig::instance().GetValue("PLAYER_DELETE_LEVEL_LIMIT", &m_iPlayerDeleteLevelLimit))
|
||||
{
|
||||
sys_err("conf.txt: Cannot find PLAYER_DELETE_LEVEL_LIMIT, use default level %d", PLAYER_MAX_LEVEL_CONST + 1);
|
||||
sys_err("conf/db.txt: Cannot find PLAYER_DELETE_LEVEL_LIMIT, use default level %d", PLAYER_MAX_LEVEL_CONST + 1);
|
||||
m_iPlayerDeleteLevelLimit = PLAYER_MAX_LEVEL_CONST + 1;
|
||||
}
|
||||
|
||||
@@ -3324,7 +3324,7 @@ bool CClientManager::InitializeNowItemID()
|
||||
//아이템 ID를 초기화 한다.
|
||||
if (!CConfig::instance().GetTwoValue("ITEM_ID_RANGE", &dwMin, &dwMax))
|
||||
{
|
||||
sys_err("conf.txt: Cannot find ITEM_ID_RANGE [start_item_id] [end_item_id]");
|
||||
sys_err("conf/db.txt: Cannot find ITEM_ID_RANGE [start_item_id] [end_item_id]");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -202,9 +202,9 @@ bool CClientManager::InitializeMobTable()
|
||||
bool isNameFile = true;
|
||||
//<파일 읽기>
|
||||
cCsvTable nameData;
|
||||
if(!nameData.Load("mob_names.txt",'\t'))
|
||||
if(!nameData.Load("conf/mob_names.txt",'\t'))
|
||||
{
|
||||
fprintf(stderr, "mob_names.txt 파일을 읽어오지 못했습니다\n");
|
||||
fprintf(stderr, "conf/mob_names.txt 파일을 읽어오지 못했습니다\n");
|
||||
isNameFile = false;
|
||||
} else {
|
||||
nameData.Next(); //설명row 생략.
|
||||
@@ -264,8 +264,8 @@ bool CClientManager::InitializeMobTable()
|
||||
|
||||
//1. 파일 읽기.
|
||||
cCsvTable data;
|
||||
if(!data.Load("mob_proto.txt",'\t')) {
|
||||
fprintf(stderr, "mob_proto.txt 파일을 읽어오지 못했습니다\n");
|
||||
if(!data.Load("conf/mob_proto.txt",'\t')) {
|
||||
fprintf(stderr, "conf/mob_proto.txt 파일을 읽어오지 못했습니다\n");
|
||||
return false;
|
||||
}
|
||||
data.Next(); //설명 row 넘어가기
|
||||
@@ -282,9 +282,9 @@ bool CClientManager::InitializeMobTable()
|
||||
}
|
||||
//data를 다시 첫줄로 옮긴다.(다시 읽어온다;;)
|
||||
data.Destroy();
|
||||
if(!data.Load("mob_proto.txt",'\t'))
|
||||
if(!data.Load("conf/mob_proto.txt",'\t'))
|
||||
{
|
||||
fprintf(stderr, "mob_proto.txt 파일을 읽어오지 못했습니다\n");
|
||||
fprintf(stderr, "conf/mob_proto.txt 파일을 읽어오지 못했습니다\n");
|
||||
return false;
|
||||
}
|
||||
data.Next(); //맨 윗줄 제외 (아이템 칼럼을 설명하는 부분)
|
||||
@@ -602,9 +602,9 @@ bool CClientManager::InitializeItemTable()
|
||||
bool isNameFile = true;
|
||||
map<int,const char*> localMap;
|
||||
cCsvTable nameData;
|
||||
if(!nameData.Load("item_names.txt",'\t'))
|
||||
if(!nameData.Load("conf/item_names.txt",'\t'))
|
||||
{
|
||||
fprintf(stderr, "item_names.txt 파일을 읽어오지 못했습니다\n");
|
||||
fprintf(stderr, "conf/item_names.txt 파일을 읽어오지 못했습니다\n");
|
||||
isNameFile = false;
|
||||
} else {
|
||||
nameData.Next();
|
||||
@@ -665,9 +665,9 @@ bool CClientManager::InitializeItemTable()
|
||||
|
||||
//파일 읽어오기.
|
||||
cCsvTable data;
|
||||
if(!data.Load("item_proto.txt",'\t'))
|
||||
if(!data.Load("conf/item_proto.txt",'\t'))
|
||||
{
|
||||
fprintf(stderr, "item_proto.txt 파일을 읽어오지 못했습니다\n");
|
||||
fprintf(stderr, "conf/item_proto.txt 파일을 읽어오지 못했습니다\n");
|
||||
return false;
|
||||
}
|
||||
data.Next(); //맨 윗줄 제외 (아이템 칼럼을 설명하는 부분)
|
||||
@@ -692,9 +692,9 @@ bool CClientManager::InitializeItemTable()
|
||||
}
|
||||
//data를 다시 첫줄로 옮긴다.(다시 읽어온다;;)
|
||||
data.Destroy();
|
||||
if(!data.Load("item_proto.txt",'\t'))
|
||||
if(!data.Load("conf/item_proto.txt",'\t'))
|
||||
{
|
||||
fprintf(stderr, "item_proto.txt 파일을 읽어오지 못했습니다\n");
|
||||
fprintf(stderr, "conf/item_proto.txt 파일을 읽어오지 못했습니다\n");
|
||||
return false;
|
||||
}
|
||||
data.Next(); //맨 윗줄 제외 (아이템 칼럼을 설명하는 부분)
|
||||
|
||||
@@ -128,7 +128,7 @@ bool CConfig::LoadFile(const char* filename)
|
||||
|
||||
case 2:
|
||||
mode = 0;
|
||||
m_valueMap.insert(TValueMap::value_type(comment, szTmp));
|
||||
m_valueMap.insert(std::make_pair(comment, szTmp));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -133,9 +133,9 @@ void emptybeat(LPHEART heart, int pulse)
|
||||
//
|
||||
int Start()
|
||||
{
|
||||
if (!CConfig::instance().LoadFile("conf.txt"))
|
||||
if (!CConfig::instance().LoadFile("conf/db.txt"))
|
||||
{
|
||||
fprintf(stderr, "Loading conf.txt failed.\n");
|
||||
fprintf(stderr, "Loading conf/db.txt failed.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,16 +46,7 @@ bool CPeerBase::Accept(socket_t fd_accept)
|
||||
{
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
#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, "PORT_SECURITY: BLOCK CONNECTION FROM %s", inet_ntoa(peer.sin_addr));
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
//socket_block(m_fd);
|
||||
socket_sndbuf(m_fd, 233016);
|
||||
|
||||
@@ -400,21 +400,85 @@ void config_init(const string& st_localeServiceName)
|
||||
bool isCommonSQL = false;
|
||||
bool isPlayerSQL = false;
|
||||
|
||||
FILE* fpOnlyForDB;
|
||||
|
||||
if (!(fpOnlyForDB = fopen(st_configFileName.c_str(), "r")))
|
||||
FILE* fp_common;
|
||||
if (!(fp_common = fopen("conf/game.txt", "r")))
|
||||
{
|
||||
fprintf(stderr, "Can not open [%s]\n", st_configFileName.c_str());
|
||||
fprintf(stderr, "Can not open [conf/game.txt]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while (fgets(buf, 256, fpOnlyForDB))
|
||||
{
|
||||
while (fgets(buf, 256, fp_common)) {
|
||||
parse_token(buf, token_string, value_string);
|
||||
|
||||
TOKEN("BLOCK_LOGIN")
|
||||
TOKEN("player_sql")
|
||||
{
|
||||
g_stBlockDate = value_string;
|
||||
const char* line = two_arguments(value_string, db_host[0], sizeof(db_host[0]), db_user[0], sizeof(db_user[0]));
|
||||
line = two_arguments(line, db_pwd[0], sizeof(db_pwd[0]), db_db[0], sizeof(db_db[0]));
|
||||
|
||||
if (line[0])
|
||||
{
|
||||
char buf[256];
|
||||
one_argument(line, buf, sizeof(buf));
|
||||
str_to_number(mysql_db_port[0], buf);
|
||||
}
|
||||
|
||||
if (!*db_host[0] || !*db_user[0] || !*db_pwd[0] || !*db_db[0])
|
||||
{
|
||||
fprintf(stderr, "PLAYER_SQL syntax: logsql <host user password db>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof(buf), "PLAYER_SQL: %s %s %s %s %d", db_host[0], db_user[0], db_pwd[0], db_db[0], mysql_db_port[0]);
|
||||
isPlayerSQL = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("common_sql")
|
||||
{
|
||||
const char* line = two_arguments(value_string, db_host[1], sizeof(db_host[1]), db_user[1], sizeof(db_user[1]));
|
||||
line = two_arguments(line, db_pwd[1], sizeof(db_pwd[1]), db_db[1], sizeof(db_db[1]));
|
||||
|
||||
if (line[0])
|
||||
{
|
||||
char buf[256];
|
||||
one_argument(line, buf, sizeof(buf));
|
||||
str_to_number(mysql_db_port[1], buf);
|
||||
}
|
||||
|
||||
if (!*db_host[1] || !*db_user[1] || !*db_pwd[1] || !*db_db[1])
|
||||
{
|
||||
fprintf(stderr, "COMMON_SQL syntax: logsql <host user password db>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof(buf), "COMMON_SQL: %s %s %s %s %d", db_host[1], db_user[1], db_pwd[1], db_db[1], mysql_db_port[1]);
|
||||
isCommonSQL = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("log_sql")
|
||||
{
|
||||
const char* line = two_arguments(value_string, log_host, sizeof(log_host), log_user, sizeof(log_user));
|
||||
line = two_arguments(line, log_pwd, sizeof(log_pwd), log_db, sizeof(log_db));
|
||||
|
||||
if (line[0])
|
||||
{
|
||||
char buf[256];
|
||||
one_argument(line, buf, sizeof(buf));
|
||||
str_to_number(log_port, buf);
|
||||
}
|
||||
|
||||
if (!*log_host || !*log_user || !*log_pwd || !*log_db)
|
||||
{
|
||||
fprintf(stderr, "LOG_SQL syntax: logsql <host user password db>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof(buf), "LOG_SQL: %s %s %s %s %d", log_host, log_user, log_pwd, log_db, log_port);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("adminpage_ip")
|
||||
@@ -446,95 +510,10 @@ void config_init(const string& st_localeServiceName)
|
||||
g_stAdminPagePassword = value_string;
|
||||
}
|
||||
|
||||
TOKEN("hostname")
|
||||
{
|
||||
g_stHostname = value_string;
|
||||
fprintf(stdout, "HOSTNAME: %s\n", g_stHostname.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("channel")
|
||||
{
|
||||
str_to_number(g_bChannel, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("player_sql")
|
||||
{
|
||||
const char * line = two_arguments(value_string, db_host[0], sizeof(db_host[0]), db_user[0], sizeof(db_user[0]));
|
||||
line = two_arguments(line, db_pwd[0], sizeof(db_pwd[0]), db_db[0], sizeof(db_db[0]));
|
||||
|
||||
if (line[0])
|
||||
{
|
||||
char buf[256];
|
||||
one_argument(line, buf, sizeof(buf));
|
||||
str_to_number(mysql_db_port[0], buf);
|
||||
}
|
||||
|
||||
if (!*db_host[0] || !*db_user[0] || !*db_pwd[0] || !*db_db[0])
|
||||
{
|
||||
fprintf(stderr, "PLAYER_SQL syntax: logsql <host user password db>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof(buf), "PLAYER_SQL: %s %s %s %s %d", db_host[0], db_user[0], db_pwd[0], db_db[0], mysql_db_port[0]);
|
||||
isPlayerSQL = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("common_sql")
|
||||
{
|
||||
const char * line = two_arguments(value_string, db_host[1], sizeof(db_host[1]), db_user[1], sizeof(db_user[1]));
|
||||
line = two_arguments(line, db_pwd[1], sizeof(db_pwd[1]), db_db[1], sizeof(db_db[1]));
|
||||
|
||||
if (line[0])
|
||||
{
|
||||
char buf[256];
|
||||
one_argument(line, buf, sizeof(buf));
|
||||
str_to_number(mysql_db_port[1], buf);
|
||||
}
|
||||
|
||||
if (!*db_host[1] || !*db_user[1] || !*db_pwd[1] || !*db_db[1])
|
||||
{
|
||||
fprintf(stderr, "COMMON_SQL syntax: logsql <host user password db>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof(buf), "COMMON_SQL: %s %s %s %s %d", db_host[1], db_user[1], db_pwd[1], db_db[1], mysql_db_port[1]);
|
||||
isCommonSQL = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("log_sql")
|
||||
{
|
||||
const char * line = two_arguments(value_string, log_host, sizeof(log_host), log_user, sizeof(log_user));
|
||||
line = two_arguments(line, log_pwd, sizeof(log_pwd), log_db, sizeof(log_db));
|
||||
|
||||
if (line[0])
|
||||
{
|
||||
char buf[256];
|
||||
one_argument(line, buf, sizeof(buf));
|
||||
str_to_number(log_port, buf);
|
||||
}
|
||||
|
||||
if (!*log_host || !*log_user || !*log_pwd || !*log_db)
|
||||
{
|
||||
fprintf(stderr, "LOG_SQL syntax: logsql <host user password db>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof(buf), "LOG_SQL: %s %s %s %s %d", log_host, log_user, log_pwd, log_db, log_port);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//OPENID
|
||||
TOKEN("WEB_AUTH")
|
||||
{
|
||||
const char * line = two_arguments(value_string, openid_host, sizeof(openid_host), openid_uri, sizeof(openid_uri));
|
||||
const char* line = two_arguments(value_string, openid_host, sizeof(openid_host), openid_uri, sizeof(openid_uri));
|
||||
|
||||
if (!*openid_host || !*openid_uri)
|
||||
{
|
||||
@@ -547,6 +526,346 @@ void config_init(const string& st_localeServiceName)
|
||||
snprintf(buf, sizeof(buf), "WEB_AUTH: %s %s", openid_host, openid_uri);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("empire_whisper")
|
||||
{
|
||||
bool b_value = 0;
|
||||
str_to_number(b_value, value_string);
|
||||
g_bEmpireWhisper = !!b_value;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("mark_server")
|
||||
{
|
||||
guild_mark_server = is_string_true(value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("mark_min_level")
|
||||
{
|
||||
str_to_number(guild_mark_min_level, value_string);
|
||||
guild_mark_min_level = MINMAX(0, guild_mark_min_level, GUILD_MAX_LEVEL);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("log_keep_days")
|
||||
{
|
||||
int i = 0;
|
||||
str_to_number(i, value_string);
|
||||
log_set_expiration_days(MINMAX(1, i, 90));
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("passes_per_sec")
|
||||
{
|
||||
str_to_number(passes_per_sec, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("db_port")
|
||||
{
|
||||
str_to_number(db_port, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("db_addr")
|
||||
{
|
||||
std::strncpy(db_addr, value_string, sizeof(db_addr));
|
||||
|
||||
for (int n = 0; n < ADDRESS_MAX_LEN; ++n)
|
||||
{
|
||||
if (db_addr[n] == ' ')
|
||||
db_addr[n] = '\0';
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("save_event_second_cycle")
|
||||
{
|
||||
int cycle = 0;
|
||||
str_to_number(cycle, value_string);
|
||||
save_event_second_cycle = cycle * passes_per_sec;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("ping_event_second_cycle")
|
||||
{
|
||||
int cycle = 0;
|
||||
str_to_number(cycle, value_string);
|
||||
ping_event_second_cycle = cycle * passes_per_sec;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("table_postfix")
|
||||
{
|
||||
g_table_postfix = value_string;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("test_server")
|
||||
{
|
||||
printf("-----------------------------------------------\n");
|
||||
printf("TEST_SERVER\n");
|
||||
printf("-----------------------------------------------\n");
|
||||
str_to_number(test_server, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("speed_server")
|
||||
{
|
||||
printf("-----------------------------------------------\n");
|
||||
printf("SPEED_SERVER\n");
|
||||
printf("-----------------------------------------------\n");
|
||||
str_to_number(speed_server, value_string);
|
||||
continue;
|
||||
}
|
||||
#ifdef __AUCTION__
|
||||
TOKEN("auction_server")
|
||||
{
|
||||
printf("-----------------------------------------------\n");
|
||||
printf("AUCTION_SERVER\n");
|
||||
printf("-----------------------------------------------\n");
|
||||
str_to_number(auction_server, value_string);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
TOKEN("distribution_test_server")
|
||||
{
|
||||
str_to_number(distribution_test_server, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("china_event_server")
|
||||
{
|
||||
str_to_number(china_event_server, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("shutdowned")
|
||||
{
|
||||
g_bNoMoreClient = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("no_regen")
|
||||
{
|
||||
g_bNoRegen = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("traffic_profile")
|
||||
{
|
||||
g_bTrafficProfileOn = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("no_wander")
|
||||
{
|
||||
no_wander = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("user_limit")
|
||||
{
|
||||
str_to_number(g_iUserLimit, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("skill_disable")
|
||||
{
|
||||
str_to_number(g_bSkillDisable, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("billing")
|
||||
{
|
||||
g_bBilling = true;
|
||||
}
|
||||
|
||||
TOKEN("quest_dir")
|
||||
{
|
||||
sys_log(0, "QUEST_DIR SETTING : %s", value_string);
|
||||
g_stQuestDir = value_string;
|
||||
}
|
||||
|
||||
TOKEN("quest_object_dir")
|
||||
{
|
||||
//g_stQuestObjectDir = value_string;
|
||||
std::istringstream is(value_string);
|
||||
sys_log(0, "QUEST_OBJECT_DIR SETTING : %s", value_string);
|
||||
string dir;
|
||||
while (!is.eof())
|
||||
{
|
||||
is >> dir;
|
||||
if (is.fail())
|
||||
break;
|
||||
g_setQuestObjectDir.insert(dir);
|
||||
sys_log(0, "QUEST_OBJECT_DIR INSERT : %s", dir.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
TOKEN("teen_addr")
|
||||
{
|
||||
std::strncpy(teen_addr, value_string, sizeof(teen_addr));
|
||||
|
||||
for (int n = 0; n < ADDRESS_MAX_LEN; ++n)
|
||||
{
|
||||
if (teen_addr[n] == ' ')
|
||||
teen_addr[n] = '\0';
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("teen_port")
|
||||
{
|
||||
str_to_number(teen_port, value_string);
|
||||
}
|
||||
|
||||
TOKEN("synchack_limit_count")
|
||||
{
|
||||
str_to_number(g_iSyncHackLimitCount, value_string);
|
||||
}
|
||||
|
||||
TOKEN("speedhack_limit_count")
|
||||
{
|
||||
str_to_number(SPEEDHACK_LIMIT_COUNT, value_string);
|
||||
}
|
||||
|
||||
TOKEN("speedhack_limit_bonus")
|
||||
{
|
||||
str_to_number(SPEEDHACK_LIMIT_BONUS, value_string);
|
||||
}
|
||||
|
||||
TOKEN("mall_url")
|
||||
{
|
||||
g_strWebMallURL = value_string;
|
||||
}
|
||||
|
||||
TOKEN("bind_ip")
|
||||
{
|
||||
std::strncpy(g_szPublicIP, value_string, sizeof(g_szPublicIP));
|
||||
}
|
||||
|
||||
TOKEN("view_range")
|
||||
{
|
||||
str_to_number(VIEW_RANGE, value_string);
|
||||
}
|
||||
|
||||
TOKEN("spam_block_duration")
|
||||
{
|
||||
str_to_number(g_uiSpamBlockDuration, value_string);
|
||||
}
|
||||
|
||||
TOKEN("spam_block_score")
|
||||
{
|
||||
str_to_number(g_uiSpamBlockScore, value_string);
|
||||
g_uiSpamBlockScore = MAX(1, g_uiSpamBlockScore);
|
||||
}
|
||||
|
||||
TOKEN("spam_block_reload_cycle")
|
||||
{
|
||||
str_to_number(g_uiSpamReloadCycle, value_string);
|
||||
g_uiSpamReloadCycle = MAX(60, g_uiSpamReloadCycle); // 최소 1분
|
||||
}
|
||||
|
||||
TOKEN("check_multihack")
|
||||
{
|
||||
str_to_number(g_bCheckMultiHack, value_string);
|
||||
}
|
||||
|
||||
TOKEN("spam_block_max_level")
|
||||
{
|
||||
str_to_number(g_iSpamBlockMaxLevel, value_string);
|
||||
}
|
||||
TOKEN("protect_normal_player")
|
||||
{
|
||||
str_to_number(g_protectNormalPlayer, value_string);
|
||||
}
|
||||
TOKEN("notice_battle_zone")
|
||||
{
|
||||
str_to_number(g_noticeBattleZone, value_string);
|
||||
}
|
||||
|
||||
TOKEN("pk_protect_level")
|
||||
{
|
||||
str_to_number(PK_PROTECT_LEVEL, value_string);
|
||||
fprintf(stderr, "PK_PROTECT_LEVEL: %d", PK_PROTECT_LEVEL);
|
||||
}
|
||||
|
||||
TOKEN("max_level")
|
||||
{
|
||||
str_to_number(gPlayerMaxLevel, value_string);
|
||||
|
||||
gPlayerMaxLevel = MINMAX(1, gPlayerMaxLevel, PLAYER_MAX_LEVEL_CONST);
|
||||
|
||||
fprintf(stderr, "PLAYER_MAX_LEVEL: %d\n", gPlayerMaxLevel);
|
||||
}
|
||||
|
||||
TOKEN("block_char_creation")
|
||||
{
|
||||
int tmp = 0;
|
||||
|
||||
str_to_number(tmp, value_string);
|
||||
|
||||
if (0 == tmp)
|
||||
g_BlockCharCreation = false;
|
||||
else
|
||||
g_BlockCharCreation = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_PROXY_IP
|
||||
TOKEN("proxy_ip")
|
||||
{
|
||||
#ifndef WIN32
|
||||
if (validateIpAddress(value_string))
|
||||
g_stProxyIP = value_string;
|
||||
else {
|
||||
struct hostent* host = gethostbyname(value_string);
|
||||
g_stProxyIP = inet_ntoa(*(struct in_addr*)host->h_addr_list[0]);
|
||||
fprintf(stderr, "PROXY_IP: [%s] resolves to [%s]\n", value_string, g_stProxyIP.c_str());
|
||||
}
|
||||
#else
|
||||
g_stProxyIP = value_string;
|
||||
#endif
|
||||
fprintf(stderr, "PROXY_IP: %s\n", g_stProxyIP.c_str());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
fclose(fp_common);
|
||||
|
||||
FILE* fpOnlyForDB;
|
||||
|
||||
if (!(fpOnlyForDB = fopen(st_configFileName.c_str(), "r")))
|
||||
{
|
||||
fprintf(stderr, "Can not open [%s]\n", st_configFileName.c_str());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while (fgets(buf, 256, fpOnlyForDB))
|
||||
{
|
||||
parse_token(buf, token_string, value_string);
|
||||
|
||||
TOKEN("BLOCK_LOGIN")
|
||||
{
|
||||
g_stBlockDate = value_string;
|
||||
}
|
||||
|
||||
TOKEN("hostname")
|
||||
{
|
||||
g_stHostname = value_string;
|
||||
fprintf(stdout, "HOSTNAME: %s\n", g_stHostname.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("channel")
|
||||
{
|
||||
str_to_number(g_bChannel, value_string);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//처리가 끝났으니 파일을 닫자.
|
||||
@@ -745,152 +1064,18 @@ void config_init(const string& st_localeServiceName)
|
||||
{
|
||||
parse_token(buf, token_string, value_string);
|
||||
|
||||
TOKEN("empire_whisper")
|
||||
{
|
||||
bool b_value = 0;
|
||||
str_to_number(b_value, value_string);
|
||||
g_bEmpireWhisper = !!b_value;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("mark_server")
|
||||
{
|
||||
guild_mark_server = is_string_true(value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("mark_min_level")
|
||||
{
|
||||
str_to_number(guild_mark_min_level, value_string);
|
||||
guild_mark_min_level = MINMAX(0, guild_mark_min_level, GUILD_MAX_LEVEL);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("port")
|
||||
{
|
||||
str_to_number(mother_port, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("log_keep_days")
|
||||
{
|
||||
int i = 0;
|
||||
str_to_number(i, value_string);
|
||||
log_set_expiration_days(MINMAX(1, i, 90));
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("passes_per_sec")
|
||||
{
|
||||
str_to_number(passes_per_sec, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("p2p_port")
|
||||
{
|
||||
str_to_number(p2p_port, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("db_port")
|
||||
{
|
||||
str_to_number(db_port, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("db_addr")
|
||||
{
|
||||
std::strncpy(db_addr, value_string, sizeof(db_addr));
|
||||
|
||||
for (int n =0; n < ADDRESS_MAX_LEN; ++n)
|
||||
{
|
||||
if (db_addr[n] == ' ')
|
||||
db_addr[n] = '\0';
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("save_event_second_cycle")
|
||||
{
|
||||
int cycle = 0;
|
||||
str_to_number(cycle, value_string);
|
||||
save_event_second_cycle = cycle * passes_per_sec;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("ping_event_second_cycle")
|
||||
{
|
||||
int cycle = 0;
|
||||
str_to_number(cycle, value_string);
|
||||
ping_event_second_cycle = cycle * passes_per_sec;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("table_postfix")
|
||||
{
|
||||
g_table_postfix = value_string;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("test_server")
|
||||
{
|
||||
printf("-----------------------------------------------\n");
|
||||
printf("TEST_SERVER\n");
|
||||
printf("-----------------------------------------------\n");
|
||||
str_to_number(test_server, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("speed_server")
|
||||
{
|
||||
printf("-----------------------------------------------\n");
|
||||
printf("SPEED_SERVER\n");
|
||||
printf("-----------------------------------------------\n");
|
||||
str_to_number(speed_server, value_string);
|
||||
continue;
|
||||
}
|
||||
#ifdef __AUCTION__
|
||||
TOKEN("auction_server")
|
||||
{
|
||||
printf("-----------------------------------------------\n");
|
||||
printf("AUCTION_SERVER\n");
|
||||
printf("-----------------------------------------------\n");
|
||||
str_to_number(auction_server, value_string);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
TOKEN("distribution_test_server")
|
||||
{
|
||||
str_to_number(distribution_test_server, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("china_event_server")
|
||||
{
|
||||
str_to_number(china_event_server, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("shutdowned")
|
||||
{
|
||||
g_bNoMoreClient = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("no_regen")
|
||||
{
|
||||
g_bNoRegen = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("traffic_profile")
|
||||
{
|
||||
g_bTrafficProfileOn = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
TOKEN("map_allow")
|
||||
{
|
||||
char * p = value_string;
|
||||
@@ -922,24 +1107,6 @@ void config_init(const string& st_localeServiceName)
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("no_wander")
|
||||
{
|
||||
no_wander = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("user_limit")
|
||||
{
|
||||
str_to_number(g_iUserLimit, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("skill_disable")
|
||||
{
|
||||
str_to_number(g_bSkillDisable, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("auth_server")
|
||||
{
|
||||
char szIP[32];
|
||||
@@ -969,120 +1136,12 @@ void config_init(const string& st_localeServiceName)
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("billing")
|
||||
{
|
||||
g_bBilling = true;
|
||||
}
|
||||
|
||||
TOKEN("quest_dir")
|
||||
{
|
||||
sys_log(0, "QUEST_DIR SETTING : %s", value_string);
|
||||
g_stQuestDir = value_string;
|
||||
}
|
||||
|
||||
TOKEN("quest_object_dir")
|
||||
{
|
||||
//g_stQuestObjectDir = value_string;
|
||||
std::istringstream is(value_string);
|
||||
sys_log(0, "QUEST_OBJECT_DIR SETTING : %s", value_string);
|
||||
string dir;
|
||||
while (!is.eof())
|
||||
{
|
||||
is >> dir;
|
||||
if (is.fail())
|
||||
break;
|
||||
g_setQuestObjectDir.insert(dir);
|
||||
sys_log(0, "QUEST_OBJECT_DIR INSERT : %s", dir .c_str());
|
||||
}
|
||||
}
|
||||
|
||||
TOKEN("teen_addr")
|
||||
{
|
||||
std::strncpy(teen_addr, value_string, sizeof(teen_addr));
|
||||
|
||||
for (int n =0; n < ADDRESS_MAX_LEN; ++n)
|
||||
{
|
||||
if (teen_addr[n] == ' ')
|
||||
teen_addr[n] = '\0';
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("teen_port")
|
||||
{
|
||||
str_to_number(teen_port, value_string);
|
||||
}
|
||||
|
||||
TOKEN("synchack_limit_count")
|
||||
{
|
||||
str_to_number(g_iSyncHackLimitCount, value_string);
|
||||
}
|
||||
|
||||
TOKEN("speedhack_limit_count")
|
||||
{
|
||||
str_to_number(SPEEDHACK_LIMIT_COUNT, value_string);
|
||||
}
|
||||
|
||||
TOKEN("speedhack_limit_bonus")
|
||||
{
|
||||
str_to_number(SPEEDHACK_LIMIT_BONUS, value_string);
|
||||
}
|
||||
|
||||
TOKEN("server_id")
|
||||
{
|
||||
str_to_number(g_server_id, value_string);
|
||||
}
|
||||
|
||||
TOKEN("mall_url")
|
||||
{
|
||||
g_strWebMallURL = value_string;
|
||||
}
|
||||
|
||||
TOKEN("bind_ip")
|
||||
{
|
||||
std::strncpy(g_szPublicIP, value_string, sizeof(g_szPublicIP));
|
||||
}
|
||||
|
||||
TOKEN("view_range")
|
||||
{
|
||||
str_to_number(VIEW_RANGE, value_string);
|
||||
}
|
||||
|
||||
TOKEN("spam_block_duration")
|
||||
{
|
||||
str_to_number(g_uiSpamBlockDuration, value_string);
|
||||
}
|
||||
|
||||
TOKEN("spam_block_score")
|
||||
{
|
||||
str_to_number(g_uiSpamBlockScore, value_string);
|
||||
g_uiSpamBlockScore = MAX(1, g_uiSpamBlockScore);
|
||||
}
|
||||
|
||||
TOKEN("spam_block_reload_cycle")
|
||||
{
|
||||
str_to_number(g_uiSpamReloadCycle, value_string);
|
||||
g_uiSpamReloadCycle = MAX(60, g_uiSpamReloadCycle); // 최소 1분
|
||||
}
|
||||
|
||||
TOKEN("check_multihack")
|
||||
{
|
||||
str_to_number(g_bCheckMultiHack, value_string);
|
||||
}
|
||||
|
||||
TOKEN("spam_block_max_level")
|
||||
{
|
||||
str_to_number(g_iSpamBlockMaxLevel, value_string);
|
||||
}
|
||||
TOKEN("protect_normal_player")
|
||||
{
|
||||
str_to_number(g_protectNormalPlayer, value_string);
|
||||
}
|
||||
TOKEN("notice_battle_zone")
|
||||
{
|
||||
str_to_number(g_noticeBattleZone, value_string);
|
||||
}
|
||||
|
||||
|
||||
// TOKEN("hackshield_enable")
|
||||
// {
|
||||
@@ -1124,53 +1183,6 @@ void config_init(const string& st_localeServiceName)
|
||||
// }
|
||||
// }
|
||||
|
||||
TOKEN("pk_protect_level")
|
||||
{
|
||||
str_to_number(PK_PROTECT_LEVEL, value_string);
|
||||
fprintf(stderr, "PK_PROTECT_LEVEL: %d", PK_PROTECT_LEVEL);
|
||||
}
|
||||
|
||||
TOKEN("max_level")
|
||||
{
|
||||
str_to_number(gPlayerMaxLevel, value_string);
|
||||
|
||||
gPlayerMaxLevel = MINMAX(1, gPlayerMaxLevel, PLAYER_MAX_LEVEL_CONST);
|
||||
|
||||
fprintf(stderr, "PLAYER_MAX_LEVEL: %d\n", gPlayerMaxLevel);
|
||||
}
|
||||
|
||||
TOKEN("block_char_creation")
|
||||
{
|
||||
int tmp = 0;
|
||||
|
||||
str_to_number(tmp, value_string);
|
||||
|
||||
if (0 == tmp)
|
||||
g_BlockCharCreation = false;
|
||||
else
|
||||
g_BlockCharCreation = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_PROXY_IP
|
||||
TOKEN("proxy_ip")
|
||||
{
|
||||
#ifndef WIN32
|
||||
if (validateIpAddress(value_string))
|
||||
g_stProxyIP = value_string;
|
||||
else {
|
||||
struct hostent *host = gethostbyname(value_string);
|
||||
g_stProxyIP = inet_ntoa(*(struct in_addr *)host->h_addr_list[0]);
|
||||
fprintf(stderr, "PROXY_IP: [%s] resolves to [%s]\n", value_string, g_stProxyIP.c_str());
|
||||
}
|
||||
#else
|
||||
g_stProxyIP = value_string;
|
||||
#endif
|
||||
fprintf(stderr, "PROXY_IP: %s\n", g_stProxyIP.c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
if (g_setQuestObjectDir.empty())
|
||||
|
||||
@@ -44,15 +44,6 @@ bool DESC_P2P::Setup(LPFDWATCH fdw, socket_t fd, const char * host, WORD wPort)
|
||||
|
||||
m_iMinInputBufferLen = 1024 * 1024;
|
||||
|
||||
#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, "PORT_SECURITY: new p2p connection from [%s] to [%s] fd: %d BLOCKED", host, g_szPublicIP, m_sock);
|
||||
SetPhase(PHASE_CLOSE);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
SetPhase(PHASE_P2P);
|
||||
|
||||
sys_log(0, "SYSTEM: new p2p connection from [%s] fd: %d", host, m_sock);
|
||||
|
||||
@@ -286,14 +286,6 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
||||
if (!(c_pSep = strchr(c_pData, '\n'))) // \n을 찾는다.
|
||||
return -1;
|
||||
|
||||
#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, "PORT_SECURITY: BLOCK FROM(%s)", d->GetHostName());
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (*(c_pSep - 1) == '\r')
|
||||
--c_pSep;
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ bool ITEM_MANAGER::ReadCommonDropItemFile(const char * c_pszFileName)
|
||||
if (!p2)
|
||||
break;
|
||||
|
||||
std::strncpy(szTemp, p, MIN(sizeof(szTemp), (p2 - p) + 1));
|
||||
strlcpy(szTemp, p, MIN(sizeof(szTemp), (p2 - p) + 1));
|
||||
p = p2 + 1;
|
||||
|
||||
switch (j)
|
||||
@@ -69,7 +69,7 @@ bool ITEM_MANAGER::ReadCommonDropItemFile(const char * c_pszFileName)
|
||||
case 1: str_to_number(d[i].iLvStart, szTemp); break;
|
||||
case 2: str_to_number(d[i].iLvEnd, szTemp); break;
|
||||
case 3: d[i].fPercent = atof(szTemp); break;
|
||||
case 4: std::strncpy(d[i].szItemName, szTemp, sizeof(d[i].szItemName)); break;
|
||||
case 4: strlcpy(d[i].szItemName, szTemp, sizeof(d[i].szItemName)); break;
|
||||
case 5: str_to_number(d[i].iCount, szTemp); break;
|
||||
}
|
||||
}
|
||||
|
||||
1
vendor/CMakeLists.txt
vendored
1
vendor/CMakeLists.txt
vendored
@@ -10,6 +10,7 @@ set(CLIENT_PLUGIN_PARSE_CLIENT STATIC CACHE STRING "")
|
||||
set(CLIENT_PLUGIN_AUTH_GSSAPI_CLIENT OFF CACHE STRING "")
|
||||
set(CLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD OFF CACHE STRING "")
|
||||
set(CLIENT_PLUGIN_PVIO_SHMEM STATIC CACHE STRING "")
|
||||
set(DEFAULT_SSL_VERIFY_SERVER_CERT OFF CACHE STRING "")
|
||||
|
||||
add_subdirectory(mariadb-connector-c-3.4.5 EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(cryptopp)
|
||||
|
||||
Reference in New Issue
Block a user