summaryrefslogtreecommitdiff
path: root/src
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 /src
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>
Diffstat (limited to 'src')
-rw-r--r--src/login/account.h20
-rw-r--r--src/login/login.c86
-rw-r--r--src/login/login.h2
3 files changed, 15 insertions, 93 deletions
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
};