Increases the server config character limit (#7006)
* Fixes #5324. * Adjusts the Login, Character and Map server's ID, password, schema, and codepage character limit from 31 to 1023. * Adjusts the Login, Character, and Map server's IP character limit from 63 to 1023. * Removes password echos during failed connections. Thanks to @reunite-ro!
This commit is contained in:
@@ -52,13 +52,13 @@
|
||||
|
||||
using namespace rathena;
|
||||
|
||||
char default_codepage[32] = "";
|
||||
std::string default_codepage = "";
|
||||
|
||||
int map_server_port = 3306;
|
||||
char map_server_ip[64] = "127.0.0.1";
|
||||
char map_server_id[32] = "ragnarok";
|
||||
char map_server_pw[32] = "";
|
||||
char map_server_db[32] = "ragnarok";
|
||||
std::string map_server_ip = "127.0.0.1";
|
||||
std::string map_server_id = "ragnarok";
|
||||
std::string map_server_pw = "";
|
||||
std::string map_server_db = "ragnarok";
|
||||
Sql* mmysql_handle;
|
||||
Sql* qsmysql_handle; /// For query_sql
|
||||
|
||||
@@ -91,11 +91,11 @@ char roulette_table[32] = "db_roulette";
|
||||
char guild_storage_log_table[32] = "guild_storage_log";
|
||||
|
||||
// log database
|
||||
char log_db_ip[64] = "127.0.0.1";
|
||||
std::string log_db_ip = "127.0.0.1";
|
||||
int log_db_port = 3306;
|
||||
char log_db_id[32] = "ragnarok";
|
||||
char log_db_pw[32] = "";
|
||||
char log_db_db[32] = "log";
|
||||
std::string log_db_id = "ragnarok";
|
||||
std::string log_db_pw = "";
|
||||
std::string log_db_db = "log";
|
||||
Sql* logmysql_handle;
|
||||
|
||||
uint32 start_status_points = 48;
|
||||
@@ -4162,41 +4162,41 @@ int inter_config_read(const char *cfgName)
|
||||
else
|
||||
//Map Server SQL DB
|
||||
if(strcmpi(w1,"map_server_ip")==0)
|
||||
safestrncpy(map_server_ip, w2, sizeof(map_server_ip));
|
||||
map_server_ip = w2;
|
||||
else
|
||||
if(strcmpi(w1,"map_server_port")==0)
|
||||
map_server_port=atoi(w2);
|
||||
else
|
||||
if(strcmpi(w1,"map_server_id")==0)
|
||||
safestrncpy(map_server_id, w2, sizeof(map_server_id));
|
||||
map_server_id = w2;
|
||||
else
|
||||
if(strcmpi(w1,"map_server_pw")==0)
|
||||
safestrncpy(map_server_pw, w2, sizeof(map_server_pw));
|
||||
map_server_pw = w2;
|
||||
else
|
||||
if(strcmpi(w1,"map_server_db")==0)
|
||||
safestrncpy(map_server_db, w2, sizeof(map_server_db));
|
||||
map_server_db = w2;
|
||||
else
|
||||
if(strcmpi(w1,"default_codepage")==0)
|
||||
safestrncpy(default_codepage, w2, sizeof(default_codepage));
|
||||
default_codepage = w2;
|
||||
else
|
||||
if(strcmpi(w1,"use_sql_db")==0) {
|
||||
db_use_sqldbs = config_switch(w2);
|
||||
ShowStatus ("Using SQL dbs: %s\n",w2);
|
||||
} else
|
||||
if(strcmpi(w1,"log_db_ip")==0)
|
||||
safestrncpy(log_db_ip, w2, sizeof(log_db_ip));
|
||||
log_db_ip = w2;
|
||||
else
|
||||
if(strcmpi(w1,"log_db_id")==0)
|
||||
safestrncpy(log_db_id, w2, sizeof(log_db_id));
|
||||
log_db_id = w2;
|
||||
else
|
||||
if(strcmpi(w1,"log_db_pw")==0)
|
||||
safestrncpy(log_db_pw, w2, sizeof(log_db_pw));
|
||||
log_db_pw = w2;
|
||||
else
|
||||
if(strcmpi(w1,"log_db_port")==0)
|
||||
log_db_port = atoi(w2);
|
||||
else
|
||||
if(strcmpi(w1,"log_db_db")==0)
|
||||
safestrncpy(log_db_db, w2, sizeof(log_db_db));
|
||||
log_db_db = w2;
|
||||
else
|
||||
if(strcmpi(w1,"start_status_points")==0)
|
||||
start_status_points=atoi(w2);
|
||||
@@ -4223,11 +4223,11 @@ int map_sql_init(void)
|
||||
qsmysql_handle = Sql_Malloc();
|
||||
|
||||
ShowInfo("Connecting to the Map DB Server....\n");
|
||||
if( SQL_ERROR == Sql_Connect(mmysql_handle, map_server_id, map_server_pw, map_server_ip, map_server_port, map_server_db) ||
|
||||
SQL_ERROR == Sql_Connect(qsmysql_handle, map_server_id, map_server_pw, map_server_ip, map_server_port, map_server_db) )
|
||||
if( SQL_ERROR == Sql_Connect(mmysql_handle, map_server_id.c_str(), map_server_pw.c_str(), map_server_ip.c_str(), map_server_port, map_server_db.c_str()) ||
|
||||
SQL_ERROR == Sql_Connect(qsmysql_handle, map_server_id.c_str(), map_server_pw.c_str(), map_server_ip.c_str(), map_server_port, map_server_db.c_str()) )
|
||||
{
|
||||
ShowError("Couldn't connect with uname='%s',passwd='%s',host='%s',port='%d',database='%s'\n",
|
||||
map_server_id, map_server_pw, map_server_ip, map_server_port, map_server_db);
|
||||
ShowError("Couldn't connect with uname='%s',host='%s',port='%d',database='%s'\n",
|
||||
map_server_id.c_str(), map_server_ip.c_str(), map_server_port, map_server_db.c_str());
|
||||
Sql_ShowDebug(mmysql_handle);
|
||||
Sql_Free(mmysql_handle);
|
||||
Sql_ShowDebug(qsmysql_handle);
|
||||
@@ -4236,10 +4236,10 @@ int map_sql_init(void)
|
||||
}
|
||||
ShowStatus("Connect success! (Map Server Connection)\n");
|
||||
|
||||
if( strlen(default_codepage) > 0 ) {
|
||||
if ( SQL_ERROR == Sql_SetEncoding(mmysql_handle, default_codepage) )
|
||||
if( !default_codepage.empty() ) {
|
||||
if ( SQL_ERROR == Sql_SetEncoding(mmysql_handle, default_codepage.c_str()) )
|
||||
Sql_ShowDebug(mmysql_handle);
|
||||
if ( SQL_ERROR == Sql_SetEncoding(qsmysql_handle, default_codepage) )
|
||||
if ( SQL_ERROR == Sql_SetEncoding(qsmysql_handle, default_codepage.c_str()) )
|
||||
Sql_ShowDebug(qsmysql_handle);
|
||||
}
|
||||
return 0;
|
||||
@@ -4268,18 +4268,18 @@ int log_sql_init(void)
|
||||
// log db connection
|
||||
logmysql_handle = Sql_Malloc();
|
||||
|
||||
ShowInfo("" CL_WHITE "[SQL]" CL_RESET ": Connecting to the Log Database " CL_WHITE "%s" CL_RESET " At " CL_WHITE "%s" CL_RESET "...\n",log_db_db,log_db_ip);
|
||||
if ( SQL_ERROR == Sql_Connect(logmysql_handle, log_db_id, log_db_pw, log_db_ip, log_db_port, log_db_db) ){
|
||||
ShowError("Couldn't connect with uname='%s',passwd='%s',host='%s',port='%d',database='%s'\n",
|
||||
log_db_id, log_db_pw, log_db_ip, log_db_port, log_db_db);
|
||||
ShowInfo("" CL_WHITE "[SQL]" CL_RESET ": Connecting to the Log Database " CL_WHITE "%s" CL_RESET " At " CL_WHITE "%s" CL_RESET "...\n",log_db_db.c_str(), log_db_ip.c_str());
|
||||
if ( SQL_ERROR == Sql_Connect(logmysql_handle, log_db_id.c_str(), log_db_pw.c_str(), log_db_ip.c_str(), log_db_port, log_db_db.c_str()) ){
|
||||
ShowError("Couldn't connect with uname='%s',host='%s',port='%d',database='%s'\n",
|
||||
log_db_id.c_str(), log_db_ip.c_str(), log_db_port, log_db_db.c_str());
|
||||
Sql_ShowDebug(logmysql_handle);
|
||||
Sql_Free(logmysql_handle);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
ShowStatus("" CL_WHITE "[SQL]" CL_RESET ": Successfully '" CL_GREEN "connected" CL_RESET "' to Database '" CL_WHITE "%s" CL_RESET "'.\n", log_db_db);
|
||||
ShowStatus("" CL_WHITE "[SQL]" CL_RESET ": Successfully '" CL_GREEN "connected" CL_RESET "' to Database '" CL_WHITE "%s" CL_RESET "'.\n", log_db_db.c_str());
|
||||
|
||||
if( strlen(default_codepage) > 0 )
|
||||
if ( SQL_ERROR == Sql_SetEncoding(logmysql_handle, default_codepage) )
|
||||
if( !default_codepage.empty() )
|
||||
if ( SQL_ERROR == Sql_SetEncoding(logmysql_handle, default_codepage.c_str()) )
|
||||
Sql_ShowDebug(logmysql_handle);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user