summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatheus Macabu <mkbu95@gmail.com>2013-07-03 03:53:14 -0300
committerMatheus Macabu <mkbu95@gmail.com>2013-07-03 03:53:14 -0300
commit5479f9631f8579d03fbfd14d8a49c7976226a156 (patch)
tree554f0f90dd0518a72e8fdea7e4207697c9481551
parent0b2fc3888b9d09b397a829db4af3f8d35cdaabb9 (diff)
downloadhercules-5479f9631f8579d03fbfd14d8a49c7976226a156.tar.gz
hercules-5479f9631f8579d03fbfd14d8a49c7976226a156.tar.bz2
hercules-5479f9631f8579d03fbfd14d8a49c7976226a156.tar.xz
hercules-5479f9631f8579d03fbfd14d8a49c7976226a156.zip
Dropped engine setting, closing bug #7455.
Signed-off-by: Matheus Macabu <mkbu95@gmail.com>
-rwxr-xr-xHercules-10.sln8
-rw-r--r--conf/login-server.conf4
-rw-r--r--src/login/account.h20
-rw-r--r--src/login/login.c86
-rw-r--r--src/login/login.h2
5 files changed, 19 insertions, 101 deletions
diff --git a/Hercules-10.sln b/Hercules-10.sln
index f8bbc88c1..f61f4655f 100755
--- a/Hercules-10.sln
+++ b/Hercules-10.sln
@@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual C++ Express 2010
+# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "char-server", "vcproj-10\char-server.vcxproj", "{D356871D-58E1-450B-967A-E4E9646175AF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "login-server", "vcproj-10\login-server.vcxproj", "{D356871D-58E1-450B-967A-E5E9646175AF}"
@@ -8,7 +8,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "map-server", "vcproj-10\map
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mapcache", "vcproj-10\mapcache.vcxproj", "{D356871D-58E1-450B-967A-E7E9646175AF}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "plugin-sample", "vcproj-10\plugin-sample.vcxproj", "{F4A5705B-BED6-47AB-9135-2D39838F14DC}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "plugin-sample", "vcproj-10\plugin-sample.vcxproj", "{E64C56D3-CDFB-483B-900B-A62D216B6D2F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -32,8 +32,8 @@ Global
{D356871D-58E1-450B-967A-E7E9646175AF}.Debug|Win32.Build.0 = Debug|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Release|Win32.ActiveCfg = Release|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Release|Win32.Build.0 = Release|Win32
- {F4A5705B-BED6-47AB-9135-2D39838F14DC}.Debug|Win32.ActiveCfg = Debug|Win32
- {F4A5705B-BED6-47AB-9135-2D39838F14DC}.Release|Win32.ActiveCfg = Release|Win32
+ {E64C56D3-CDFB-483B-900B-A62D216B6D2F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E64C56D3-CDFB-483B-900B-A62D216B6D2F}.Release|Win32.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/conf/login-server.conf b/conf/login-server.conf
index fd1ef45f5..37dbef821 100644
--- a/conf/login-server.conf
+++ b/conf/login-server.conf
@@ -123,10 +123,6 @@ dnsbl_servers: bl.blocklist.de, socks.dnsbl.sorbs.net
// socks.dnsbl.sorbs.net Open SOCKS proxy servers
// tor.ahbl.org Current tor relay and exit nodes
-// Which account engine to use.
-// 'auto' selects the first engine available (txt, sql, then others)
-// (defaults to auto)
-account.engine: auto
// Account data storage configuration
// SQL
diff --git a/src/login/account.h b/src/login/account.h
index be5bad988..999c93075 100644
--- a/src/login/account.h
+++ b/src/login/account.h
@@ -14,26 +14,6 @@ typedef struct AccountDBIterator AccountDBIterator;
// standard engines
AccountDB* account_db_sql(void);
-// extra engines (will probably use the other txt functions)
-#define ACCOUNTDB_CONSTRUCTOR_(engine) account_db_##engine
-#define ACCOUNTDB_CONSTRUCTOR(engine) ACCOUNTDB_CONSTRUCTOR_(engine)
-#ifdef ACCOUNTDB_ENGINE_0
-AccountDB* ACCOUNTDB_CONSTRUCTOR(ACCOUNTDB_ENGINE_0)(void);
-#endif
-#ifdef ACCOUNTDB_ENGINE_1
-AccountDB* ACCOUNTDB_CONSTRUCTOR(ACCOUNTDB_ENGINE_1)(void);
-#endif
-#ifdef ACCOUNTDB_ENGINE_2
-AccountDB* ACCOUNTDB_CONSTRUCTOR(ACCOUNTDB_ENGINE_2)(void);
-#endif
-#ifdef ACCOUNTDB_ENGINE_3
-AccountDB* ACCOUNTDB_CONSTRUCTOR(ACCOUNTDB_ENGINE_3)(void);
-#endif
-#ifdef ACCOUNTDB_ENGINE_4
-AccountDB* ACCOUNTDB_CONSTRUCTOR(ACCOUNTDB_ENGINE_4)(void);
-#endif
-
-
struct mmo_account
{
int account_id;
diff --git a/src/login/login.c b/src/login/login.c
index e8f136ba9..2d84ef58f 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -25,30 +25,13 @@ struct Login_Config login_config;
int login_fd; // login server socket
struct mmo_char_server server[MAX_SERVERS]; // char server data
-// Account engines available
-static struct{
+static struct account_engine {
AccountDB* (*constructor)(void);
AccountDB* db;
-} account_engines[] = {
- {account_db_sql, NULL},
-#ifdef ACCOUNTDB_ENGINE_0
- {ACCOUNTDB_CONSTRUCTOR(ACCOUNTDB_ENGINE_0), NULL},
-#endif
-#ifdef ACCOUNTDB_ENGINE_1
- {ACCOUNTDB_CONSTRUCTOR(ACCOUNTDB_ENGINE_1), NULL},
-#endif
-#ifdef ACCOUNTDB_ENGINE_2
- {ACCOUNTDB_CONSTRUCTOR(ACCOUNTDB_ENGINE_2), NULL},
-#endif
-#ifdef ACCOUNTDB_ENGINE_3
- {ACCOUNTDB_CONSTRUCTOR(ACCOUNTDB_ENGINE_3), NULL},
-#endif
-#ifdef ACCOUNTDB_ENGINE_4
- {ACCOUNTDB_CONSTRUCTOR(ACCOUNTDB_ENGINE_4), NULL},
-#endif
- // end of structure
- {NULL, NULL}
+} account_engine[] = {
+ {account_db_sql, NULL}
};
+
// account database
AccountDB* accounts = NULL;
@@ -1578,7 +1561,6 @@ void login_set_defaults()
login_config.dynamic_pass_failure_ban_duration = 5;
login_config.use_dnsbl = false;
safestrncpy(login_config.dnsbl_servs, "", sizeof(login_config.dnsbl_servs));
- safestrncpy(login_config.account_engine, "auto", sizeof(login_config.account_engine));
login_config.client_hash_check = 0;
login_config.client_hash_nodes = NULL;
@@ -1685,18 +1667,7 @@ int login_config_read(const char* cfgName)
else if(!strcmpi(w1, "import"))
login_config_read(w2);
else
- if(!strcmpi(w1, "account.engine"))
- safestrncpy(login_config.account_engine, w2, sizeof(login_config.account_engine));
- else
- {// try the account engines
- int i;
- for( i = 0; account_engines[i].constructor; ++i )
- {
- AccountDB* db = account_engines[i].db;
- if( db && db->set_property(db, w1, w2) )
- break;
- }
- // try others
+ {
ipban_config_read(w1, w2);
loginlog_config_read(w1, w2);
}
@@ -1706,28 +1677,6 @@ int login_config_read(const char* cfgName)
return 0;
}
-/// Get the engine selected in the config settings.
-/// Updates the config setting with the selected engine if 'auto'.
-static AccountDB* get_account_engine(void)
-{
- int i;
- bool get_first = (strcmp(login_config.account_engine,"auto") == 0);
-
- for( i = 0; account_engines[i].constructor; ++i )
- {
- char name[sizeof(login_config.account_engine)];
- AccountDB* db = account_engines[i].db;
- if( db && db->get_property(db, "engine.name", name, sizeof(name)) &&
- (get_first || strcmp(name, login_config.account_engine) == 0) )
- {
- if( get_first )
- safestrncpy(login_config.account_engine, name, sizeof(login_config.account_engine));
- return db;
- }
- }
- return NULL;
-}
-
//--------------------------------------
// Function called at exit of the server
//--------------------------------------
@@ -1751,16 +1700,12 @@ void do_final(void)
ipban_final();
- for( i = 0; account_engines[i].constructor; ++i )
- {// destroy all account engines
- AccountDB* db = account_engines[i].db;
- if( db )
- {
- db->destroy(db);
- account_engines[i].db = NULL;
- }
+ if( account_engine[0].db )
+ {// destroy account engine
+ account_engine[0].db->destroy(account_engine[0].db);
+ account_engine[0].db = NULL;
}
- accounts = NULL; // destroyed in account_engines
+ accounts = NULL; // destroyed in account_engine
online_db->destroy(online_db, NULL);
auth_db->destroy(auth_db, NULL);
@@ -1813,9 +1758,8 @@ int do_init(int argc, char** argv)
{
int i;
- // intialize engines (to accept config settings)
- for( i = 0; account_engines[i].constructor; ++i )
- account_engines[i].db = account_engines[i].constructor();
+ // intialize engine (to accept config settings)
+ account_engine[0].db = account_engine[0].constructor();
// read login-server configuration
login_set_defaults();
@@ -1855,14 +1799,14 @@ int do_init(int argc, char** argv)
}
// Account database init
- accounts = get_account_engine();
+ accounts = account_engine[0].db;
if( accounts == NULL ) {
- ShowFatalError("do_init: account engine '%s' not found.\n", login_config.account_engine);
+ ShowFatalError("do_init: account engine 'sql' not found.\n");
exit(EXIT_FAILURE);
} else {
if(!accounts->init(accounts)) {
- ShowFatalError("do_init: Failed to initialize account engine '%s'.\n", login_config.account_engine);
+ ShowFatalError("do_init: Failed to initialize account engine 'sql'.\n");
exit(EXIT_FAILURE);
}
}
diff --git a/src/login/login.h b/src/login/login.h
index 3cfea8bdc..8a5eabb09 100644
--- a/src/login/login.h
+++ b/src/login/login.h
@@ -84,8 +84,6 @@ struct Login_Config {
bool use_dnsbl; // dns blacklist blocking ?
char dnsbl_servs[1024]; // comma-separated list of dnsbl servers
- char account_engine[256]; // name of the engine to use (defaults to auto, for the first available engine)
-
int client_hash_check; // flags for checking client md5
struct client_hash_node *client_hash_nodes; // linked list containg md5 hash for each gm group
};