mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
Some loginserver refactoring
This commit is contained in:
parent
a483d37c26
commit
af18377505
@ -523,7 +523,7 @@ struct ServerLSPlayerZoneChange_Struct {
|
||||
uint32 from; // 0 = world
|
||||
uint32 to; // 0 = world
|
||||
};
|
||||
struct ServerLSClientAuth {
|
||||
struct ClientAuth_Struct {
|
||||
uint32 lsaccount_id; // ID# in login server's db
|
||||
char name[30]; // username in login server's db
|
||||
char key[30]; // the Key the client will present
|
||||
|
||||
@ -245,7 +245,7 @@ void Client::Handle_Login(const char* data, unsigned int size)
|
||||
|
||||
if(result)
|
||||
{
|
||||
server.CM->RemoveExistingClient(d_account_id);
|
||||
server.client_manager->RemoveExistingClient(d_account_id);
|
||||
in_addr in;
|
||||
in.s_addr = connection->GetRemoteIP();
|
||||
server.db->UpdateLSAccountData(d_account_id, string(inet_ntoa(in)));
|
||||
@ -347,12 +347,12 @@ void Client::Handle_Play(const char* data)
|
||||
this->play_server_id = (unsigned int)play->ServerNumber;
|
||||
play_sequence_id = sequence_in;
|
||||
play_server_id = server_id_in;
|
||||
server.SM->SendUserToWorldRequest(server_id_in, account_id);
|
||||
server.server_manager->SendUserToWorldRequest(server_id_in, account_id);
|
||||
}
|
||||
|
||||
void Client::SendServerListPacket()
|
||||
{
|
||||
EQApplicationPacket *outapp = server.SM->CreateServerListPacket(this);
|
||||
EQApplicationPacket *outapp = server.server_manager->CreateServerListPacket(this);
|
||||
|
||||
if(server.options.IsDumpOutPacketsOn())
|
||||
{
|
||||
|
||||
@ -40,7 +40,7 @@ public:
|
||||
* but it's the most trivial way to do this.
|
||||
*/
|
||||
#ifdef WIN32
|
||||
LoginServer() : config(nullptr), db(nullptr), eq_crypto(nullptr), SM(nullptr) { }
|
||||
LoginServer() : config(nullptr), db(nullptr), eq_crypto(nullptr), server_manager(nullptr) { }
|
||||
#else
|
||||
LoginServer() : config(nullptr), db(nullptr) { }
|
||||
#endif
|
||||
@ -48,8 +48,8 @@ public:
|
||||
Config *config;
|
||||
Database *db;
|
||||
Options options;
|
||||
ServerManager *SM;
|
||||
ClientManager *CM;
|
||||
ServerManager *server_manager;
|
||||
ClientManager *client_manager;
|
||||
|
||||
#ifdef WIN32
|
||||
Encryption *eq_crypto;
|
||||
|
||||
@ -44,7 +44,7 @@ int main()
|
||||
RegisterExecutablePlatform(ExePlatformLogin);
|
||||
set_exception_handler();
|
||||
|
||||
//Create our error log, is of format login_<number>.log
|
||||
/* Start Loginserver log */
|
||||
time_t current_time = time(nullptr);
|
||||
std::stringstream log_name(std::stringstream::in | std::stringstream::out);
|
||||
#ifdef WIN32
|
||||
@ -55,92 +55,55 @@ int main()
|
||||
server_log = new ErrorLog(log_name.str().c_str());
|
||||
server_log->Log(log_debug, "Logging System Init.");
|
||||
|
||||
//Create our subsystem and parse the ini file.
|
||||
/* Parse out login.ini */
|
||||
server.config = new Config();
|
||||
server_log->Log(log_debug, "Config System Init.");
|
||||
server.config->Parse("login.ini");
|
||||
|
||||
//Parse unregistered allowed option.
|
||||
if (server.config->GetVariable("options", "unregistered_allowed").compare("FALSE") == 0)
|
||||
{
|
||||
server.options.AllowUnregistered(false);
|
||||
}
|
||||
|
||||
//Parse trace option.
|
||||
if (server.config->GetVariable("options", "trace").compare("TRUE") == 0)
|
||||
{
|
||||
server.options.Trace(true);
|
||||
}
|
||||
|
||||
//Parse trace option.
|
||||
if (server.config->GetVariable("options", "world_trace").compare("TRUE") == 0)
|
||||
{
|
||||
server.options.WorldTrace(true);
|
||||
}
|
||||
|
||||
//Parse packet inc dump option.
|
||||
if (server.config->GetVariable("options", "dump_packets_in").compare("TRUE") == 0)
|
||||
{
|
||||
server.options.DumpInPackets(true);
|
||||
}
|
||||
|
||||
//Parse packet out dump option.
|
||||
if (server.config->GetVariable("options", "dump_packets_out").compare("TRUE") == 0)
|
||||
{
|
||||
server.options.DumpOutPackets(true);
|
||||
}
|
||||
|
||||
//Parse encryption mode option.
|
||||
std::string mode = server.config->GetVariable("security", "mode");
|
||||
if (mode.size() > 0)
|
||||
{
|
||||
server.options.EncryptionMode(atoi(mode.c_str()));
|
||||
}
|
||||
|
||||
//Parse local network option.
|
||||
std::string ln = server.config->GetVariable("options", "local_network");
|
||||
if(ln.size() > 0)
|
||||
{
|
||||
server.options.LocalNetwork(ln);
|
||||
}
|
||||
std::string local_network = server.config->GetVariable("options", "local_network");
|
||||
if (local_network.size() > 0)
|
||||
server.options.LocalNetwork(local_network);
|
||||
|
||||
//Parse reject duplicate servers option.
|
||||
if (server.config->GetVariable("options", "reject_duplicate_servers").compare("TRUE") == 0)
|
||||
{
|
||||
server.options.RejectDuplicateServers(true);
|
||||
}
|
||||
|
||||
//Parse account table option.
|
||||
ln = server.config->GetVariable("schema", "account_table");
|
||||
if(ln.size() > 0)
|
||||
{
|
||||
server.options.AccountTable(ln);
|
||||
}
|
||||
local_network = server.config->GetVariable("schema", "account_table");
|
||||
if (local_network.size() > 0)
|
||||
server.options.AccountTable(local_network);
|
||||
|
||||
//Parse world account table option.
|
||||
ln = server.config->GetVariable("schema", "world_registration_table");
|
||||
if(ln.size() > 0)
|
||||
{
|
||||
server.options.WorldRegistrationTable(ln);
|
||||
}
|
||||
local_network = server.config->GetVariable("schema", "world_registration_table");
|
||||
if (local_network.size() > 0)
|
||||
server.options.WorldRegistrationTable(local_network);
|
||||
|
||||
//Parse admin world account table option.
|
||||
ln = server.config->GetVariable("schema", "world_admin_registration_table");
|
||||
if(ln.size() > 0)
|
||||
{
|
||||
server.options.WorldAdminRegistrationTable(ln);
|
||||
}
|
||||
local_network = server.config->GetVariable("schema", "world_admin_registration_table");
|
||||
if (local_network.size() > 0)
|
||||
server.options.WorldAdminRegistrationTable(local_network);
|
||||
|
||||
//Parse world type table option.
|
||||
ln = server.config->GetVariable("schema", "world_server_type_table");
|
||||
if(ln.size() > 0)
|
||||
{
|
||||
server.options.WorldServerTypeTable(ln);
|
||||
}
|
||||
local_network = server.config->GetVariable("schema", "world_server_type_table");
|
||||
if (local_network.size() > 0)
|
||||
server.options.WorldServerTypeTable(local_network);
|
||||
|
||||
//Create our DB from options.
|
||||
if(server.config->GetVariable("database", "subsystem").compare("MySQL") == 0)
|
||||
{
|
||||
if (server.config->GetVariable("database", "subsystem").compare("MySQL") == 0) {
|
||||
#ifdef EQEMU_MYSQL_ENABLED
|
||||
server_log->Log(log_debug, "MySQL Database Init.");
|
||||
server.db = (Database*)new DatabaseMySQL(
|
||||
@ -151,8 +114,7 @@ int main()
|
||||
server.config->GetVariable("database", "db"));
|
||||
#endif
|
||||
}
|
||||
else if(server.config->GetVariable("database", "subsystem").compare("PostgreSQL") == 0)
|
||||
{
|
||||
else if (server.config->GetVariable("database", "subsystem").compare("PostgreSQL") == 0) {
|
||||
#ifdef EQEMU_POSTGRESQL_ENABLED
|
||||
server_log->Log(log_debug, "PostgreSQL Database Init.");
|
||||
server.db = (Database*)new DatabasePostgreSQL(
|
||||
@ -164,9 +126,8 @@ int main()
|
||||
#endif
|
||||
}
|
||||
|
||||
//Make sure our database got created okay, otherwise cleanup and exit.
|
||||
if(!server.db)
|
||||
{
|
||||
/* Make sure our database got created okay, otherwise cleanup and exit. */
|
||||
if (!server.db) {
|
||||
server_log->Log(log_error, "Database Initialization Failure.");
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
@ -179,12 +140,10 @@ int main()
|
||||
//initialize our encryption.
|
||||
server_log->Log(log_debug, "Encryption Initialize.");
|
||||
server.eq_crypto = new Encryption();
|
||||
if(server.eq_crypto->LoadCrypto(server.config->GetVariable("security", "plugin")))
|
||||
{
|
||||
if (server.eq_crypto->LoadCrypto(server.config->GetVariable("security", "plugin"))) {
|
||||
server_log->Log(log_debug, "Encryption Loaded Successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
//We can't run without encryption, cleanup and exit.
|
||||
server_log->Log(log_error, "Encryption Failed to Load.");
|
||||
server_log->Log(log_debug, "Database System Shutdown.");
|
||||
@ -199,15 +158,16 @@ int main()
|
||||
|
||||
//create our server manager.
|
||||
server_log->Log(log_debug, "Server Manager Initialize.");
|
||||
server.SM = new ServerManager();
|
||||
if(!server.SM)
|
||||
{
|
||||
server.server_manager = new ServerManager();
|
||||
if (!server.server_manager) {
|
||||
//We can't run without a server manager, cleanup and exit.
|
||||
server_log->Log(log_error, "Server Manager Failed to Start.");
|
||||
|
||||
#ifdef WIN32
|
||||
server_log->Log(log_debug, "Encryption System Shutdown.");
|
||||
delete server.eq_crypto;
|
||||
#endif
|
||||
|
||||
server_log->Log(log_debug, "Database System Shutdown.");
|
||||
delete server.db;
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
@ -219,17 +179,18 @@ int main()
|
||||
|
||||
//create our client manager.
|
||||
server_log->Log(log_debug, "Client Manager Initialize.");
|
||||
server.CM = new ClientManager();
|
||||
if(!server.CM)
|
||||
{
|
||||
server.client_manager = new ClientManager();
|
||||
if (!server.client_manager) {
|
||||
//We can't run without a client manager, cleanup and exit.
|
||||
server_log->Log(log_error, "Client Manager Failed to Start.");
|
||||
server_log->Log(log_debug, "Server Manager Shutdown.");
|
||||
delete server.SM;
|
||||
delete server.server_manager;
|
||||
|
||||
#ifdef WIN32
|
||||
server_log->Log(log_debug, "Encryption System Shutdown.");
|
||||
delete server.eq_crypto;
|
||||
#endif
|
||||
|
||||
server_log->Log(log_debug, "Database System Shutdown.");
|
||||
delete server.db;
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
@ -248,23 +209,24 @@ int main()
|
||||
#endif
|
||||
|
||||
server_log->Log(log_debug, "Server Started.");
|
||||
while(run_server)
|
||||
{
|
||||
while (run_server) {
|
||||
Timer::SetCurrentTime();
|
||||
server.CM->Process();
|
||||
server.SM->Process();
|
||||
server.client_manager->Process();
|
||||
server.server_manager->Process();
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
server_log->Log(log_debug, "Server Shutdown.");
|
||||
server_log->Log(log_debug, "Client Manager Shutdown.");
|
||||
delete server.CM;
|
||||
delete server.client_manager;
|
||||
server_log->Log(log_debug, "Server Manager Shutdown.");
|
||||
delete server.SM;
|
||||
delete server.server_manager;
|
||||
|
||||
#ifdef WIN32
|
||||
server_log->Log(log_debug, "Encryption System Shutdown.");
|
||||
delete server.eq_crypto;
|
||||
#endif
|
||||
|
||||
server_log->Log(log_debug, "Database System Shutdown.");
|
||||
delete server.db;
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
|
||||
@ -28,19 +28,18 @@ WorldServer::WorldServer(EmuTCPConnection *c)
|
||||
connection = c;
|
||||
zones_booted = 0;
|
||||
players_online = 0;
|
||||
status = 0;
|
||||
server_status = 0;
|
||||
runtime_id = 0;
|
||||
server_list_id = 0;
|
||||
server_type = 0;
|
||||
authorized = false;
|
||||
trusted = false;
|
||||
logged_in = false;
|
||||
is_server_authorized = false;
|
||||
is_server_trusted = false;
|
||||
is_server_logged_in = false;
|
||||
}
|
||||
|
||||
WorldServer::~WorldServer()
|
||||
{
|
||||
if(connection)
|
||||
{
|
||||
if(connection) {
|
||||
connection->Free();
|
||||
}
|
||||
}
|
||||
@ -49,12 +48,12 @@ void WorldServer::Reset()
|
||||
{
|
||||
zones_booted = 0;
|
||||
players_online = 0;
|
||||
status = 0;
|
||||
server_status = 0;
|
||||
runtime_id;
|
||||
server_list_id = 0;
|
||||
server_type = 0;
|
||||
authorized = false;
|
||||
logged_in = false;
|
||||
is_server_authorized = false;
|
||||
is_server_logged_in = false;
|
||||
}
|
||||
|
||||
bool WorldServer::Process()
|
||||
@ -142,7 +141,7 @@ bool WorldServer::Process()
|
||||
|
||||
UsertoWorldResponse_Struct *utwr = (UsertoWorldResponse_Struct*)app->pBuffer;
|
||||
server_log->Log(log_client, "Trying to find client with user id of %u.", utwr->lsaccountid);
|
||||
Client *c = server.CM->GetClient(utwr->lsaccountid);
|
||||
Client *c = server.client_manager->GetClient(utwr->lsaccountid);
|
||||
if(c)
|
||||
{
|
||||
server_log->Log(log_client, "Found client with user id of %u and account name of %s.", utwr->lsaccountid, c->GetAccountName().c_str());
|
||||
@ -210,7 +209,7 @@ bool WorldServer::Process()
|
||||
|
||||
server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate packet received from: %s", short_name.c_str());
|
||||
ServerLSAccountUpdate_Struct *lsau = (ServerLSAccountUpdate_Struct*)app->pBuffer;
|
||||
if(trusted)
|
||||
if(is_server_trusted)
|
||||
{
|
||||
server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate update processed for: %s", lsau->useraccount);
|
||||
string name;
|
||||
@ -237,7 +236,7 @@ bool WorldServer::Process()
|
||||
|
||||
void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
{
|
||||
if(logged_in)
|
||||
if(is_server_logged_in)
|
||||
{
|
||||
server_log->Log(log_network_error, "WorldServer::Handle_NewLSInfo called but the login server was already marked as logged in, aborting.");
|
||||
return;
|
||||
@ -344,11 +343,11 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
|
||||
server_type = i->servertype;
|
||||
logged_in = true;
|
||||
is_server_logged_in = true;
|
||||
|
||||
if(server.options.IsRejectingDuplicateServers())
|
||||
{
|
||||
if(server.SM->ServerExists(long_name, short_name, this))
|
||||
if(server.server_manager->ServerExists(long_name, short_name, this))
|
||||
{
|
||||
server_log->Log(log_world_error, "World tried to login but there already exists a server that has that name.");
|
||||
return;
|
||||
@ -356,10 +355,10 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(server.SM->ServerExists(long_name, short_name, this))
|
||||
if(server.server_manager->ServerExists(long_name, short_name, this))
|
||||
{
|
||||
server_log->Log(log_world_error, "World tried to login but there already exists a server that has that name.");
|
||||
server.SM->DestroyServerByName(long_name, short_name, this);
|
||||
server.server_manager->DestroyServerByName(long_name, short_name, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -380,7 +379,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) successfully logged into account that had no user/password requirement.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
authorized = true;
|
||||
is_server_authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
server_list_id = s_list_type;
|
||||
desc = s_desc;
|
||||
@ -389,89 +388,90 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) successfully logged in.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
authorized = true;
|
||||
is_server_authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
server_list_id = s_list_type;
|
||||
desc = s_desc;
|
||||
if(s_trusted)
|
||||
{
|
||||
if(s_trusted) {
|
||||
server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate sent to world");
|
||||
trusted = true;
|
||||
is_server_trusted = true;
|
||||
ServerPacket *outapp = new ServerPacket(ServerOP_LSAccountUpdate, 0);
|
||||
connection->SendPacket(outapp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
server_log->Log(log_world, "Server %s(%s) attempted to log in but account and password did not match the entry in the database, and only"
|
||||
" registered servers are allowed.", long_name.c_str(), short_name.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry and only registered servers are allowed.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
server_log->Log(log_world, "Server %s(%s) did not attempt to log in but only registered servers are allowed.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int s_id = 0;
|
||||
unsigned int s_list_type = 0;
|
||||
unsigned int s_trusted = 0;
|
||||
string s_desc;
|
||||
string s_list_desc;
|
||||
string s_acct_name;
|
||||
string s_acct_pass;
|
||||
if(server.db->GetWorldRegistration(long_name, short_name, s_id, s_desc, s_list_type, s_trusted, s_list_desc, s_acct_name, s_acct_pass))
|
||||
{
|
||||
if(account_name.size() > 0 && account_password.size() > 0)
|
||||
{
|
||||
if(s_acct_name.compare(account_name) == 0 && s_acct_pass.compare(account_password) == 0)
|
||||
else {
|
||||
unsigned int server_id = 0;
|
||||
unsigned int server_list_type = 0;
|
||||
unsigned int is_server_trusted = 0;
|
||||
string server_description;
|
||||
string server_list_description;
|
||||
string server_account_name;
|
||||
string server_account_password;
|
||||
|
||||
|
||||
if(server.db->GetWorldRegistration(
|
||||
long_name,
|
||||
short_name,
|
||||
server_id,
|
||||
server_description,
|
||||
server_list_type,
|
||||
is_server_trusted,
|
||||
server_list_description,
|
||||
server_account_name,
|
||||
server_account_password))
|
||||
{
|
||||
|
||||
if(account_name.size() > 0 && account_password.size() > 0) {
|
||||
if(server_account_name.compare(account_name) == 0 && server_account_password.compare(account_password) == 0) {
|
||||
server_log->Log(log_world, "Server %s(%s) successfully logged in.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
server_list_id = s_list_type;
|
||||
desc = s_desc;
|
||||
if(s_trusted)
|
||||
{
|
||||
is_server_authorized = true;
|
||||
SetRuntimeID(server_id);
|
||||
server_list_id = server_list_type;
|
||||
desc = server_description;
|
||||
|
||||
if(is_server_trusted) {
|
||||
server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate sent to world");
|
||||
trusted = true;
|
||||
is_server_trusted = true;
|
||||
ServerPacket *outapp = new ServerPacket(ServerOP_LSAccountUpdate, 0);
|
||||
connection->SendPacket(outapp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// this is the first of two cases where we should deny access even if unregistered is allowed
|
||||
server_log->Log(log_world, "Server %s(%s) attempted to log in but account and password did not match the entry in the database.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(s_acct_name.size() > 0 || s_acct_pass.size() > 0)
|
||||
{
|
||||
else {
|
||||
if(server_account_name.size() > 0 || server_account_password.size() > 0) {
|
||||
// this is the second of two cases where we should deny access even if unregistered is allowed
|
||||
server_log->Log(log_world, "Server %s(%s) did not attempt to log in but this server requires a password.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
server_log->Log(log_world, "Server %s(%s) did not attempt to log in but unregistered servers are allowed.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
is_server_authorized = true;
|
||||
SetRuntimeID(server_id);
|
||||
server_list_id = 3;
|
||||
}
|
||||
}
|
||||
@ -480,10 +480,9 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry but unregistered servers are allowed.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
if(server.db->CreateWorldRegistration(long_name, short_name, s_id))
|
||||
{
|
||||
authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
if(server.db->CreateWorldRegistration(long_name, short_name, server_id)) {
|
||||
is_server_authorized = true;
|
||||
SetRuntimeID(server_id);
|
||||
server_list_id = 3;
|
||||
}
|
||||
}
|
||||
@ -493,9 +492,9 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
in.s_addr = connection->GetrIP();
|
||||
server.db->UpdateWorldRegistration(GetRuntimeID(), long_name, string(inet_ntoa(in)));
|
||||
|
||||
if(authorized)
|
||||
if(is_server_authorized)
|
||||
{
|
||||
server.CM->UpdateServerList();
|
||||
server.client_manager->UpdateServerList();
|
||||
}
|
||||
}
|
||||
|
||||
@ -503,20 +502,20 @@ void WorldServer::Handle_LSStatus(ServerLSStatus_Struct *s)
|
||||
{
|
||||
players_online = s->num_players;
|
||||
zones_booted = s->num_zones;
|
||||
status = s->status;
|
||||
server_status = s->status;
|
||||
}
|
||||
|
||||
void WorldServer::SendClientAuth(unsigned int ip, string account, string key, unsigned int account_id)
|
||||
{
|
||||
ServerPacket *outapp = new ServerPacket(ServerOP_LSClientAuth, sizeof(ServerLSClientAuth));
|
||||
ServerLSClientAuth* slsca = (ServerLSClientAuth*)outapp->pBuffer;
|
||||
ServerPacket *outapp = new ServerPacket(ServerOP_LSClientAuth, sizeof(ClientAuth_Struct));
|
||||
ClientAuth_Struct* client_auth = (ClientAuth_Struct*)outapp->pBuffer;
|
||||
|
||||
slsca->lsaccount_id = account_id;
|
||||
strncpy(slsca->name, account.c_str(), account.size() > 30 ? 30 : account.size());
|
||||
strncpy(slsca->key, key.c_str(), 10);
|
||||
slsca->lsadmin = 0;
|
||||
slsca->worldadmin = 0;
|
||||
slsca->ip = ip;
|
||||
client_auth->lsaccount_id = account_id;
|
||||
strncpy(client_auth->name, account.c_str(), account.size() > 30 ? 30 : account.size());
|
||||
strncpy(client_auth->key, key.c_str(), 10);
|
||||
client_auth->lsadmin = 0;
|
||||
client_auth->worldadmin = 0;
|
||||
client_auth->ip = ip;
|
||||
|
||||
in_addr in;
|
||||
in.s_addr = ip; connection->GetrIP();
|
||||
@ -524,17 +523,14 @@ void WorldServer::SendClientAuth(unsigned int ip, string account, string key, un
|
||||
in.s_addr = connection->GetrIP();
|
||||
string world_address(inet_ntoa(in));
|
||||
|
||||
if(client_address.compare(world_address) == 0)
|
||||
{
|
||||
slsca->local = 1;
|
||||
if (client_address.compare(world_address) == 0) {
|
||||
client_auth->local = 1;
|
||||
}
|
||||
else if(client_address.find(server.options.GetLocalNetwork()) != string::npos)
|
||||
{
|
||||
slsca->local = 1;
|
||||
else if (client_address.find(server.options.GetLocalNetwork()) != string::npos) {
|
||||
client_auth->local = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
slsca->local = 0;
|
||||
else {
|
||||
client_auth->local = 0;
|
||||
}
|
||||
|
||||
connection->SendPacket(outapp);
|
||||
|
||||
@ -86,7 +86,7 @@ public:
|
||||
/**
|
||||
* Gets whether the server is authorized to show up on the server list or not.
|
||||
*/
|
||||
bool IsAuthorized() const { return authorized; }
|
||||
bool IsAuthorized() const { return is_server_authorized; }
|
||||
|
||||
/**
|
||||
* Gets the local ip of the server.
|
||||
@ -106,7 +106,7 @@ public:
|
||||
/**
|
||||
* Gets the status of the server.
|
||||
*/
|
||||
int GetStatus() const { return status; }
|
||||
int GetStatus() const { return server_status; }
|
||||
|
||||
/**
|
||||
* Gets the number of zones online on the server.
|
||||
@ -138,7 +138,7 @@ private:
|
||||
EmuTCPConnection *connection;
|
||||
unsigned int zones_booted;
|
||||
unsigned int players_online;
|
||||
int status;
|
||||
int server_status;
|
||||
unsigned int runtime_id;
|
||||
unsigned int server_list_id;
|
||||
unsigned int server_type;
|
||||
@ -151,9 +151,9 @@ private:
|
||||
std::string local_ip;
|
||||
std::string protocol;
|
||||
std::string version;
|
||||
bool authorized;
|
||||
bool logged_in;
|
||||
bool trusted;
|
||||
bool is_server_authorized;
|
||||
bool is_server_logged_in;
|
||||
bool is_server_trusted;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -145,7 +145,7 @@ bool LoginServer::Process() {
|
||||
break;
|
||||
}
|
||||
case ServerOP_LSClientAuth: {
|
||||
ServerLSClientAuth* slsca = (ServerLSClientAuth*) pack->pBuffer;
|
||||
ClientAuth_Struct* slsca = (ClientAuth_Struct*) pack->pBuffer;
|
||||
|
||||
if (RuleI(World, AccountSessionLimit) >= 0) {
|
||||
// Enforce the limit on the number of characters on the same account that can be
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user