From db7694e879733de2ef3be12f2cc54c2a34b271dc Mon Sep 17 00:00:00 2001 From: Berkay Date: Tue, 23 Sep 2025 00:01:15 +0300 Subject: [PATCH] chore: auth brazil removed --- src/game/auth_brazil.cpp | 178 --------------------------------------- src/game/auth_brazil.h | 23 ----- src/game/db.cpp | 1 - src/game/input_auth.cpp | 21 ----- src/game/input_db.cpp | 3 +- src/game/main.cpp | 4 - 6 files changed, 1 insertion(+), 229 deletions(-) delete mode 100644 src/game/auth_brazil.cpp delete mode 100644 src/game/auth_brazil.h diff --git a/src/game/auth_brazil.cpp b/src/game/auth_brazil.cpp deleted file mode 100644 index f2b5228..0000000 --- a/src/game/auth_brazil.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* vi: set sw=4 ts=8 cino=g0,\:0 : */ -/********************************************************************* - * date : 2010.4.7 - * file : auth_brazil.c - * author : mhh - * description : - */ -#include "stdafx.h" - -#ifndef OS_WINDOWS -#include -#include -#endif -#include -#include -#include "libthecore/xmd5.h" - -#include "auth_brazil.h" - -static const char* FN_md5(const char *src) -{ - static char s_buffer[512]; - - memset(s_buffer, 0x00, sizeof(s_buffer)); - - unsigned char digest[16] = {0}; - MD5_CTX md5; - MD5Init(&md5); - MD5Update(&md5, (const unsigned char*) src, strlen(src)); - MD5Final(digest, &md5); - - int offset = 0; - for (int i=0; i<16; ++i) { - offset += sprintf(s_buffer + offset, "%02x", digest[i]); - } - return s_buffer; -} - - -static int FN_make_request(const char *login, const char *password, /*out*/ char *dst, int dst_size) -{ - int len = snprintf(dst, dst_size, -// "GET /metin2/game_auth.php?ID=%s&PW=%s HTTP/1.1\r\n" - "GET /metin2/?ID=%s&PW=%s HTTP/1.1\r\n" - "Host: auth.ongame.com.br\r\n" - "Connection: Close\r\n\r\n", - login, FN_md5(password)); - - return len; -} - - -static int FN_parse_reply(char *reply) -{ - char buffer[2048]; - strlcpy(buffer, reply, sizeof(buffer)); - - const char *delim = "\r\n"; - char *last = 0; - char *v = strtok_r(buffer, delim, &last); - char *result = 0; - - while (v) - { - result = v; - v = strtok_r(NULL, delim, &last); - } - - if (result) - { - if (0 == strcasecmp("true", result)) - return AUTH_BRAZIL_SUCC; - else if (0 == strcasecmp("false", result)) - return AUTH_BRAZIL_WRONGPWD; - else if (0 == strcasecmp("unknown", result)) - return AUTH_BRAZIL_NOID; - else if (0 == strcasecmp("flash", result)) - return AUTH_BRAZIL_FLASHUSER; - } - - return AUTH_BRAZIL_SERVER_ERR; -} - - -extern void socket_timeout(socket_t s, long sec, long usec); - -int auth_brazil(const char *login, const char *pwd) -{ - - const char *host = "auth.ongame.com.br"; - int port = 80; - - socket_t fd = socket_connect(host, port); - if (fd < 0) - { - sys_err("[AUTH_BRAZIL] : could not connect to gsp server(%s)", host); - return AUTH_BRAZIL_SERVER_ERR; - } - - socket_block(fd); - socket_timeout(fd, 3, 0); - - // send request - { - char request[512]; - int len = FN_make_request(login, pwd, request, sizeof(request)); - -#ifndef OS_WINDOWS - if (write(fd, request, len) < 0) -#else - if (_write(fd, request, len) < 0) -#endif - { - sys_err("[AUTH_BRAZIL] : could not send auth-request (%s)", login); - close(fd); - return AUTH_BRAZIL_SERVER_ERR; - } - } - - // read reply - { - char reply[1024] = {0}; - int len = read(fd, reply, sizeof(reply)); - close(fd); - - if (len <= 0) - { - sys_err("[AUTH_BRAZIL] : could not recv auth-reply (%s)", login); - return AUTH_BRAZIL_SERVER_ERR; - } - - // 응답받은 경우에만 query count를 늘린다. - auth_brazil_inc_query_count(); - - return FN_parse_reply(reply); - } -} - - -static int s_query_count = 0; - -int auth_brazil_inc_query_count() -{ - return ++s_query_count; -} - -void auth_brazil_log() -{ - FILE *fp = 0; - - // open and try backup - { - fp = fopen("AUTH_COUNT.log", "a"); - - if (0 == fp) - return; - - struct stat sb; - fstat(fileno(fp), &sb); - if (sb.st_size > 1024 * 1024) - { - fclose(fp); - rename("AUTH_COUNT.log", "AUTH_COUNT.log.old"); - - fp = fopen("AUTH_COUNT.log", "a"); - } - } - - // write log - { - fprintf(fp, "%d\n", s_query_count); - fclose(fp); - } - - // reset query count - s_query_count = 0; -} - diff --git a/src/game/auth_brazil.h b/src/game/auth_brazil.h deleted file mode 100644 index 1486dae..0000000 --- a/src/game/auth_brazil.h +++ /dev/null @@ -1,23 +0,0 @@ -/* vi: set sw=4 ts=8 cino=g0,\:0 : */ -/********************************************************************* - * date : 2010.4.7 - * file : auth_brazil.h - * author : mhh - * description : - */ -#ifndef __auth_brazil_h_1270647899__ -#define __auth_brazil_h_1270647899__ - -#define AUTH_BRAZIL_SERVER_ERR 0 -#define AUTH_BRAZIL_SUCC 1 -#define AUTH_BRAZIL_NOID 2 -#define AUTH_BRAZIL_WRONGPWD 3 -#define AUTH_BRAZIL_FLASHUSER 4 - -int auth_brazil(const char *login, const char *pwd); - - -int auth_brazil_inc_query_count(); -void auth_brazil_log(); - -#endif // __auth_brazil_h_1270647899__ diff --git a/src/game/db.cpp b/src/game/db.cpp index 1bcb768..32c7fce 100644 --- a/src/game/db.cpp +++ b/src/game/db.cpp @@ -17,7 +17,6 @@ #include "login_data.h" #include "locale_service.h" #include "spam.h" -#include "auth_brazil.h" extern std::string g_stBlockDate; diff --git a/src/game/input_auth.cpp b/src/game/input_auth.cpp index d3e2c71..66deed5 100644 --- a/src/game/input_auth.cpp +++ b/src/game/input_auth.cpp @@ -7,7 +7,6 @@ #include "protocol.h" #include "matrix_card.h" #include "locale_service.h" -#include "auth_brazil.h" #include "db.h" #ifndef OS_WINDOWS @@ -170,26 +169,6 @@ void CInputAuth::Login(LPDESC d, const char * c_pData) sys_log(0, "InputAuth::Login : key %u:0x%x login %s", dwKey, dwPanamaKey, login); - // BRAZIL_AUTH - if (LC_IsBrazil() && !test_server) - { - int result = auth_brazil(login, passwd); - - switch (result) - { - case AUTH_BRAZIL_SERVER_ERR: - case AUTH_BRAZIL_NOID: - LoginFailure(d, "NOID"); - return; - case AUTH_BRAZIL_WRONGPWD: - LoginFailure(d, "WRONGPWD"); - return; - case AUTH_BRAZIL_FLASHUSER: - LoginFailure(d, "FLASH"); - return; - } - } - TPacketCGLogin3 * p = M2_NEW TPacketCGLogin3; thecore_memcpy(p, pinfo, sizeof(TPacketCGLogin3)); diff --git a/src/game/input_db.cpp b/src/game/input_db.cpp index 156014f..be679a5 100644 --- a/src/game/input_db.cpp +++ b/src/game/input_db.cpp @@ -428,8 +428,7 @@ void CInputDB::PlayerLoad(LPDESC d, const char * data) if (LC_IsYMIR() || LC_IsKorea() || LC_IsBrazil() || LC_IsJapan()) { - LogManager::instance().LoginLog(true, - ch->GetDesc()->GetAccountTable().id, ch->GetPlayerID(), ch->GetLevel(), ch->GetJob(), ch->GetRealPoint(POINT_PLAYTIME)); + LogManager::instance().LoginLog(true, ch->GetDesc()->GetAccountTable().id, ch->GetPlayerID(), ch->GetLevel(), ch->GetJob(), ch->GetRealPoint(POINT_PLAYTIME)); } } diff --git a/src/game/main.cpp b/src/game/main.cpp index fdf4b94..5a3799a 100644 --- a/src/game/main.cpp +++ b/src/game/main.cpp @@ -54,7 +54,6 @@ #include "spam.h" #include "panama.h" #include "threeway_war.h" -#include "auth_brazil.h" #include "DragonLair.h" #include "skill_power.h" #include "SpeedServer.h" @@ -244,9 +243,6 @@ void heartbeat(LPHEART ht, int pulse) } #endif - if (g_bAuthServer && LC_IsBrazil() && !test_server) - auth_brazil_log(); - if (!g_bAuthServer) { TPlayerCountPacket pack;