summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Hercules.xcodeproj/project.pbxproj24
-rw-r--r--src/common/HPMDataCheck.h17
-rw-r--r--src/common/HPMSymbols.inc.h28
-rw-r--r--src/login/HPMlogin.c4
-rw-r--r--src/login/Makefile.in2
-rw-r--r--src/login/account.c (renamed from src/login/account_sql.c)123
-rw-r--r--src/login/account.h70
-rw-r--r--src/login/ipban.c (renamed from src/login/ipban_sql.c)120
-rw-r--r--src/login/ipban.h46
-rw-r--r--src/login/lclif.c26
-rw-r--r--src/login/login.c206
-rw-r--r--src/login/login.h20
-rw-r--r--src/login/loginlog.c (renamed from src/login/loginlog_sql.c)107
-rw-r--r--src/login/loginlog.h38
-rw-r--r--src/plugins/HPMHooking.c3
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc86
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc160
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc43
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.Hooks.inc1045
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.sources.inc4
-rw-r--r--vcproj-11/login-server.vcxproj6
-rw-r--r--vcproj-11/login-server.vcxproj.filters6
-rw-r--r--vcproj-12/login-server.vcxproj6
-rw-r--r--vcproj-12/login-server.vcxproj.filters6
-rw-r--r--vcproj-14/login-server.vcxproj6
-rw-r--r--vcproj-14/login-server.vcxproj.filters6
26 files changed, 1868 insertions, 340 deletions
diff --git a/Hercules.xcodeproj/project.pbxproj b/Hercules.xcodeproj/project.pbxproj
index 4609880aa..2b1363e10 100644
--- a/Hercules.xcodeproj/project.pbxproj
+++ b/Hercules.xcodeproj/project.pbxproj
@@ -25,10 +25,10 @@
A55AED7C1B8153F100149CF8 /* scanner.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC72918564C05009EB79C /* scanner.c */; };
A55AED7D1B8153F300149CF8 /* strbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC72B18564C05009EB79C /* strbuf.c */; };
A567612D185D11D700997C0D /* nullpo.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC6B2185643BB009EB79C /* nullpo.c */; };
- A56CC68918564387009EB79C /* account_sql.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC68118564387009EB79C /* account_sql.c */; };
- A56CC68A18564387009EB79C /* ipban_sql.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC68318564387009EB79C /* ipban_sql.c */; };
+ A56CC68918564387009EB79C /* account.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC68118564387009EB79C /* account.c */; };
+ A56CC68A18564387009EB79C /* ipban.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC68318564387009EB79C /* ipban.c */; };
A56CC68B18564387009EB79C /* login.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC68518564387009EB79C /* login.c */; };
- A56CC68C18564387009EB79C /* loginlog_sql.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC68718564387009EB79C /* loginlog_sql.c */; };
+ A56CC68C18564387009EB79C /* loginlog.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC68718564387009EB79C /* loginlog.c */; };
A56CC6C9185643BB009EB79C /* conf.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC690185643BB009EB79C /* conf.c */; };
A56CC6CA185643BB009EB79C /* conf.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC690185643BB009EB79C /* conf.c */; };
A56CC6CB185643BB009EB79C /* conf.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC690185643BB009EB79C /* conf.c */; };
@@ -239,13 +239,13 @@
A56CC66A18564315009EB79C /* login-server */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "login-server"; sourceTree = BUILT_PRODUCTS_DIR; };
A56CC6731856434D009EB79C /* char-server */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "char-server"; sourceTree = BUILT_PRODUCTS_DIR; };
A56CC67C18564356009EB79C /* map-server */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "map-server"; sourceTree = BUILT_PRODUCTS_DIR; };
- A56CC68118564387009EB79C /* account_sql.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = account_sql.c; path = src/login/account_sql.c; sourceTree = SOURCE_ROOT; };
+ A56CC68118564387009EB79C /* account.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = account.c; path = src/login/account.c; sourceTree = SOURCE_ROOT; };
A56CC68218564387009EB79C /* account.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = account.h; path = src/login/account.h; sourceTree = SOURCE_ROOT; };
- A56CC68318564387009EB79C /* ipban_sql.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ipban_sql.c; path = src/login/ipban_sql.c; sourceTree = SOURCE_ROOT; };
+ A56CC68318564387009EB79C /* ipban.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ipban.c; path = src/login/ipban.c; sourceTree = SOURCE_ROOT; };
A56CC68418564387009EB79C /* ipban.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ipban.h; path = src/login/ipban.h; sourceTree = SOURCE_ROOT; };
A56CC68518564387009EB79C /* login.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = login.c; path = src/login/login.c; sourceTree = SOURCE_ROOT; };
A56CC68618564387009EB79C /* login.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = login.h; path = src/login/login.h; sourceTree = SOURCE_ROOT; };
- A56CC68718564387009EB79C /* loginlog_sql.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loginlog_sql.c; path = src/login/loginlog_sql.c; sourceTree = SOURCE_ROOT; };
+ A56CC68718564387009EB79C /* loginlog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loginlog.c; path = src/login/loginlog.c; sourceTree = SOURCE_ROOT; };
A56CC68818564387009EB79C /* loginlog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = loginlog.h; path = src/login/loginlog.h; sourceTree = SOURCE_ROOT; };
A56CC68E185643BB009EB79C /* atomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = atomic.h; path = src/common/atomic.h; sourceTree = "<group>"; };
A56CC68F185643BB009EB79C /* cbasetypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cbasetypes.h; path = src/common/cbasetypes.h; sourceTree = "<group>"; };
@@ -565,13 +565,13 @@
A5296FCC1CAC40CF001ABCAC /* lclif.p.h */,
A5B894A81A03CDD4005AD22E /* HPMlogin.c */,
A5B894A91A03CDD4005AD22E /* HPMlogin.h */,
- A56CC68118564387009EB79C /* account_sql.c */,
+ A56CC68118564387009EB79C /* account.c */,
A56CC68218564387009EB79C /* account.h */,
- A56CC68318564387009EB79C /* ipban_sql.c */,
+ A56CC68318564387009EB79C /* ipban.c */,
A56CC68418564387009EB79C /* ipban.h */,
A56CC68518564387009EB79C /* login.c */,
A56CC68618564387009EB79C /* login.h */,
- A56CC68718564387009EB79C /* loginlog_sql.c */,
+ A56CC68718564387009EB79C /* loginlog.c */,
A56CC68818564387009EB79C /* loginlog.h */,
);
path = "login-server";
@@ -1208,7 +1208,7 @@
A5B894AA1A03CDD4005AD22E /* HPMlogin.c in Sources */,
A5296FCD1CAC40CF001ABCAC /* lclif.c in Sources */,
A56CC6DE185643BB009EB79C /* grfio.c in Sources */,
- A56CC68C18564387009EB79C /* loginlog_sql.c in Sources */,
+ A56CC68C18564387009EB79C /* loginlog.c in Sources */,
A56CC73118564C05009EB79C /* libconfig.c in Sources */,
A56CC717185643BB009EB79C /* utils.c in Sources */,
A56CC708185643BB009EB79C /* sql.c in Sources */,
@@ -1225,13 +1225,13 @@
A56CC6CC185643BB009EB79C /* console.c in Sources */,
A56CC72E18564C05009EB79C /* grammar.c in Sources */,
A56CC705185643BB009EB79C /* socket.c in Sources */,
- A56CC68918564387009EB79C /* account_sql.c in Sources */,
+ A56CC68918564387009EB79C /* account.c in Sources */,
A56CC6E4185643BB009EB79C /* memmgr.c in Sources */,
A56CC6E1185643BB009EB79C /* HPM.c in Sources */,
A56CC6FF185643BB009EB79C /* random.c in Sources */,
A56CC73418564C05009EB79C /* scanctx.c in Sources */,
A56CC714185643BB009EB79C /* timer.c in Sources */,
- A56CC68A18564387009EB79C /* ipban_sql.c in Sources */,
+ A56CC68A18564387009EB79C /* ipban.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h
index f2812a275..fe4745e79 100644
--- a/src/common/HPMDataCheck.h
+++ b/src/common/HPMDataCheck.h
@@ -309,11 +309,20 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
#ifdef LOGIN_ACCOUNT_H
{ "Account_engine", sizeof(struct Account_engine), SERVER_TYPE_LOGIN },
{ "AccountDB", sizeof(struct AccountDB), SERVER_TYPE_LOGIN },
+ { "AccountDB_SQL", sizeof(struct AccountDB_SQL), SERVER_TYPE_LOGIN },
{ "AccountDBIterator", sizeof(struct AccountDBIterator), SERVER_TYPE_LOGIN },
+ { "AccountDBIterator_SQL", sizeof(struct AccountDBIterator_SQL), SERVER_TYPE_LOGIN },
+ { "account_interface", sizeof(struct account_interface), SERVER_TYPE_LOGIN },
{ "mmo_account", sizeof(struct mmo_account), SERVER_TYPE_LOGIN },
#else
#define LOGIN_ACCOUNT_H
#endif // LOGIN_ACCOUNT_H
+ #ifdef LOGIN_IPBAN_H
+ { "ipban_interface", sizeof(struct ipban_interface), SERVER_TYPE_LOGIN },
+ { "s_ipban_dbs", sizeof(struct s_ipban_dbs), SERVER_TYPE_LOGIN },
+ #else
+ #define LOGIN_IPBAN_H
+ #endif // LOGIN_IPBAN_H
#ifdef LOGIN_LCLIF_H
{ "lclif_interface", sizeof(struct lclif_interface), SERVER_TYPE_LOGIN },
{ "login_packet_db", sizeof(struct login_packet_db), SERVER_TYPE_LOGIN },
@@ -341,14 +350,22 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
#else
#define LOGIN_LCLIF_P_H
#endif // LOGIN_LCLIF_P_H
+ #ifdef LOGIN_LOGINLOG_H
+ { "loginlog_interface", sizeof(struct loginlog_interface), SERVER_TYPE_LOGIN },
+ { "s_loginlog_dbs", sizeof(struct s_loginlog_dbs), SERVER_TYPE_LOGIN },
+ #else
+ #define LOGIN_LOGINLOG_H
+ #endif // LOGIN_LOGINLOG_H
#ifdef LOGIN_LOGIN_H
{ "Login_Config", sizeof(struct Login_Config), SERVER_TYPE_LOGIN },
{ "client_hash_node", sizeof(struct client_hash_node), SERVER_TYPE_LOGIN },
+ { "lchrif_interface", sizeof(struct lchrif_interface), SERVER_TYPE_LOGIN },
{ "login_auth_node", sizeof(struct login_auth_node), SERVER_TYPE_LOGIN },
{ "login_interface", sizeof(struct login_interface), SERVER_TYPE_LOGIN },
{ "login_session_data", sizeof(struct login_session_data), SERVER_TYPE_LOGIN },
{ "mmo_char_server", sizeof(struct mmo_char_server), SERVER_TYPE_LOGIN },
{ "online_login_data", sizeof(struct online_login_data), SERVER_TYPE_LOGIN },
+ { "s_login_dbs", sizeof(struct s_login_dbs), SERVER_TYPE_LOGIN },
#else
#define LOGIN_LOGIN_H
#endif // LOGIN_LOGIN_H
diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h
index 6be9d547c..70de5cdef 100644
--- a/src/common/HPMSymbols.inc.h
+++ b/src/common/HPMSymbols.inc.h
@@ -29,6 +29,9 @@
#ifdef COMMON_UTILS_H /* HCache */
struct HCache_interface *HCache;
#endif // COMMON_UTILS_H
+#ifdef LOGIN_ACCOUNT_H /* account */
+struct account_interface *account;
+#endif // LOGIN_ACCOUNT_H
#ifdef MAP_ATCOMMAND_H /* atcommand */
struct atcommand_interface *atcommand;
#endif // MAP_ATCOMMAND_H
@@ -140,12 +143,18 @@ struct inter_storage_interface *inter_storage;
#ifdef MAP_INTIF_H /* intif */
struct intif_interface *intif;
#endif // MAP_INTIF_H
+#ifdef LOGIN_IPBAN_H /* ipban */
+struct ipban_interface *ipban;
+#endif // LOGIN_IPBAN_H
#ifdef MAP_IRC_BOT_H /* ircbot */
struct irc_bot_interface *ircbot;
#endif // MAP_IRC_BOT_H
#ifdef MAP_ITEMDB_H /* itemdb */
struct itemdb_interface *itemdb;
#endif // MAP_ITEMDB_H
+#ifdef LOGIN_LOGIN_H /* lchrif */
+struct lchrif_interface *lchrif;
+#endif // LOGIN_LOGIN_H
#ifdef LOGIN_LCLIF_H /* lclif */
struct lclif_interface *lclif;
#endif // LOGIN_LCLIF_H
@@ -161,6 +170,9 @@ struct login_interface *login;
#ifdef CHAR_LOGINIF_H /* loginif */
struct loginif_interface *loginif;
#endif // CHAR_LOGINIF_H
+#ifdef LOGIN_LOGINLOG_H /* loginlog */
+struct loginlog_interface *loginlog;
+#endif // LOGIN_LOGINLOG_H
#ifdef MAP_MAIL_H /* mail */
struct mail_interface *mail;
#endif // MAP_MAIL_H
@@ -289,6 +301,10 @@ HPExport const char *HPM_shared_symbols(int server_type)
if ((server_type&(SERVER_TYPE_ALL)) != 0 && !HPM_SYMBOL("HCache", HCache))
return "HCache";
#endif // COMMON_UTILS_H
+#ifdef LOGIN_ACCOUNT_H /* account */
+ if ((server_type&(SERVER_TYPE_LOGIN)) != 0 && !HPM_SYMBOL("account", account))
+ return "account";
+#endif // LOGIN_ACCOUNT_H
#ifdef MAP_ATCOMMAND_H /* atcommand */
if ((server_type&(SERVER_TYPE_MAP)) != 0 && !HPM_SYMBOL("atcommand", atcommand))
return "atcommand";
@@ -437,6 +453,10 @@ HPExport const char *HPM_shared_symbols(int server_type)
if ((server_type&(SERVER_TYPE_MAP)) != 0 && !HPM_SYMBOL("intif", intif))
return "intif";
#endif // MAP_INTIF_H
+#ifdef LOGIN_IPBAN_H /* ipban */
+ if ((server_type&(SERVER_TYPE_LOGIN)) != 0 && !HPM_SYMBOL("ipban", ipban))
+ return "ipban";
+#endif // LOGIN_IPBAN_H
#ifdef MAP_IRC_BOT_H /* ircbot */
if ((server_type&(SERVER_TYPE_MAP)) != 0 && !HPM_SYMBOL("ircbot", ircbot))
return "ircbot";
@@ -445,6 +465,10 @@ HPExport const char *HPM_shared_symbols(int server_type)
if ((server_type&(SERVER_TYPE_MAP)) != 0 && !HPM_SYMBOL("itemdb", itemdb))
return "itemdb";
#endif // MAP_ITEMDB_H
+#ifdef LOGIN_LOGIN_H /* lchrif */
+ if ((server_type&(SERVER_TYPE_LOGIN)) != 0 && !HPM_SYMBOL("lchrif", lchrif))
+ return "lchrif";
+#endif // LOGIN_LOGIN_H
#ifdef LOGIN_LCLIF_H /* lclif */
if ((server_type&(SERVER_TYPE_LOGIN)) != 0 && !HPM_SYMBOL("lclif", lclif))
return "lclif";
@@ -465,6 +489,10 @@ HPExport const char *HPM_shared_symbols(int server_type)
if ((server_type&(SERVER_TYPE_CHAR)) != 0 && !HPM_SYMBOL("loginif", loginif))
return "loginif";
#endif // CHAR_LOGINIF_H
+#ifdef LOGIN_LOGINLOG_H /* loginlog */
+ if ((server_type&(SERVER_TYPE_LOGIN)) != 0 && !HPM_SYMBOL("loginlog", loginlog))
+ return "loginlog";
+#endif // LOGIN_LOGINLOG_H
#ifdef MAP_MAIL_H /* mail */
if ((server_type&(SERVER_TYPE_MAP)) != 0 && !HPM_SYMBOL("mail", mail))
return "mail";
diff --git a/src/login/HPMlogin.c b/src/login/HPMlogin.c
index b35ac13cb..4f63da6ac 100644
--- a/src/login/HPMlogin.c
+++ b/src/login/HPMlogin.c
@@ -25,9 +25,11 @@
#include "common/cbasetypes.h"
#include "login/account.h"
+#include "login/ipban.h"
#include "login/lclif.h"
#include "login/lclif.p.h"
#include "login/login.h"
+#include "login/loginlog.h"
#include "common/HPMi.h"
#include "common/conf.h"
#include "common/console.h"
@@ -69,7 +71,7 @@ bool HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_da
}
void HPM_login_plugin_load_sub(struct hplugin *plugin) {
- plugin->hpi->sql_handle = account_db_sql_up(login->accounts);
+ plugin->hpi->sql_handle = account->db_sql_up(login->accounts);
}
void HPM_login_do_init(void) {
diff --git a/src/login/Makefile.in b/src/login/Makefile.in
index 69cc6a897..d0258deb0 100644
--- a/src/login/Makefile.in
+++ b/src/login/Makefile.in
@@ -40,7 +40,7 @@ MT19937AR_D = $(THIRDPARTY_D)/mt19937ar
MT19937AR_OBJ = $(MT19937AR_D)/mt19937ar.o
MT19937AR_H = $(MT19937AR_D)/mt19937ar.h
-LOGIN_C = account_sql.c HPMlogin.c ipban_sql.c lclif.c login.c loginlog_sql.c
+LOGIN_C = account.c HPMlogin.c ipban.c lclif.c login.c loginlog.c
LOGIN_OBJ = $(addprefix obj_sql/, $(patsubst %.c,%.o,$(LOGIN_C)))
LOGIN_H = login.h account.h HPMlogin.h ipban.h lclif.h loginlog.h
LOGIN_PH = lclif.p.h
diff --git a/src/login/account_sql.c b/src/login/account.c
index 66ede6cfa..cd480def9 100644
--- a/src/login/account_sql.c
+++ b/src/login/account.c
@@ -39,54 +39,8 @@
/// global defines
#define ACCOUNT_SQL_DB_VERSION 20110114
-/// internal structure
-typedef struct AccountDB_SQL
-{
- AccountDB vtable; // public interface
-
- struct Sql *accounts; // SQL accounts storage
-
- // Sql settings
- char db_hostname[32];
- uint16 db_port;
- char db_username[32];
- char db_password[100];
- char db_database[32];
- char codepage[32];
- // other settings
- bool case_sensitive;
- char account_db[32];
- char global_acc_reg_num_db[32];
- char global_acc_reg_str_db[32];
-
-
-} AccountDB_SQL;
-
-/// internal structure
-typedef struct AccountDBIterator_SQL
-{
- AccountDBIterator vtable; // public interface
-
- AccountDB_SQL* db;
- int last_account_id;
-} AccountDBIterator_SQL;
-
-/// internal functions
-static bool account_db_sql_init(AccountDB* self);
-static void account_db_sql_destroy(AccountDB* self);
-static bool account_db_sql_get_property(AccountDB* self, const char* key, char* buf, size_t buflen);
-static bool account_db_sql_set_property(AccountDB* self, struct config_t *config, bool imported);
-static bool account_db_sql_create(AccountDB* self, struct mmo_account* acc);
-static bool account_db_sql_remove(AccountDB* self, const int account_id);
-static bool account_db_sql_save(AccountDB* self, const struct mmo_account* acc);
-static bool account_db_sql_load_num(AccountDB* self, struct mmo_account* acc, const int account_id);
-static bool account_db_sql_load_str(AccountDB* self, struct mmo_account* acc, const char* userid);
-static AccountDBIterator* account_db_sql_iterator(AccountDB* self);
-static void account_db_sql_iter_destroy(AccountDBIterator* self);
-static bool account_db_sql_iter_next(AccountDBIterator* self, struct mmo_account* acc);
-
-static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int account_id);
-static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, bool is_new);
+struct account_interface account_s;
+struct account_interface *account;
/// public constructor
AccountDB* account_db_sql(void)
@@ -94,16 +48,16 @@ AccountDB* account_db_sql(void)
AccountDB_SQL* db = (AccountDB_SQL*)aCalloc(1, sizeof(AccountDB_SQL));
// set up the vtable
- db->vtable.init = &account_db_sql_init;
- db->vtable.destroy = &account_db_sql_destroy;
- db->vtable.get_property = &account_db_sql_get_property;
- db->vtable.set_property = &account_db_sql_set_property;
- db->vtable.save = &account_db_sql_save;
- db->vtable.create = &account_db_sql_create;
- db->vtable.remove = &account_db_sql_remove;
- db->vtable.load_num = &account_db_sql_load_num;
- db->vtable.load_str = &account_db_sql_load_str;
- db->vtable.iterator = &account_db_sql_iterator;
+ db->vtable.init = account->db_sql_init;
+ db->vtable.destroy = account->db_sql_destroy;
+ db->vtable.get_property = account->db_sql_get_property;
+ db->vtable.set_property = account->db_sql_set_property;
+ db->vtable.save = account->db_sql_save;
+ db->vtable.create = account->db_sql_create;
+ db->vtable.remove = account->db_sql_remove;
+ db->vtable.load_num = account->db_sql_load_num;
+ db->vtable.load_str = account->db_sql_load_str;
+ db->vtable.iterator = account->db_sql_iterator;
// initialize to default values
db->accounts = NULL;
@@ -123,10 +77,8 @@ AccountDB* account_db_sql(void)
return &db->vtable;
}
-
/* ------------------------------------------------------------------------- */
-
/// establishes database connection
static bool account_db_sql_init(AccountDB* self)
{
@@ -323,7 +275,7 @@ static bool account_db_sql_set_property(AccountDB* self, struct config_t *config
libconfig->setting_lookup_uint16(setting, "db_port", &db->db_port);
libconfig->setting_lookup_bool_real(setting, "case_sensitive", &db->case_sensitive);
- account_db_read_inter(db, "conf/common/inter-server.conf", imported);
+ account->db_read_inter(db, "conf/common/inter-server.conf", imported);
return true;
}
@@ -381,7 +333,7 @@ static bool account_db_sql_create(AccountDB* self, struct mmo_account* acc)
// insert the data into the database
acc->account_id = account_id;
- return mmo_auth_tosql(db, acc, true);
+ return account->mmo_auth_tosql(db, acc, true);
}
/// delete an existing account entry + its regs
@@ -411,14 +363,14 @@ static bool account_db_sql_remove(AccountDB* self, const int account_id)
static bool account_db_sql_save(AccountDB* self, const struct mmo_account* acc)
{
AccountDB_SQL* db = (AccountDB_SQL*)self;
- return mmo_auth_tosql(db, acc, false);
+ return account->mmo_auth_tosql(db, acc, false);
}
/// retrieve data from db and store it in the provided data structure
static bool account_db_sql_load_num(AccountDB* self, struct mmo_account* acc, const int account_id)
{
AccountDB_SQL* db = (AccountDB_SQL*)self;
- return mmo_auth_fromsql(db, acc, account_id);
+ return account->mmo_auth_fromsql(db, acc, account_id);
}
/// retrieve data from db and store it in the provided data structure
@@ -458,7 +410,7 @@ static bool account_db_sql_load_str(AccountDB* self, struct mmo_account* acc, co
SQL->GetData(sql_handle, 0, &data, NULL);
account_id = atoi(data);
- return account_db_sql_load_num(self, acc, account_id);
+ return account->db_sql_load_num(self, acc, account_id);
}
@@ -471,8 +423,8 @@ static AccountDBIterator* account_db_sql_iterator(AccountDB* self)
nullpo_retr(NULL, db);
iter = (AccountDBIterator_SQL*)aCalloc(1, sizeof(AccountDBIterator_SQL));
// set up the vtable
- iter->vtable.destroy = &account_db_sql_iter_destroy;
- iter->vtable.next = &account_db_sql_iter_next;
+ iter->vtable.destroy = account->db_sql_iter_destroy;
+ iter->vtable.next = account->db_sql_iter_next;
// fill data
iter->db = db;
@@ -516,8 +468,7 @@ static bool account_db_sql_iter_next(AccountDBIterator* self, struct mmo_account
{// get account data
int account_id;
account_id = atoi(data);
- if( mmo_auth_fromsql(db, acc, account_id) )
- {
+ if (account->mmo_auth_fromsql(db, acc, account_id)) {
iter->last_account_id = account_id;
SQL->FreeResult(sql_handle);
return true;
@@ -528,7 +479,7 @@ static bool account_db_sql_iter_next(AccountDBIterator* self, struct mmo_account
}
-static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int account_id)
+static bool account_mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int account_id)
{
struct Sql *sql_handle;
char* data;
@@ -573,7 +524,7 @@ static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int acc
return true;
}
-static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, bool is_new)
+static bool account_mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, bool is_new)
{
struct Sql *sql_handle;
struct SqlStmt *stmt;
@@ -673,7 +624,8 @@ struct Sql *account_db_sql_up(AccountDB* self)
AccountDB_SQL* db = (AccountDB_SQL*)self;
return db ? db->accounts : NULL;
}
-void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id)
+
+void account_mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id)
{
struct Sql *sql_handle;
AccountDB_SQL* db = (AccountDB_SQL*)self;
@@ -725,7 +677,7 @@ void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id)
}
}
-void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id)
+void account_mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id)
{
struct Sql *sql_handle;
AccountDB_SQL* db = (AccountDB_SQL*)self;
@@ -869,3 +821,28 @@ void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id)
SQL->FreeResult(sql_handle);
}
+
+void account_defaults(void) {
+ account = &account_s;
+
+ account->db_sql_up = account_db_sql_up;
+ account->mmo_send_accreg2 = account_mmo_send_accreg2;
+ account->mmo_save_accreg2 = account_mmo_save_accreg2;
+ account->mmo_auth_fromsql = account_mmo_auth_fromsql;
+ account->mmo_auth_tosql = account_mmo_auth_tosql;
+
+ account->db_sql = account_db_sql;
+ account->db_sql_init = account_db_sql_init;
+ account->db_sql_destroy = account_db_sql_destroy;
+ account->db_sql_get_property = account_db_sql_get_property;
+ account->db_sql_set_property = account_db_sql_set_property;
+ account->db_sql_create = account_db_sql_create;
+ account->db_sql_remove = account_db_sql_remove;
+ account->db_sql_save = account_db_sql_save;
+ account->db_sql_load_num = account_db_sql_load_num;
+ account->db_sql_load_str = account_db_sql_load_str;
+ account->db_sql_iterator = account_db_sql_iterator;
+ account->db_sql_iter_destroy = account_db_sql_iter_destroy;
+ account->db_sql_iter_next = account_db_sql_iter_next;
+ account->db_read_inter = account_db_read_inter;
+}
diff --git a/src/login/account.h b/src/login/account.h
index 9bb07fda3..8199ce3ba 100644
--- a/src/login/account.h
+++ b/src/login/account.h
@@ -33,12 +33,6 @@ struct config_t; // common/conf.h
typedef struct AccountDB AccountDB;
typedef struct AccountDBIterator AccountDBIterator;
-
-#ifdef HERCULES_CORE
-// standard engines
-AccountDB* account_db_sql(void);
-#endif // HERCULES_CORE
-
struct mmo_account
{
int account_id;
@@ -59,7 +53,6 @@ struct mmo_account
char birthdate[10+1]; // assigned birth date (format: YYYY-MM-DD, default: 0000-00-00)
};
-
struct AccountDBIterator
{
/// Destroys this iterator, releasing all allocated memory (including itself).
@@ -161,11 +154,66 @@ struct AccountDB
AccountDBIterator* (*iterator)(AccountDB* self);
};
-#ifdef HERCULES_CORE
-struct Sql *account_db_sql_up(AccountDB* self);
+typedef struct AccountDB_SQL
+{
+ AccountDB vtable; // public interface
+
+ struct Sql *accounts; // SQL accounts storage
+
+ // Sql settings
+ char db_hostname[32];
+ uint16 db_port;
+ char db_username[32];
+ char db_password[100];
+ char db_database[32];
+ char codepage[32];
+ // other settings
+ bool case_sensitive;
+ char account_db[32];
+ char global_acc_reg_num_db[32];
+ char global_acc_reg_str_db[32];
+} AccountDB_SQL;
+
+/// internal structure
+typedef struct AccountDBIterator_SQL
+{
+ AccountDBIterator vtable; // public interface
+
+ AccountDB_SQL* db;
+ int last_account_id;
+} AccountDBIterator_SQL;
-void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id);
-void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id);
+/**
+ * Account.c Interface
+ **/
+struct account_interface {
+ struct Sql* (*db_sql_up) (AccountDB* self);
+ void (*mmo_send_accreg2) (AccountDB* self, int fd, int account_id, int char_id);
+ void (*mmo_save_accreg2) (AccountDB* self, int fd, int account_id, int char_id);
+ bool (*mmo_auth_fromsql) (AccountDB_SQL* db, struct mmo_account* acc, int account_id);
+ bool (*mmo_auth_tosql) (AccountDB_SQL* db, const struct mmo_account* acc, bool is_new);
+
+ AccountDB* (*db_sql) (void);
+ bool (*db_sql_init) (AccountDB* self);
+ void (*db_sql_destroy) (AccountDB* self);
+ bool (*db_sql_get_property) (AccountDB* self, const char* key, char* buf, size_t buflen);
+ bool (*db_sql_set_property) (AccountDB* self, struct config_t *config, bool imported);
+ bool (*db_sql_create) (AccountDB* self, struct mmo_account* acc);
+ bool (*db_sql_remove) (AccountDB* self, const int account_id);
+ bool (*db_sql_save) (AccountDB* self, const struct mmo_account* acc);
+ bool (*db_sql_load_num) (AccountDB* self, struct mmo_account* acc, const int account_id);
+ bool (*db_sql_load_str) (AccountDB* self, struct mmo_account* acc, const char* userid);
+ AccountDBIterator* (*db_sql_iterator) (AccountDB* self);
+ void (*db_sql_iter_destroy) (AccountDBIterator* self);
+ bool (*db_sql_iter_next) (AccountDBIterator* self, struct mmo_account* acc);
+
+ bool (*db_read_inter) (AccountDB_SQL *db, const char *filename, bool imported);
+};
+
+#ifdef HERCULES_CORE
+void account_defaults(void);
#endif // HERCULES_CORE
+HPShared struct account_interface *account;
+
#endif /* LOGIN_ACCOUNT_H */
diff --git a/src/login/ipban_sql.c b/src/login/ipban.c
index d74e6c4fa..60a90fec9 100644
--- a/src/login/ipban_sql.c
+++ b/src/login/ipban.c
@@ -34,49 +34,36 @@
#include <stdlib.h>
-// Sql settings
-static char ipban_db_hostname[32] = "127.0.0.1";
-static uint16 ipban_db_port = 3306;
-static char ipban_db_username[32] = "ragnarok";
-static char ipban_db_password[100] = "ragnarok";
-static char ipban_db_database[32] = "ragnarok";
-static char ipban_codepage[32] = "";
-static char ipban_table[32] = "ipbanlist";
-
-// globals
-static struct Sql *sql_handle = NULL;
-static int cleanup_timer_id = INVALID_TIMER;
-static bool ipban_inited = false;
-
-int ipban_cleanup(int tid, int64 tick, int id, intptr_t data);
-
+struct ipban_interface ipban_s;
+struct ipban_interface *ipban;
+struct s_ipban_dbs ipbandbs;
// initialize
void ipban_init(void)
{
- ipban_inited = true;
+ ipban->inited = true;
if (!login->config->ipban)
return;// ipban disabled
// establish connections
- sql_handle = SQL->Malloc();
- if (SQL_ERROR == SQL->Connect(sql_handle, ipban_db_username, ipban_db_password,
- ipban_db_hostname, ipban_db_port, ipban_db_database)) {
- Sql_ShowDebug(sql_handle);
- SQL->Free(sql_handle);
+ ipban->sql_handle = SQL->Malloc();
+ if (SQL_ERROR == SQL->Connect(ipban->sql_handle, ipban->dbs->db_username, ipban->dbs->db_password,
+ ipban->dbs->db_hostname, ipban->dbs->db_port, ipban->dbs->db_database)) {
+ Sql_ShowDebug(ipban->sql_handle);
+ SQL->Free(ipban->sql_handle);
exit(EXIT_FAILURE);
}
- if (ipban_codepage[0] != '\0' && SQL_ERROR == SQL->SetEncoding(sql_handle, ipban_codepage))
- Sql_ShowDebug(sql_handle);
+ if (ipban->dbs->codepage[0] != '\0' && SQL_ERROR == SQL->SetEncoding(ipban->sql_handle, ipban->dbs->codepage))
+ Sql_ShowDebug(ipban->sql_handle);
if (login->config->ipban_cleanup_interval > 0) {
// set up periodic cleanup of connection history and active bans
- timer->add_func_list(ipban_cleanup, "ipban_cleanup");
- cleanup_timer_id = timer->add_interval(timer->gettick()+10, ipban_cleanup, 0, 0, login->config->ipban_cleanup_interval*1000);
+ timer->add_func_list(ipban->cleanup, "ipban_cleanup");
+ ipban->cleanup_timer_id = timer->add_interval(timer->gettick()+10, ipban->cleanup, 0, 0, login->config->ipban_cleanup_interval*1000);
} else {
// make sure it gets cleaned up on login-server start regardless of interval-based cleanups
- ipban_cleanup(0,0,0,0);
+ ipban->cleanup(0,0,0,0);
}
}
@@ -88,13 +75,13 @@ void ipban_final(void)
if (login->config->ipban_cleanup_interval > 0)
// release data
- timer->delete(cleanup_timer_id, ipban_cleanup);
+ timer->delete(ipban->cleanup_timer_id, ipban->cleanup);
- ipban_cleanup(0,0,0,0); // always clean up on login-server stop
+ ipban->cleanup(0,0,0,0); // always clean up on login-server stop
// close connections
- SQL->Free(sql_handle);
- sql_handle = NULL;
+ SQL->Free(ipban->sql_handle);
+ ipban->sql_handle = NULL;
}
/**
@@ -126,14 +113,14 @@ bool ipban_config_read_inter(const char *filename, bool imported)
ShowError("ipban_config_read: inter_configuration/database_names was not found!\n");
return false;
}
- libconfig->setting_lookup_mutable_string(setting, "ipban_table", ipban_table, sizeof(ipban_table));
+ libconfig->setting_lookup_mutable_string(setting, "ipban_table", ipban->dbs->table, sizeof(ipban->dbs->table));
// import should overwrite any previous configuration, so it should be called last
if (libconfig->lookup_string(&config, "import", &import) == CONFIG_TRUE) {
if (strcmp(import, filename) == 0 || strcmp(import, "conf/common/inter-server.conf") == 0) {
ShowWarning("ipban_config_read_inter: Loop detected! Skipping 'import'...\n");
} else {
- if (!ipban_config_read_inter(import, true))
+ if (!ipban->config_read_inter(import, true))
retval = false;
}
}
@@ -165,13 +152,13 @@ bool ipban_config_read_connection(const char *filename, struct config_t *config,
return false;
}
- libconfig->setting_lookup_mutable_string(setting, "db_hostname", ipban_db_hostname, sizeof(ipban_db_hostname));
- libconfig->setting_lookup_mutable_string(setting, "db_database", ipban_db_database, sizeof(ipban_db_database));
+ libconfig->setting_lookup_mutable_string(setting, "db_hostname", ipban->dbs->db_hostname, sizeof(ipban->dbs->db_hostname));
+ libconfig->setting_lookup_mutable_string(setting, "db_database", ipban->dbs->db_database, sizeof(ipban->dbs->db_database));
- libconfig->setting_lookup_mutable_string(setting, "db_username", ipban_db_username, sizeof(ipban_db_username));
- libconfig->setting_lookup_mutable_string(setting, "db_password", ipban_db_password, sizeof(ipban_db_password));
- libconfig->setting_lookup_mutable_string(setting, "codepage", ipban_codepage, sizeof(ipban_codepage));
- libconfig->setting_lookup_uint16(setting, "db_port", &ipban_db_port);
+ libconfig->setting_lookup_mutable_string(setting, "db_username", ipban->dbs->db_username, sizeof(ipban->dbs->db_username));
+ libconfig->setting_lookup_mutable_string(setting, "db_password", ipban->dbs->db_password, sizeof(ipban->dbs->db_password));
+ libconfig->setting_lookup_mutable_string(setting, "codepage", ipban->dbs->codepage, sizeof(ipban->dbs->codepage));
+ libconfig->setting_lookup_uint16(setting, "db_port", &ipban->dbs->db_port);
return true;
}
@@ -224,7 +211,7 @@ bool ipban_config_read(const char *filename, struct config_t *config, bool impor
nullpo_retr(false, filename);
nullpo_retr(false, config);
- if (ipban_inited)
+ if (ipban->inited)
return false; // settings can only be changed before init
if ((setting = libconfig->lookup(config, "login_configuration/account/ipban")) == NULL) {
@@ -256,20 +243,20 @@ bool ipban_check(uint32 ip)
if (!login->config->ipban)
return false;// ipban disabled
- if( SQL_ERROR == SQL->Query(sql_handle, "SELECT count(*) FROM `%s` WHERE `rtime` > NOW() AND (`list` = '%u.*.*.*' OR `list` = '%u.%u.*.*' OR `list` = '%u.%u.%u.*' OR `list` = '%u.%u.%u.%u')",
- ipban_table, p[3], p[3], p[2], p[3], p[2], p[1], p[3], p[2], p[1], p[0]) )
+ if( SQL_ERROR == SQL->Query(ipban->sql_handle, "SELECT count(*) FROM `%s` WHERE `rtime` > NOW() AND (`list` = '%u.*.*.*' OR `list` = '%u.%u.*.*' OR `list` = '%u.%u.%u.*' OR `list` = '%u.%u.%u.%u')",
+ ipban->dbs->table, p[3], p[3], p[2], p[3], p[2], p[1], p[3], p[2], p[1], p[0]) )
{
- Sql_ShowDebug(sql_handle);
+ Sql_ShowDebug(ipban->sql_handle);
// close connection because we can't verify their connectivity.
return true;
}
- if( SQL_SUCCESS != SQL->NextRow(sql_handle) )
+ if( SQL_SUCCESS != SQL->NextRow(ipban->sql_handle) )
return false;
- SQL->GetData(sql_handle, 0, &data, NULL);
+ SQL->GetData(ipban->sql_handle, 0, &data, NULL);
matches = atoi(data);
- SQL->FreeResult(sql_handle);
+ SQL->FreeResult(ipban->sql_handle);
return( matches > 0 );
}
@@ -282,16 +269,16 @@ void ipban_log(uint32 ip)
if (!login->config->ipban)
return;// ipban disabled
- failures = loginlog_failedattempts(ip, login->config->dynamic_pass_failure_ban_interval);// how many times failed account? in one ip.
+ failures = loginlog->failedattempts(ip, login->config->dynamic_pass_failure_ban_interval);// how many times failed account? in one ip.
// if over the limit, add a temporary ban entry
if (failures >= login->config->dynamic_pass_failure_ban_limit)
{
uint8* p = (uint8*)&ip;
- if (SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s`(`list`,`btime`,`rtime`,`reason`) VALUES ('%u.%u.%u.*', NOW() , NOW() + INTERVAL %u MINUTE ,'Password error ban')",
- ipban_table, p[3], p[2], p[1], login->config->dynamic_pass_failure_ban_duration))
+ if (SQL_ERROR == SQL->Query(ipban->sql_handle, "INSERT INTO `%s`(`list`,`btime`,`rtime`,`reason`) VALUES ('%u.%u.%u.*', NOW() , NOW() + INTERVAL %u MINUTE ,'Password error ban')",
+ ipban->dbs->table, p[3], p[2], p[1], login->config->dynamic_pass_failure_ban_duration))
{
- Sql_ShowDebug(sql_handle);
+ Sql_ShowDebug(ipban->sql_handle);
}
}
}
@@ -301,8 +288,37 @@ int ipban_cleanup(int tid, int64 tick, int id, intptr_t data) {
if (!login->config->ipban)
return 0;// ipban disabled
- if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `rtime` <= NOW()", ipban_table) )
- Sql_ShowDebug(sql_handle);
+ if( SQL_ERROR == SQL->Query(ipban->sql_handle, "DELETE FROM `%s` WHERE `rtime` <= NOW()", ipban->dbs->table) )
+ Sql_ShowDebug(ipban->sql_handle);
return 0;
}
+
+void ipban_defaults(void) {
+ ipban = &ipban_s;
+
+ ipban->dbs = &ipbandbs;
+
+ ipban->sql_handle = NULL;
+ ipban->cleanup_timer_id = INVALID_TIMER;
+ ipban->inited = false;
+
+ // Sql settings
+ strcpy(ipban->dbs->db_hostname, "127.0.0.1");
+ ipban->dbs->db_port = 3306;
+ strcpy(ipban->dbs->db_username, "ragnarok");
+ strcpy(ipban->dbs->db_password, "ragnarok");
+ strcpy(ipban->dbs->db_database, "ragnarok");
+ *ipban->dbs->codepage = 0;
+ strcpy(ipban->dbs->table, "ipbanlist");
+
+ ipban->init = ipban_init;
+ ipban->final = ipban_final;
+ ipban->cleanup = ipban_cleanup;
+ ipban->config_read_inter = ipban_config_read_inter;
+ ipban->config_read_connection = ipban_config_read_connection;
+ ipban->config_read_dynamic = ipban_config_read_dynamic;
+ ipban->config_read = ipban_config_read;
+ ipban->check = ipban_check;
+ ipban->log = ipban_log;
+}
diff --git a/src/login/ipban.h b/src/login/ipban.h
index 104e3a8a3..29aafba9d 100644
--- a/src/login/ipban.h
+++ b/src/login/ipban.h
@@ -22,26 +22,44 @@
#define LOGIN_IPBAN_H
#include "common/cbasetypes.h"
+#include "common/hercules.h"
/* Forward Declarations */
struct config_t; // common/conf.h
-#ifdef HERCULES_CORE
-// TODO: Interface
-// initialize
-void ipban_init(void);
-
-// finalize
-void ipban_final(void);
-
-// check ip against ban list
-bool ipban_check(uint32 ip);
+struct s_ipban_dbs {
+ char db_hostname[32];
+ uint16 db_port;
+ char db_username[32];
+ char db_password[100];
+ char db_database[32];
+ char codepage[32];
+ char table[32];
+};
-// increases failure count for the specified IP
-void ipban_log(uint32 ip);
+/**
+ * Ipban.c Interface
+ **/
+struct ipban_interface {
+ struct s_ipban_dbs *dbs;
+ struct Sql *sql_handle;
+ int cleanup_timer_id;
+ bool inited;
+ void (*init) (void);
+ void (*final) (void);
+ int (*cleanup) (int tid, int64 tick, int id, intptr_t data);
+ bool (*config_read_inter) (const char *filename, bool imported);
+ bool (*config_read_connection) (const char *filename, struct config_t *config, bool imported);
+ bool (*config_read_dynamic) (const char *filename, struct config_t *config, bool imported);
+ bool (*config_read) (const char *filename, struct config_t *config, bool imported);
+ bool (*check) (uint32 ip);
+ void (*log) (uint32 ip);
+};
-// parses configuration options
-bool ipban_config_read(const char *filename, struct config_t *config, bool imported);
+#ifdef HERCULES_CORE
+void ipban_defaults(void);
#endif // HERCULES_CORE
+HPShared struct ipban_interface *ipban;
+
#endif /* LOGIN_IPBAN_H */
diff --git a/src/login/lclif.c b/src/login/lclif.c
index 1870f9bc9..ae9f035e3 100644
--- a/src/login/lclif.c
+++ b/src/login/lclif.c
@@ -257,8 +257,8 @@ bool lclif_send_server_list(struct login_session_data *sd)
uint32 ip;
struct packet_AC_ACCEPT_LOGIN *packet = NULL;
- for (i = 0; i < ARRAYLENGTH(server); ++i) {
- if (sockt->session_is_active(server[i].fd))
+ for (i = 0; i < ARRAYLENGTH(login->dbs->server); ++i) {
+ if (sockt->session_is_active(login->dbs->server[i].fd))
server_num++;
}
if (server_num == 0)
@@ -283,24 +283,24 @@ bool lclif_send_server_list(struct login_session_data *sd)
packet->last_login_ip = 0; // Not used anymore
memset(packet->last_login_time, '\0', sizeof(packet->last_login_time)); // Not used anymore
packet->sex = sex_str2num(sd->sex);
- for (i = 0, n = 0; i < ARRAYLENGTH(server); ++i) {
+ for (i = 0, n = 0; i < ARRAYLENGTH(login->dbs->server); ++i) {
uint32 subnet_char_ip;
- if (!sockt->session_is_valid(server[i].fd))
+ if (!sockt->session_is_valid(login->dbs->server[i].fd))
continue;
subnet_char_ip = login->lan_subnet_check(ip);
- packet->server_list[n].ip = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip);
- packet->server_list[n].port = sockt->ntows(htons(server[i].port)); // [!] LE byte order here [!]
- safestrncpy(packet->server_list[n].name, server[i].name, 20);
- packet->server_list[n].usercount = login->convert_users_to_colors(server[i].users);
+ packet->server_list[n].ip = htonl((subnet_char_ip) ? subnet_char_ip : login->dbs->server[i].ip);
+ packet->server_list[n].port = sockt->ntows(htons(login->dbs->server[i].port)); // [!] LE byte order here [!]
+ safestrncpy(packet->server_list[n].name, login->dbs->server[i].name, 20);
+ packet->server_list[n].usercount = login->convert_users_to_colors(login->dbs->server[i].users);
- if (server[i].type == CST_PAYING && sd->expiration_time > time(NULL))
+ if (login->dbs->server[i].type == CST_PAYING && sd->expiration_time > time(NULL))
packet->server_list[n].property = CST_NORMAL;
else
- packet->server_list[n].property = server[i].type;
+ packet->server_list[n].property = login->dbs->server[i].type;
- packet->server_list[n].state = server[i].new_;
+ packet->server_list[n].state = login->dbs->server[i].new_;
++n;
}
WFIFOSET(sd->fd, length);
@@ -373,9 +373,9 @@ int lclif_parse(int fd)
if ((sd = sockt->session[fd]->session_data) == NULL) {
// Perform ip-ban check
- if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban_check(ipl)) {
+ if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban->check(ipl)) {
ShowStatus("Connection refused: IP isn't authorized (deny/allow, ip: %s).\n", ip);
- login_log(ipl, "unknown", -3, "ip banned");
+ loginlog->log(ipl, "unknown", -3, "ip banned");
lclif->login_error(fd, 3); // 3 = Rejected from Server
sockt->eof(fd);
return 0;
diff --git a/src/login/login.c b/src/login/login.c
index a78276051..5b281c22d 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -52,12 +52,12 @@
struct login_interface login_s;
struct login_interface *login;
+struct s_login_dbs logindbs;
+struct lchrif_interface lchrif_s;
+struct lchrif_interface *lchrif;
struct Login_Config login_config_;
-struct mmo_char_server server[MAX_SERVERS]; // char server data
-struct Account_engine account_engine[] = {
- {account_db_sql, NULL}
-};
+struct Account_engine account_engine;
// account database
AccountDB* accounts = NULL;
@@ -164,9 +164,9 @@ int charif_sendallwos(int sfd, uint8* buf, size_t len)
int i, c;
nullpo_ret(buf);
- for( i = 0, c = 0; i < ARRAYLENGTH(server); ++i )
+ for (i = 0, c = 0; i < ARRAYLENGTH(login->dbs->server); ++i)
{
- int fd = server[i].fd;
+ int fd = login->dbs->server[i].fd;
if (sockt->session_is_valid(fd) && fd != sfd) {
WFIFOHEAD(fd,len);
memcpy(WFIFOP(fd,0), buf, len);
@@ -180,41 +180,41 @@ int charif_sendallwos(int sfd, uint8* buf, size_t len)
/// Initializes a server structure.
-void chrif_server_init(int id)
+void lchrif_server_init(int id)
{
Assert_retv(id >= 0 && id < MAX_SERVERS);
- memset(&server[id], 0, sizeof(server[id]));
- server[id].fd = -1;
+ memset(&login->dbs->server[id], 0, sizeof(login->dbs->server[id]));
+ login->dbs->server[id].fd = -1;
}
/// Destroys a server structure.
-void chrif_server_destroy(int id)
+void lchrif_server_destroy(int id)
{
Assert_retv(id >= 0 && id < MAX_SERVERS);
- if (server[id].fd != -1)
+ if (login->dbs->server[id].fd != -1)
{
- sockt->close(server[id].fd);
- server[id].fd = -1;
+ sockt->close(login->dbs->server[id].fd);
+ login->dbs->server[id].fd = -1;
}
}
/// Resets all the data related to a server.
-void chrif_server_reset(int id)
+void lchrif_server_reset(int id)
{
login->online_db->foreach(login->online_db, login->online_db_setoffline, id); //Set all chars from this char server to offline.
- chrif_server_destroy(id);
- chrif_server_init(id);
+ lchrif->server_destroy(id);
+ lchrif->server_init(id);
}
/// Called when the connection to Char Server is disconnected.
-void chrif_on_disconnect(int id)
+void lchrif_on_disconnect(int id)
{
Assert_retv(id >= 0 && id < MAX_SERVERS);
- ShowStatus("Char-server '%s' has disconnected.\n", server[id].name);
- chrif_server_reset(id);
+ ShowStatus("Char-server '%s' has disconnected.\n", login->dbs->server[id].name);
+ lchrif->server_reset(id);
}
@@ -324,7 +324,7 @@ void login_fromchar_parse_auth(int fd, int id, const char *const ip)
node->sex == sex_num2str(sex) /*&&
node->ip == ip_*/ )
{// found
- //ShowStatus("Char-server '%s': authentication of the account %d accepted (ip: %s).\n", server[id].name, account_id, ip);
+ //ShowStatus("Char-server '%s': authentication of the account %d accepted (ip: %s).\n", login->dbs->server[id].name, account_id, ip);
// send ack
login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, node);
@@ -334,7 +334,7 @@ void login_fromchar_parse_auth(int fd, int id, const char *const ip)
else
{// authentication not found
nullpo_retv(ip);
- ShowStatus("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n", server[id].name, account_id, ip);
+ ShowStatus("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n", login->dbs->server[id].name, account_id, ip);
login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, NULL);
}
}
@@ -345,11 +345,11 @@ void login_fromchar_parse_update_users(int fd, int id)
RFIFOSKIP(fd,6);
// how many users on world? (update)
- if( server[id].users != users )
+ if (login->dbs->server[id].users != users)
{
- ShowStatus("set users %s : %d\n", server[id].name, users);
+ ShowStatus("set users %s : %d\n", login->dbs->server[id].name, users);
- server[id].users = (uint16)users;
+ login->dbs->server[id].users = (uint16)users;
}
}
@@ -363,13 +363,13 @@ void login_fromchar_parse_request_change_email(int fd, int id, const char *const
RFIFOSKIP(fd,46);
if( e_mail_check(email) == 0 )
- ShowNotice("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n", login->dbs->server[id].name, account_id, ip);
else
if( !accounts->load_num(accounts, &acc, account_id) || strcmp(acc.email, "a@a.com") == 0 || acc.email[0] == '\0' )
- ShowNotice("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n", login->dbs->server[id].name, account_id, ip);
else {
memcpy(acc.email, email, sizeof(acc.email));
- ShowNotice("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n", server[id].name, account_id, email, ip);
+ ShowNotice("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n", login->dbs->server[id].name, account_id, email, ip);
// Save
accounts->save(accounts, &acc);
}
@@ -428,7 +428,7 @@ void login_fromchar_parse_account_data(int fd, int id, const char *const ip)
if( !accounts->load_num(accounts, &acc, account_id) )
{
- ShowNotice("Char-server '%s': account %d NOT found (ip: %s).\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': account %d NOT found (ip: %s).\n", login->dbs->server[id].name, account_id, ip);
login->fromchar_account(fd, account_id, NULL);
}
else {
@@ -461,22 +461,22 @@ void login_fromchar_parse_change_email(int fd, int id, const char *const ip)
RFIFOSKIP(fd, 86);
if( e_mail_check(actual_email) == 0 )
- ShowNotice("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n", login->dbs->server[id].name, account_id, ip);
else
if( e_mail_check(new_email) == 0 )
- ShowNotice("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n", login->dbs->server[id].name, account_id, ip);
else
if( strcmpi(new_email, "a@a.com") == 0 )
- ShowNotice("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n", login->dbs->server[id].name, account_id, ip);
else
if( !accounts->load_num(accounts, &acc, account_id) )
- ShowNotice("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n", login->dbs->server[id].name, account_id, ip);
else
if( strcmpi(acc.email, actual_email) != 0 )
- ShowNotice("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n", server[id].name, account_id, acc.userid, acc.email, actual_email, ip);
+ ShowNotice("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n", login->dbs->server[id].name, account_id, acc.userid, acc.email, actual_email, ip);
else {
safestrncpy(acc.email, new_email, sizeof(acc.email));
- ShowNotice("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n", server[id].name, account_id, acc.userid, new_email, ip);
+ ShowNotice("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n", login->dbs->server[id].name, account_id, acc.userid, new_email, ip);
// Save
accounts->save(accounts, &acc);
}
@@ -501,12 +501,12 @@ void login_fromchar_parse_account_update(int fd, int id, const char *const ip)
RFIFOSKIP(fd,10);
if( !accounts->load_num(accounts, &acc, account_id) )
- ShowNotice("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n", server[id].name, account_id, state, ip);
+ ShowNotice("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n", login->dbs->server[id].name, account_id, state, ip);
else
if( acc.state == state )
- ShowNotice("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n", server[id].name, account_id, state, ip);
+ ShowNotice("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n", login->dbs->server[id].name, account_id, state, ip);
else {
- ShowNotice("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n", server[id].name, account_id, state, ip);
+ ShowNotice("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n", login->dbs->server[id].name, account_id, state, ip);
acc.state = state;
// Save
@@ -543,7 +543,7 @@ void login_fromchar_parse_ban(int fd, int id, const char *const ip)
RFIFOSKIP(fd,18);
if (!accounts->load_num(accounts, &acc, account_id)) {
- ShowNotice("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n", login->dbs->server[id].name, account_id, ip);
} else {
time_t timestamp;
struct tm *tmtime;
@@ -560,14 +560,14 @@ void login_fromchar_parse_ban(int fd, int id, const char *const ip)
tmtime->tm_sec += sec;
timestamp = mktime(tmtime);
if (timestamp == -1) {
- ShowNotice("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n", login->dbs->server[id].name, account_id, ip);
} else if( timestamp <= time(NULL) || timestamp == 0 ) {
- ShowNotice("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n", login->dbs->server[id].name, account_id, ip);
} else {
char tmpstr[24];
timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login->config->date_format);
ShowNotice("Char-server '%s': Ban request (account: %d, new final date of banishment: %ld (%s), ip: %s).\n",
- server[id].name, account_id, (long)timestamp, tmpstr, ip);
+ login->dbs->server[id].name, account_id, (long)timestamp, tmpstr, ip);
acc.unban_time = timestamp;
@@ -596,15 +596,15 @@ void login_fromchar_parse_change_sex(int fd, int id, const char *const ip)
RFIFOSKIP(fd,6);
if( !accounts->load_num(accounts, &acc, account_id) )
- ShowNotice("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n", login->dbs->server[id].name, account_id, ip);
else
if( acc.sex == 'S' )
- ShowNotice("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n", login->dbs->server[id].name, account_id, ip);
else
{
char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; //Change gender
- ShowNotice("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n", server[id].name, account_id, sex, ip);
+ ShowNotice("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n", login->dbs->server[id].name, account_id, sex, ip);
acc.sex = sex;
// Save
@@ -622,9 +622,9 @@ void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip)
int account_id = RFIFOL(fd,4);
if( !accounts->load_num(accounts, &acc, account_id) )
- ShowStatus("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n", server[id].name, account_id, ip);
+ ShowStatus("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n", login->dbs->server[id].name, account_id, ip);
else {
- mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8));
+ account->mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8));
}
RFIFOSKIP(fd,RFIFOW(fd,2));
}
@@ -637,13 +637,13 @@ void login_fromchar_parse_unban(int fd, int id, const char *const ip)
RFIFOSKIP(fd,6);
if( !accounts->load_num(accounts, &acc, account_id) )
- ShowNotice("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n", login->dbs->server[id].name, account_id, ip);
else
if( acc.unban_time == 0 )
- ShowNotice("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n", login->dbs->server[id].name, account_id, ip);
else
{
- ShowNotice("Char-server '%s': Unban request (account: %d, ip: %s).\n", server[id].name, account_id, ip);
+ ShowNotice("Char-server '%s': Unban request (account: %d, ip: %s).\n", login->dbs->server[id].name, account_id, ip);
acc.unban_time = 0;
accounts->save(accounts, &acc);
}
@@ -684,13 +684,13 @@ void login_fromchar_parse_request_account_reg2(int fd)
int char_id = RFIFOL(fd,6);
RFIFOSKIP(fd,10);
- mmo_send_accreg2(accounts,fd,account_id,char_id);
+ account->mmo_send_accreg2(accounts,fd,account_id,char_id);
}
void login_fromchar_parse_update_wan_ip(int fd, int id)
{
- server[id].ip = ntohl(RFIFOL(fd,2));
- ShowInfo("Updated IP of Server #%d to %u.%u.%u.%u.\n",id, CONVIP(server[id].ip));
+ login->dbs->server[id].ip = ntohl(RFIFOL(fd,2));
+ ShowInfo("Updated IP of Server #%d to %u.%u.%u.%u.\n",id, CONVIP(login->dbs->server[id].ip));
RFIFOSKIP(fd,6);
}
@@ -725,7 +725,7 @@ bool login_fromchar_parse_wrong_pincode(int fd)
return true;
}
- login_log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); // FIXME: Do we really want to log this with the same code as successful logins?
+ loginlog->log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); // FIXME: Do we really want to log this with the same code as successful logins?
}
login->remove_online_user(acc.account_id);
@@ -794,8 +794,8 @@ int login_parse_fromchar(int fd)
uint32 ipl;
char ip[16];
- ARR_FIND( 0, ARRAYLENGTH(server), id, server[id].fd == fd );
- if( id == ARRAYLENGTH(server) )
+ ARR_FIND(0, ARRAYLENGTH(login->dbs->server), id, login->dbs->server[id].fd == fd);
+ if (id == ARRAYLENGTH(login->dbs->server))
{// not a char server
ShowDebug("login_parse_fromchar: Disconnecting invalid session #%d (is not a char-server)\n", fd);
sockt->eof(fd);
@@ -806,12 +806,12 @@ int login_parse_fromchar(int fd)
if( sockt->session[fd]->flag.eof )
{
sockt->close(fd);
- server[id].fd = -1;
- chrif_on_disconnect(id);
+ login->dbs->server[id].fd = -1;
+ lchrif->on_disconnect(id);
return 0;
}
- ipl = server[id].ip;
+ ipl = login->dbs->server[id].ip;
sockt->ip2str(ipl, ip);
while (RFIFOREST(fd) >= 2) {
@@ -1258,7 +1258,7 @@ void login_auth_ok(struct login_session_data* sd)
return;
}
- login_log(ip, sd->userid, 100, "login ok");
+ loginlog->log(ip, sd->userid, 100, "login ok");
ShowStatus("Connection of the account '%s' accepted.\n", sd->userid);
// create temporary auth entry
@@ -1322,11 +1322,11 @@ void login_auth_failed(struct login_session_data *sd, int result)
default : error = "Unknown Error."; break;
}
- login_log(ip, sd->userid, result, error); // FIXME: result can be 100, conflicting with the value 100 we use for successful login...
+ loginlog->log(ip, sd->userid, result, error); // FIXME: result can be 100, conflicting with the value 100 we use for successful login...
}
if (result == 1 && login->config->dynamic_pass_failure_ban && !sockt->trusted_ip_check(ip))
- ipban_log(ip); // log failed password attempt
+ ipban->log(ip); // log failed password attempt
if (result == 6) {
struct mmo_account acc = { 0 };
@@ -1430,25 +1430,25 @@ void login_parse_request_connection(int fd, struct login_session_data* sd, const
ShowInfo("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n", server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip);
sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port);
- login_log(sockt->session[fd]->client_addr, sd->userid, 100, message);
+ loginlog->log(sockt->session[fd]->client_addr, sd->userid, 100, message);
result = login->mmo_auth(sd, true);
if (core->runflag == LOGINSERVER_ST_RUNNING &&
result == -1 &&
sd->sex == 'S' &&
sd->account_id >= 0 &&
- sd->account_id < ARRAYLENGTH(server) &&
- !sockt->session_is_valid(server[sd->account_id].fd) &&
+ sd->account_id < ARRAYLENGTH(login->dbs->server) &&
+ !sockt->session_is_valid(login->dbs->server[sd->account_id].fd) &&
sockt->allowed_ip_check(ipl))
{
ShowStatus("Connection of the char-server '%s' accepted.\n", server_name);
- safestrncpy(server[sd->account_id].name, server_name, sizeof(server[sd->account_id].name));
- server[sd->account_id].fd = fd;
- server[sd->account_id].ip = server_ip;
- server[sd->account_id].port = server_port;
- server[sd->account_id].users = 0;
- server[sd->account_id].type = type;
- server[sd->account_id].new_ = new_;
+ safestrncpy(login->dbs->server[sd->account_id].name, server_name, sizeof(login->dbs->server[sd->account_id].name));
+ login->dbs->server[sd->account_id].fd = fd;
+ login->dbs->server[sd->account_id].ip = server_ip;
+ login->dbs->server[sd->account_id].port = server_port;
+ login->dbs->server[sd->account_id].users = 0;
+ login->dbs->server[sd->account_id].type = type;
+ login->dbs->server[sd->account_id].new_ = new_;
sockt->session[fd]->func_parse = login->parse_fromchar;
sockt->session[fd]->flag.server = 1;
@@ -1607,7 +1607,7 @@ bool login_config_read_log(const char *filename, struct config_t *config, bool i
bool login_config_read_account(const char *filename, struct config_t *config, bool imported)
{
struct config_setting_t *setting = NULL;
- AccountDB *db = account_engine[0].db;
+ AccountDB *db = login->dbs->account_engine->db;
bool retval = true;
nullpo_retr(false, filename);
@@ -1630,7 +1630,7 @@ bool login_config_read_account(const char *filename, struct config_t *config, bo
if (!db->set_property(db, config, imported))
retval = false;
- if (!ipban_config_read(filename, config, imported))
+ if (!ipban->config_read(filename, config, imported))
retval = false;
return retval;
@@ -1913,7 +1913,7 @@ bool login_config_read(const char *filename, bool imported)
if (!login->config_read_users(filename, &config, imported))
retval = false;
- if (!loginlog_config_read("conf/common/inter-server.conf", imported)) // Only inter-server
+ if (!loginlog->config_read("conf/common/inter-server.conf", imported)) // Only inter-server
retval = false;
if (!HPM->parse_conf(&config, filename, HPCT_LOGIN, imported))
@@ -1973,24 +1973,24 @@ int do_final(void)
login->clear_client_hash_nodes();
login->clear_dnsbl_servers();
- login_log(0, "login server", 100, "login server shutdown");
+ loginlog->log(0, "login server", 100, "login server shutdown");
if (login->config->log_login)
- loginlog_final();
+ loginlog->final();
- ipban_final();
+ ipban->final();
- if( account_engine[0].db )
+ if (login->dbs->account_engine->db)
{// destroy account engine
- account_engine[0].db->destroy(account_engine[0].db);
- account_engine[0].db = NULL;
+ login->dbs->account_engine->db->destroy(login->dbs->account_engine->db);
+ login->dbs->account_engine->db = NULL;
}
accounts = NULL; // destroyed in account_engine
login->online_db->destroy(login->online_db, NULL);
login->auth_db->destroy(login->auth_db, NULL);
- for( i = 0; i < ARRAYLENGTH(server); ++i )
- chrif_server_destroy(i);
+ for (i = 0; i < ARRAYLENGTH(login->dbs->server); ++i)
+ lchrif->server_destroy(i);
if( login->fd != -1 )
{
@@ -2033,8 +2033,8 @@ void do_shutdown_login(void)
core->runflag = LOGINSERVER_ST_SHUTDOWN;
ShowStatus("Shutting down...\n");
// TODO proper shutdown procedure; kick all characters, wait for acks, ... [FlavioJS]
- for( id = 0; id < ARRAYLENGTH(server); ++id )
- chrif_server_reset(id);
+ for (id = 0; id < ARRAYLENGTH(login->dbs->server); ++id)
+ lchrif->server_reset(id);
sockt->flush_fifos();
core->runflag = CORE_ST_STOP;
}
@@ -2094,16 +2094,22 @@ int do_init(int argc, char** argv)
{
int i;
+ account_defaults();
+ login_defaults();
+
// initialize engine (to accept config settings)
- account_engine[0].db = account_engine[0].constructor();
- accounts = account_engine[0].db;
+ login->dbs->account_engine->constructor = account->db_sql;
+ login->dbs->account_engine->db = login->dbs->account_engine->constructor();
+ accounts = login->dbs->account_engine->db;
if( accounts == NULL ) {
ShowFatalError("do_init: account engine 'sql' not found.\n");
exit(EXIT_FAILURE);
}
- login_defaults();
+ ipban_defaults();
+ lchrif_defaults();
lclif_defaults();
+ loginlog_defaults();
// read login-server configuration
login->config_set_defaults();
@@ -2142,15 +2148,15 @@ int do_init(int argc, char** argv)
login->config_read(login->LOGIN_CONF_NAME, false);
sockt->net_config_read(login->NET_CONF_NAME);
- for( i = 0; i < ARRAYLENGTH(server); ++i )
- chrif_server_init(i);
+ for (i = 0; i < ARRAYLENGTH(login->dbs->server); ++i)
+ lchrif->server_init(i);
// initialize logging
if (login->config->log_login)
- loginlog_init();
+ loginlog->init();
// initialize static and dynamic ipban system
- ipban_init();
+ ipban->init();
// Online user database init
login->online_db = idb_alloc(DB_OPT_RELEASE_DATA);
@@ -2196,18 +2202,23 @@ int do_init(int argc, char** argv)
#endif // CONSOLE_INPUT
ShowStatus("The login-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %u).\n\n", login->config->login_port);
- login_log(0, "login server", 100, "login server started");
+ loginlog->log(0, "login server", 100, "login server started");
HPM->event(HPET_READY);
return 0;
}
-void login_defaults(void) {
+void login_defaults(void)
+{
login = &login_s;
login->config = &login_config_;
login->accounts = accounts;
+ login->dbs = &logindbs;
+ login->dbs->account_engine = &account_engine;
+ login->dbs->account_engine->constructor = NULL;
+ login->dbs->account_engine->db = NULL;
login->mmo_auth = login_mmo_auth;
login->mmo_auth_new = login_mmo_auth_new;
@@ -2279,3 +2290,12 @@ void login_defaults(void) {
login->LOGIN_CONF_NAME = NULL;
login->NET_CONF_NAME = NULL;
}
+
+void lchrif_defaults(void)
+{
+ lchrif = &lchrif_s;
+ lchrif->server_init = lchrif_server_init;
+ lchrif->server_destroy = lchrif_server_destroy;
+ lchrif->server_reset = lchrif_server_reset;
+ lchrif->on_disconnect = lchrif_on_disconnect;
+}
diff --git a/src/login/login.h b/src/login/login.h
index 3af54ef50..1a4a6d0a3 100644
--- a/src/login/login.h
+++ b/src/login/login.h
@@ -157,6 +157,11 @@ struct online_login_data {
#define MAX_SERVERS 30
+struct s_login_dbs {
+ struct mmo_char_server server[MAX_SERVERS];
+ struct Account_engine *account_engine;
+};
+
/**
* Login.c Interface
**/
@@ -166,6 +171,7 @@ struct login_interface {
int fd;
struct Login_Config *config;
struct AccountDB* accounts;
+ struct s_login_dbs *dbs;
int (*mmo_auth) (struct login_session_data* sd, bool isServer);
int (*mmo_auth_new) (const char* userid, const char* pass, const char sex, const char* last_ip);
@@ -234,12 +240,22 @@ struct login_interface {
char *NET_CONF_NAME; ///< Network configuration filename
};
-#ifdef HERCULES_CORE
-extern struct mmo_char_server server[MAX_SERVERS];
+/**
+ * Login.c Interface
+ **/
+struct lchrif_interface {
+ void (*server_init) (int id);
+ void (*server_destroy) (int id);
+ void (*server_reset) (int id);
+ void (*on_disconnect) (int id);
+};
+#ifdef HERCULES_CORE
void login_defaults(void);
+void lchrif_defaults(void);
#endif // HERCULES_CORE
HPShared struct login_interface *login;
+HPShared struct lchrif_interface *lchrif;
#endif /* LOGIN_LOGIN_H */
diff --git a/src/login/loginlog_sql.c b/src/login/loginlog.c
index 7dff14990..0e4cc79f0 100644
--- a/src/login/loginlog_sql.c
+++ b/src/login/loginlog.c
@@ -33,17 +33,10 @@
#include <stdlib.h> // exit
-// Sql settings
-static char log_db_hostname[32] = "127.0.0.1";
-static uint16 log_db_port = 3306;
-static char log_db_username[32] = "ragnarok";
-static char log_db_password[100] = "ragnarok";
-static char log_db_database[32] = "ragnarok";
-static char log_codepage[32] = "";
-static char log_login_db[256] = "loginlog";
-static struct Sql *sql_handle = NULL;
-static bool enabled = false;
+struct loginlog_interface loginlog_s;
+struct loginlog_interface *loginlog;
+struct s_loginlog_dbs loginlogdbs;
// Returns the number of failed login attempts by the ip in the last minutes.
@@ -51,19 +44,19 @@ unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes)
{
unsigned long failures = 0;
- if( !enabled )
+ if( !loginlog->enabled )
return 0;
- if( SQL_ERROR == SQL->Query(sql_handle, "SELECT count(*) FROM `%s` WHERE `ip` = '%s' AND `rcode` = '1' AND `time` > NOW() - INTERVAL %u MINUTE",
- log_login_db, sockt->ip2str(ip,NULL), minutes) )// how many times failed account? in one ip.
- Sql_ShowDebug(sql_handle);
+ if( SQL_ERROR == SQL->Query(loginlog->sql_handle, "SELECT count(*) FROM `%s` WHERE `ip` = '%s' AND `rcode` = '1' AND `time` > NOW() - INTERVAL %u MINUTE",
+ loginlog->dbs->log_login_db, sockt->ip2str(ip,NULL), minutes) )// how many times failed account? in one ip.
+ Sql_ShowDebug(loginlog->sql_handle);
- if( SQL_SUCCESS == SQL->NextRow(sql_handle) )
+ if( SQL_SUCCESS == SQL->NextRow(loginlog->sql_handle) )
{
char* data;
- SQL->GetData(sql_handle, 0, &data, NULL);
+ SQL->GetData(loginlog->sql_handle, 0, &data, NULL);
failures = strtoul(data, NULL, 10);
- SQL->FreeResult(sql_handle);
+ SQL->FreeResult(loginlog->sql_handle);
}
return failures;
}
@@ -73,7 +66,7 @@ unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes)
* Records an event in the login log
*---------------------------------------------*/
// TODO: add an enum of rcode values
-void login_log(uint32 ip, const char* username, int rcode, const char* message)
+void loginlog_log(uint32 ip, const char* username, int rcode, const char* message)
{
char esc_username[NAME_LENGTH*2+1];
char esc_message[255*2+1];
@@ -81,43 +74,43 @@ void login_log(uint32 ip, const char* username, int rcode, const char* message)
nullpo_retv(username);
nullpo_retv(message);
- if( !enabled )
+ if( !loginlog->enabled )
return;
- SQL->EscapeStringLen(sql_handle, esc_username, username, strnlen(username, NAME_LENGTH));
- SQL->EscapeStringLen(sql_handle, esc_message, message, strnlen(message, 255));
+ SQL->EscapeStringLen(loginlog->sql_handle, esc_username, username, strnlen(username, NAME_LENGTH));
+ SQL->EscapeStringLen(loginlog->sql_handle, esc_message, message, strnlen(message, 255));
- retcode = SQL->Query(sql_handle,
+ retcode = SQL->Query(loginlog->sql_handle,
"INSERT INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%s', '%s', '%d', '%s')",
- log_login_db, sockt->ip2str(ip,NULL), esc_username, rcode, esc_message);
+ loginlog->dbs->log_login_db, sockt->ip2str(ip,NULL), esc_username, rcode, esc_message);
if( retcode != SQL_SUCCESS )
- Sql_ShowDebug(sql_handle);
+ Sql_ShowDebug(loginlog->sql_handle);
}
bool loginlog_init(void)
{
- sql_handle = SQL->Malloc();
+ loginlog->sql_handle = SQL->Malloc();
- if (SQL_ERROR == SQL->Connect(sql_handle, log_db_username, log_db_password,
- log_db_hostname, log_db_port, log_db_database)) {
- Sql_ShowDebug(sql_handle);
- SQL->Free(sql_handle);
+ if (SQL_ERROR == SQL->Connect(loginlog->sql_handle, loginlog->dbs->log_db_username, loginlog->dbs->log_db_password,
+ loginlog->dbs->log_db_hostname, loginlog->dbs->log_db_port, loginlog->dbs->log_db_database)) {
+ Sql_ShowDebug(loginlog->sql_handle);
+ SQL->Free(loginlog->sql_handle);
exit(EXIT_FAILURE);
}
- if (log_codepage[0] != '\0' && SQL_ERROR == SQL->SetEncoding(sql_handle, log_codepage))
- Sql_ShowDebug(sql_handle);
+ if (loginlog->dbs->log_codepage[0] != '\0' && SQL_ERROR == SQL->SetEncoding(loginlog->sql_handle, loginlog->dbs->log_codepage))
+ Sql_ShowDebug(loginlog->sql_handle);
- enabled = true;
+ loginlog->enabled = true;
return true;
}
bool loginlog_final(void)
{
- SQL->Free(sql_handle);
- sql_handle = NULL;
+ SQL->Free(loginlog->sql_handle);
+ loginlog->sql_handle = NULL;
return true;
}
@@ -145,7 +138,7 @@ bool loginlog_config_read_names(const char *filename, struct config_t *config, b
return false;
}
- libconfig->setting_lookup_mutable_string(setting, "login_db", log_login_db, sizeof(log_login_db));
+ libconfig->setting_lookup_mutable_string(setting, "login_db", loginlog->dbs->log_login_db, sizeof(loginlog->dbs->log_login_db));
return true;
}
@@ -174,13 +167,13 @@ bool loginlog_config_read_log(const char *filename, struct config_t *config, boo
return false;
}
- libconfig->setting_lookup_mutable_string(setting, "db_hostname", log_db_hostname, sizeof(log_db_hostname));
- libconfig->setting_lookup_mutable_string(setting, "db_database", log_db_database, sizeof(log_db_database));
- libconfig->setting_lookup_mutable_string(setting, "db_username", log_db_username, sizeof(log_db_username));
- libconfig->setting_lookup_mutable_string(setting, "db_password", log_db_password, sizeof(log_db_password));
+ libconfig->setting_lookup_mutable_string(setting, "db_hostname", loginlog->dbs->log_db_hostname, sizeof(loginlog->dbs->log_db_hostname));
+ libconfig->setting_lookup_mutable_string(setting, "db_database", loginlog->dbs->log_db_database, sizeof(loginlog->dbs->log_db_database));
+ libconfig->setting_lookup_mutable_string(setting, "db_username", loginlog->dbs->log_db_username, sizeof(loginlog->dbs->log_db_username));
+ libconfig->setting_lookup_mutable_string(setting, "db_password", loginlog->dbs->log_db_password, sizeof(loginlog->dbs->log_db_password));
- libconfig->setting_lookup_uint16(setting, "db_port", &log_db_port);
- libconfig->setting_lookup_mutable_string(setting, "codepage", log_codepage, sizeof(log_codepage));
+ libconfig->setting_lookup_uint16(setting, "db_port", &loginlog->dbs->log_db_port);
+ libconfig->setting_lookup_mutable_string(setting, "codepage", loginlog->dbs->log_codepage, sizeof(loginlog->dbs->log_codepage));
return true;
}
@@ -206,16 +199,16 @@ bool loginlog_config_read(const char *filename, bool imported)
if (!libconfig->load_file(&config, filename))
return false; // Error message is already shown by libconfig->load_file
- if (!loginlog_config_read_names(filename, &config, imported))
+ if (!loginlog->config_read_names(filename, &config, imported))
retval = false;
- if (!loginlog_config_read_log(filename, &config, imported))
+ if (!loginlog->config_read_log(filename, &config, imported))
retval = false;
if (libconfig->lookup_string(&config, "import", &import) == CONFIG_TRUE) {
if (strcmp(import, filename) == 0 || strcmp(import, "conf/common/inter-server.conf") == 0) {
ShowWarning("inter_config_read: Loop detected! Skipping 'import'...\n");
} else {
- if (!loginlog_config_read(import, true))
+ if (!loginlog->config_read(import, true))
retval = false;
}
}
@@ -223,3 +216,29 @@ bool loginlog_config_read(const char *filename, bool imported)
libconfig->destroy(&config);
return retval;
}
+
+void loginlog_defaults(void)
+{
+ loginlog = &loginlog_s;
+ loginlog->dbs = &loginlogdbs;
+
+ loginlog->sql_handle = NULL;
+ loginlog->enabled = false;
+
+ // Sql settings
+ strcpy(loginlog->dbs->log_db_hostname, "127.0.0.1");
+ loginlog->dbs->log_db_port = 3306;
+ strcpy(loginlog->dbs->log_db_username, "ragnarok");
+ strcpy(loginlog->dbs->log_db_password, "ragnarok");
+ strcpy(loginlog->dbs->log_db_database, "ragnarok");
+ *loginlog->dbs->log_codepage = 0;
+ strcpy(loginlog->dbs->log_login_db, "loginlog");
+
+ loginlog->failedattempts = loginlog_failedattempts;
+ loginlog->log = loginlog_log;
+ loginlog->init = loginlog_init;
+ loginlog->final = loginlog_final;
+ loginlog->config_read_names = loginlog_config_read_names;
+ loginlog->config_read_log = loginlog_config_read_log;
+ loginlog->config_read = loginlog_config_read;
+}
diff --git a/src/login/loginlog.h b/src/login/loginlog.h
index 589bc4fa1..fecb9b364 100644
--- a/src/login/loginlog.h
+++ b/src/login/loginlog.h
@@ -21,15 +21,41 @@
#ifndef LOGIN_LOGINLOG_H
#define LOGIN_LOGINLOG_H
+#include "common/hercules.h"
#include "common/cbasetypes.h"
+struct config_t;
+
+struct s_loginlog_dbs {
+ char log_db_hostname[32];
+ uint16 log_db_port;
+ char log_db_username[32];
+ char log_db_password[100];
+ char log_db_database[32];
+ char log_codepage[32];
+ char log_login_db[256];
+};
+
+/**
+ * Loginlog.c Interface
+ **/
+struct loginlog_interface {
+ struct Sql *sql_handle;
+ bool enabled;
+ struct s_loginlog_dbs *dbs;
+ unsigned long (*failedattempts) (uint32 ip, unsigned int minutes);
+ void (*log) (uint32 ip, const char* username, int rcode, const char* message);
+ bool (*init) (void);
+ bool (*final) (void);
+ bool (*config_read_names) (const char *filename, struct config_t *config, bool imported);
+ bool (*config_read_log) (const char *filename, struct config_t *config, bool imported);
+ bool (*config_read) (const char *filename, bool imported);
+};
+
#ifdef HERCULES_CORE
-// TODO: Interface
-unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes);
-void login_log(uint32 ip, const char* username, int rcode, const char* message);
-bool loginlog_init(void);
-bool loginlog_final(void);
-bool loginlog_config_read(const char *filename, bool imported);
+void loginlog_defaults(void);
#endif // HERCULES_CORE
+HPShared struct loginlog_interface *loginlog;
+
#endif /* LOGIN_LOGINLOG_H */
diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c
index 99b4e63e7..8686a07be 100644
--- a/src/plugins/HPMHooking.c
+++ b/src/plugins/HPMHooking.c
@@ -34,9 +34,12 @@ PRAGMA_GCC5(GCC diagnostic ignored "-Wdiscarded-qualifiers")
#define HPM_HOOKS_INCLUDE "HPMHooking/HPMHooking_login.Hooks.inc"
#define HPM_POINTS_INCLUDE "HPMHooking/HPMHooking_login.HookingPoints.inc"
#define HPM_SOURCES_INCLUDE "HPMHooking/HPMHooking_login.sources.inc"
+#include "login/account.h"
+#include "login/ipban.h"
#include "login/lclif.h"
#include "login/lclif.p.h"
#include "login/login.h"
+#include "login/loginlog.h"
#elif defined (HPMHOOKING_CHAR)
#define HPM_SERVER_TYPE SERVER_TYPE_CHAR
#define HPM_CORE_INCLUDE "HPMHooking/HPMHooking_char.HPMHooksCore.inc"
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index c293eb1f7..816e1981d 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -33,6 +33,46 @@ typedef bool (*HPMHOOK_post_HCache_check) (bool retVal___, const char *file);
typedef FILE* (*HPMHOOK_pre_HCache_open) (const char **file, const char **opt);
typedef FILE* (*HPMHOOK_post_HCache_open) (FILE* retVal___, const char *file, const char *opt);
#endif // COMMON_UTILS_H
+#ifdef LOGIN_ACCOUNT_H /* account */
+typedef struct Sql* (*HPMHOOK_pre_account_db_sql_up) (AccountDB **self);
+typedef struct Sql* (*HPMHOOK_post_account_db_sql_up) (struct Sql* retVal___, AccountDB *self);
+typedef void (*HPMHOOK_pre_account_mmo_send_accreg2) (AccountDB **self, int *fd, int *account_id, int *char_id);
+typedef void (*HPMHOOK_post_account_mmo_send_accreg2) (AccountDB *self, int fd, int account_id, int char_id);
+typedef void (*HPMHOOK_pre_account_mmo_save_accreg2) (AccountDB **self, int *fd, int *account_id, int *char_id);
+typedef void (*HPMHOOK_post_account_mmo_save_accreg2) (AccountDB *self, int fd, int account_id, int char_id);
+typedef bool (*HPMHOOK_pre_account_mmo_auth_fromsql) (AccountDB_SQL **db, struct mmo_account **acc, int *account_id);
+typedef bool (*HPMHOOK_post_account_mmo_auth_fromsql) (bool retVal___, AccountDB_SQL *db, struct mmo_account *acc, int account_id);
+typedef bool (*HPMHOOK_pre_account_mmo_auth_tosql) (AccountDB_SQL **db, const struct mmo_account **acc, bool *is_new);
+typedef bool (*HPMHOOK_post_account_mmo_auth_tosql) (bool retVal___, AccountDB_SQL *db, const struct mmo_account *acc, bool is_new);
+typedef AccountDB* (*HPMHOOK_pre_account_db_sql) (void);
+typedef AccountDB* (*HPMHOOK_post_account_db_sql) (AccountDB* retVal___);
+typedef bool (*HPMHOOK_pre_account_db_sql_init) (AccountDB **self);
+typedef bool (*HPMHOOK_post_account_db_sql_init) (bool retVal___, AccountDB *self);
+typedef void (*HPMHOOK_pre_account_db_sql_destroy) (AccountDB **self);
+typedef void (*HPMHOOK_post_account_db_sql_destroy) (AccountDB *self);
+typedef bool (*HPMHOOK_pre_account_db_sql_get_property) (AccountDB **self, const char **key, char **buf, size_t *buflen);
+typedef bool (*HPMHOOK_post_account_db_sql_get_property) (bool retVal___, AccountDB *self, const char *key, char *buf, size_t buflen);
+typedef bool (*HPMHOOK_pre_account_db_sql_set_property) (AccountDB **self, struct config_t **config, bool *imported);
+typedef bool (*HPMHOOK_post_account_db_sql_set_property) (bool retVal___, AccountDB *self, struct config_t *config, bool imported);
+typedef bool (*HPMHOOK_pre_account_db_sql_create) (AccountDB **self, struct mmo_account **acc);
+typedef bool (*HPMHOOK_post_account_db_sql_create) (bool retVal___, AccountDB *self, struct mmo_account *acc);
+typedef bool (*HPMHOOK_pre_account_db_sql_remove) (AccountDB **self, const int *account_id);
+typedef bool (*HPMHOOK_post_account_db_sql_remove) (bool retVal___, AccountDB *self, const int account_id);
+typedef bool (*HPMHOOK_pre_account_db_sql_save) (AccountDB **self, const struct mmo_account **acc);
+typedef bool (*HPMHOOK_post_account_db_sql_save) (bool retVal___, AccountDB *self, const struct mmo_account *acc);
+typedef bool (*HPMHOOK_pre_account_db_sql_load_num) (AccountDB **self, struct mmo_account **acc, const int *account_id);
+typedef bool (*HPMHOOK_post_account_db_sql_load_num) (bool retVal___, AccountDB *self, struct mmo_account *acc, const int account_id);
+typedef bool (*HPMHOOK_pre_account_db_sql_load_str) (AccountDB **self, struct mmo_account **acc, const char **userid);
+typedef bool (*HPMHOOK_post_account_db_sql_load_str) (bool retVal___, AccountDB *self, struct mmo_account *acc, const char *userid);
+typedef AccountDBIterator* (*HPMHOOK_pre_account_db_sql_iterator) (AccountDB **self);
+typedef AccountDBIterator* (*HPMHOOK_post_account_db_sql_iterator) (AccountDBIterator* retVal___, AccountDB *self);
+typedef void (*HPMHOOK_pre_account_db_sql_iter_destroy) (AccountDBIterator **self);
+typedef void (*HPMHOOK_post_account_db_sql_iter_destroy) (AccountDBIterator *self);
+typedef bool (*HPMHOOK_pre_account_db_sql_iter_next) (AccountDBIterator **self, struct mmo_account **acc);
+typedef bool (*HPMHOOK_post_account_db_sql_iter_next) (bool retVal___, AccountDBIterator *self, struct mmo_account *acc);
+typedef bool (*HPMHOOK_pre_account_db_read_inter) (AccountDB_SQL **db, const char **filename, bool *imported);
+typedef bool (*HPMHOOK_post_account_db_read_inter) (bool retVal___, AccountDB_SQL *db, const char *filename, bool imported);
+#endif // LOGIN_ACCOUNT_H
#ifdef MAP_ATCOMMAND_H /* atcommand */
typedef void (*HPMHOOK_pre_atcommand_init) (bool *minimal);
typedef void (*HPMHOOK_post_atcommand_init) (bool minimal);
@@ -3429,6 +3469,26 @@ typedef void (*HPMHOOK_post_intif_pRodexCheckName) (int fd);
typedef void (*HPMHOOK_pre_intif_pRecvClanMemberAction) (int *fd);
typedef void (*HPMHOOK_post_intif_pRecvClanMemberAction) (int fd);
#endif // MAP_INTIF_H
+#ifdef LOGIN_IPBAN_H /* ipban */
+typedef void (*HPMHOOK_pre_ipban_init) (void);
+typedef void (*HPMHOOK_post_ipban_init) (void);
+typedef void (*HPMHOOK_pre_ipban_final) (void);
+typedef void (*HPMHOOK_post_ipban_final) (void);
+typedef int (*HPMHOOK_pre_ipban_cleanup) (int *tid, int64 *tick, int *id, intptr_t *data);
+typedef int (*HPMHOOK_post_ipban_cleanup) (int retVal___, int tid, int64 tick, int id, intptr_t data);
+typedef bool (*HPMHOOK_pre_ipban_config_read_inter) (const char **filename, bool *imported);
+typedef bool (*HPMHOOK_post_ipban_config_read_inter) (bool retVal___, const char *filename, bool imported);
+typedef bool (*HPMHOOK_pre_ipban_config_read_connection) (const char **filename, struct config_t **config, bool *imported);
+typedef bool (*HPMHOOK_post_ipban_config_read_connection) (bool retVal___, const char *filename, struct config_t *config, bool imported);
+typedef bool (*HPMHOOK_pre_ipban_config_read_dynamic) (const char **filename, struct config_t **config, bool *imported);
+typedef bool (*HPMHOOK_post_ipban_config_read_dynamic) (bool retVal___, const char *filename, struct config_t *config, bool imported);
+typedef bool (*HPMHOOK_pre_ipban_config_read) (const char **filename, struct config_t **config, bool *imported);
+typedef bool (*HPMHOOK_post_ipban_config_read) (bool retVal___, const char *filename, struct config_t *config, bool imported);
+typedef bool (*HPMHOOK_pre_ipban_check) (uint32 *ip);
+typedef bool (*HPMHOOK_post_ipban_check) (bool retVal___, uint32 ip);
+typedef void (*HPMHOOK_pre_ipban_log) (uint32 *ip);
+typedef void (*HPMHOOK_post_ipban_log) (uint32 ip);
+#endif // LOGIN_IPBAN_H
#ifdef MAP_IRC_BOT_H /* ircbot */
typedef void (*HPMHOOK_pre_ircbot_init) (bool *minimal);
typedef void (*HPMHOOK_post_ircbot_init) (bool minimal);
@@ -3599,6 +3659,16 @@ typedef bool (*HPMHOOK_post_itemdb_lookup_const) (bool retVal___, const struct c
typedef bool (*HPMHOOK_pre_itemdb_lookup_const_mask) (const struct config_setting_t **it, const char **name, int **value);
typedef bool (*HPMHOOK_post_itemdb_lookup_const_mask) (bool retVal___, const struct config_setting_t *it, const char *name, int *value);
#endif // MAP_ITEMDB_H
+#ifdef LOGIN_LOGIN_H /* lchrif */
+typedef void (*HPMHOOK_pre_lchrif_server_init) (int *id);
+typedef void (*HPMHOOK_post_lchrif_server_init) (int id);
+typedef void (*HPMHOOK_pre_lchrif_server_destroy) (int *id);
+typedef void (*HPMHOOK_post_lchrif_server_destroy) (int id);
+typedef void (*HPMHOOK_pre_lchrif_server_reset) (int *id);
+typedef void (*HPMHOOK_post_lchrif_server_reset) (int id);
+typedef void (*HPMHOOK_pre_lchrif_on_disconnect) (int *id);
+typedef void (*HPMHOOK_post_lchrif_on_disconnect) (int id);
+#endif // LOGIN_LOGIN_H
#ifdef LOGIN_LCLIF_H /* lclif */
typedef void (*HPMHOOK_pre_lclif_init) (void);
typedef void (*HPMHOOK_post_lclif_init) (void);
@@ -3991,6 +4061,22 @@ typedef void (*HPMHOOK_post_loginif_send_users_count) (int users);
typedef void (*HPMHOOK_pre_loginif_connect_to_server) (void);
typedef void (*HPMHOOK_post_loginif_connect_to_server) (void);
#endif // CHAR_LOGINIF_H
+#ifdef LOGIN_LOGINLOG_H /* loginlog */
+typedef unsigned long (*HPMHOOK_pre_loginlog_failedattempts) (uint32 *ip, unsigned int *minutes);
+typedef unsigned long (*HPMHOOK_post_loginlog_failedattempts) (unsigned long retVal___, uint32 ip, unsigned int minutes);
+typedef void (*HPMHOOK_pre_loginlog_log) (uint32 *ip, const char **username, int *rcode, const char **message);
+typedef void (*HPMHOOK_post_loginlog_log) (uint32 ip, const char *username, int rcode, const char *message);
+typedef bool (*HPMHOOK_pre_loginlog_init) (void);
+typedef bool (*HPMHOOK_post_loginlog_init) (bool retVal___);
+typedef bool (*HPMHOOK_pre_loginlog_final) (void);
+typedef bool (*HPMHOOK_post_loginlog_final) (bool retVal___);
+typedef bool (*HPMHOOK_pre_loginlog_config_read_names) (const char **filename, struct config_t **config, bool *imported);
+typedef bool (*HPMHOOK_post_loginlog_config_read_names) (bool retVal___, const char *filename, struct config_t *config, bool imported);
+typedef bool (*HPMHOOK_pre_loginlog_config_read_log) (const char **filename, struct config_t **config, bool *imported);
+typedef bool (*HPMHOOK_post_loginlog_config_read_log) (bool retVal___, const char *filename, struct config_t *config, bool imported);
+typedef bool (*HPMHOOK_pre_loginlog_config_read) (const char **filename, bool *imported);
+typedef bool (*HPMHOOK_post_loginlog_config_read) (bool retVal___, const char *filename, bool imported);
+#endif // LOGIN_LOGINLOG_H
#ifdef MAP_MAIL_H /* mail */
typedef void (*HPMHOOK_pre_mail_clear) (struct map_session_data **sd);
typedef void (*HPMHOOK_post_mail_clear) (struct map_session_data *sd);
diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
index f8c270de3..5300ca3a6 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
@@ -32,6 +32,44 @@ struct {
struct HPMHookPoint *HP_HCache_check_post;
struct HPMHookPoint *HP_HCache_open_pre;
struct HPMHookPoint *HP_HCache_open_post;
+ struct HPMHookPoint *HP_account_db_sql_up_pre;
+ struct HPMHookPoint *HP_account_db_sql_up_post;
+ struct HPMHookPoint *HP_account_mmo_send_accreg2_pre;
+ struct HPMHookPoint *HP_account_mmo_send_accreg2_post;
+ struct HPMHookPoint *HP_account_mmo_save_accreg2_pre;
+ struct HPMHookPoint *HP_account_mmo_save_accreg2_post;
+ struct HPMHookPoint *HP_account_mmo_auth_fromsql_pre;
+ struct HPMHookPoint *HP_account_mmo_auth_fromsql_post;
+ struct HPMHookPoint *HP_account_mmo_auth_tosql_pre;
+ struct HPMHookPoint *HP_account_mmo_auth_tosql_post;
+ struct HPMHookPoint *HP_account_db_sql_pre;
+ struct HPMHookPoint *HP_account_db_sql_post;
+ struct HPMHookPoint *HP_account_db_sql_init_pre;
+ struct HPMHookPoint *HP_account_db_sql_init_post;
+ struct HPMHookPoint *HP_account_db_sql_destroy_pre;
+ struct HPMHookPoint *HP_account_db_sql_destroy_post;
+ struct HPMHookPoint *HP_account_db_sql_get_property_pre;
+ struct HPMHookPoint *HP_account_db_sql_get_property_post;
+ struct HPMHookPoint *HP_account_db_sql_set_property_pre;
+ struct HPMHookPoint *HP_account_db_sql_set_property_post;
+ struct HPMHookPoint *HP_account_db_sql_create_pre;
+ struct HPMHookPoint *HP_account_db_sql_create_post;
+ struct HPMHookPoint *HP_account_db_sql_remove_pre;
+ struct HPMHookPoint *HP_account_db_sql_remove_post;
+ struct HPMHookPoint *HP_account_db_sql_save_pre;
+ struct HPMHookPoint *HP_account_db_sql_save_post;
+ struct HPMHookPoint *HP_account_db_sql_load_num_pre;
+ struct HPMHookPoint *HP_account_db_sql_load_num_post;
+ struct HPMHookPoint *HP_account_db_sql_load_str_pre;
+ struct HPMHookPoint *HP_account_db_sql_load_str_post;
+ struct HPMHookPoint *HP_account_db_sql_iterator_pre;
+ struct HPMHookPoint *HP_account_db_sql_iterator_post;
+ struct HPMHookPoint *HP_account_db_sql_iter_destroy_pre;
+ struct HPMHookPoint *HP_account_db_sql_iter_destroy_post;
+ struct HPMHookPoint *HP_account_db_sql_iter_next_pre;
+ struct HPMHookPoint *HP_account_db_sql_iter_next_post;
+ struct HPMHookPoint *HP_account_db_read_inter_pre;
+ struct HPMHookPoint *HP_account_db_read_inter_post;
struct HPMHookPoint *HP_cmdline_init_pre;
struct HPMHookPoint *HP_cmdline_init_post;
struct HPMHookPoint *HP_cmdline_final_pre;
@@ -96,6 +134,32 @@ struct {
struct HPMHookPoint *HP_des_decrypt_block_post;
struct HPMHookPoint *HP_des_decrypt_pre;
struct HPMHookPoint *HP_des_decrypt_post;
+ struct HPMHookPoint *HP_ipban_init_pre;
+ struct HPMHookPoint *HP_ipban_init_post;
+ struct HPMHookPoint *HP_ipban_final_pre;
+ struct HPMHookPoint *HP_ipban_final_post;
+ struct HPMHookPoint *HP_ipban_cleanup_pre;
+ struct HPMHookPoint *HP_ipban_cleanup_post;
+ struct HPMHookPoint *HP_ipban_config_read_inter_pre;
+ struct HPMHookPoint *HP_ipban_config_read_inter_post;
+ struct HPMHookPoint *HP_ipban_config_read_connection_pre;
+ struct HPMHookPoint *HP_ipban_config_read_connection_post;
+ struct HPMHookPoint *HP_ipban_config_read_dynamic_pre;
+ struct HPMHookPoint *HP_ipban_config_read_dynamic_post;
+ struct HPMHookPoint *HP_ipban_config_read_pre;
+ struct HPMHookPoint *HP_ipban_config_read_post;
+ struct HPMHookPoint *HP_ipban_check_pre;
+ struct HPMHookPoint *HP_ipban_check_post;
+ struct HPMHookPoint *HP_ipban_log_pre;
+ struct HPMHookPoint *HP_ipban_log_post;
+ struct HPMHookPoint *HP_lchrif_server_init_pre;
+ struct HPMHookPoint *HP_lchrif_server_init_post;
+ struct HPMHookPoint *HP_lchrif_server_destroy_pre;
+ struct HPMHookPoint *HP_lchrif_server_destroy_post;
+ struct HPMHookPoint *HP_lchrif_server_reset_pre;
+ struct HPMHookPoint *HP_lchrif_server_reset_post;
+ struct HPMHookPoint *HP_lchrif_on_disconnect_pre;
+ struct HPMHookPoint *HP_lchrif_on_disconnect_post;
struct HPMHookPoint *HP_lclif_init_pre;
struct HPMHookPoint *HP_lclif_init_post;
struct HPMHookPoint *HP_lclif_final_pre;
@@ -406,6 +470,20 @@ struct {
struct HPMHookPoint *HP_login_config_set_md5hash_post;
struct HPMHookPoint *HP_login_convert_users_to_colors_pre;
struct HPMHookPoint *HP_login_convert_users_to_colors_post;
+ struct HPMHookPoint *HP_loginlog_failedattempts_pre;
+ struct HPMHookPoint *HP_loginlog_failedattempts_post;
+ struct HPMHookPoint *HP_loginlog_log_pre;
+ struct HPMHookPoint *HP_loginlog_log_post;
+ struct HPMHookPoint *HP_loginlog_init_pre;
+ struct HPMHookPoint *HP_loginlog_init_post;
+ struct HPMHookPoint *HP_loginlog_final_pre;
+ struct HPMHookPoint *HP_loginlog_final_post;
+ struct HPMHookPoint *HP_loginlog_config_read_names_pre;
+ struct HPMHookPoint *HP_loginlog_config_read_names_post;
+ struct HPMHookPoint *HP_loginlog_config_read_log_pre;
+ struct HPMHookPoint *HP_loginlog_config_read_log_post;
+ struct HPMHookPoint *HP_loginlog_config_read_pre;
+ struct HPMHookPoint *HP_loginlog_config_read_post;
struct HPMHookPoint *HP_md5_string_pre;
struct HPMHookPoint *HP_md5_string_post;
struct HPMHookPoint *HP_md5_binary_pre;
@@ -735,6 +813,44 @@ struct {
int HP_HCache_check_post;
int HP_HCache_open_pre;
int HP_HCache_open_post;
+ int HP_account_db_sql_up_pre;
+ int HP_account_db_sql_up_post;
+ int HP_account_mmo_send_accreg2_pre;
+ int HP_account_mmo_send_accreg2_post;
+ int HP_account_mmo_save_accreg2_pre;
+ int HP_account_mmo_save_accreg2_post;
+ int HP_account_mmo_auth_fromsql_pre;
+ int HP_account_mmo_auth_fromsql_post;
+ int HP_account_mmo_auth_tosql_pre;
+ int HP_account_mmo_auth_tosql_post;
+ int HP_account_db_sql_pre;
+ int HP_account_db_sql_post;
+ int HP_account_db_sql_init_pre;
+ int HP_account_db_sql_init_post;
+ int HP_account_db_sql_destroy_pre;
+ int HP_account_db_sql_destroy_post;
+ int HP_account_db_sql_get_property_pre;
+ int HP_account_db_sql_get_property_post;
+ int HP_account_db_sql_set_property_pre;
+ int HP_account_db_sql_set_property_post;
+ int HP_account_db_sql_create_pre;
+ int HP_account_db_sql_create_post;
+ int HP_account_db_sql_remove_pre;
+ int HP_account_db_sql_remove_post;
+ int HP_account_db_sql_save_pre;
+ int HP_account_db_sql_save_post;
+ int HP_account_db_sql_load_num_pre;
+ int HP_account_db_sql_load_num_post;
+ int HP_account_db_sql_load_str_pre;
+ int HP_account_db_sql_load_str_post;
+ int HP_account_db_sql_iterator_pre;
+ int HP_account_db_sql_iterator_post;
+ int HP_account_db_sql_iter_destroy_pre;
+ int HP_account_db_sql_iter_destroy_post;
+ int HP_account_db_sql_iter_next_pre;
+ int HP_account_db_sql_iter_next_post;
+ int HP_account_db_read_inter_pre;
+ int HP_account_db_read_inter_post;
int HP_cmdline_init_pre;
int HP_cmdline_init_post;
int HP_cmdline_final_pre;
@@ -799,6 +915,32 @@ struct {
int HP_des_decrypt_block_post;
int HP_des_decrypt_pre;
int HP_des_decrypt_post;
+ int HP_ipban_init_pre;
+ int HP_ipban_init_post;
+ int HP_ipban_final_pre;
+ int HP_ipban_final_post;
+ int HP_ipban_cleanup_pre;
+ int HP_ipban_cleanup_post;
+ int HP_ipban_config_read_inter_pre;
+ int HP_ipban_config_read_inter_post;
+ int HP_ipban_config_read_connection_pre;
+ int HP_ipban_config_read_connection_post;
+ int HP_ipban_config_read_dynamic_pre;
+ int HP_ipban_config_read_dynamic_post;
+ int HP_ipban_config_read_pre;
+ int HP_ipban_config_read_post;
+ int HP_ipban_check_pre;
+ int HP_ipban_check_post;
+ int HP_ipban_log_pre;
+ int HP_ipban_log_post;
+ int HP_lchrif_server_init_pre;
+ int HP_lchrif_server_init_post;
+ int HP_lchrif_server_destroy_pre;
+ int HP_lchrif_server_destroy_post;
+ int HP_lchrif_server_reset_pre;
+ int HP_lchrif_server_reset_post;
+ int HP_lchrif_on_disconnect_pre;
+ int HP_lchrif_on_disconnect_post;
int HP_lclif_init_pre;
int HP_lclif_init_post;
int HP_lclif_final_pre;
@@ -1109,6 +1251,20 @@ struct {
int HP_login_config_set_md5hash_post;
int HP_login_convert_users_to_colors_pre;
int HP_login_convert_users_to_colors_post;
+ int HP_loginlog_failedattempts_pre;
+ int HP_loginlog_failedattempts_post;
+ int HP_loginlog_log_pre;
+ int HP_loginlog_log_post;
+ int HP_loginlog_init_pre;
+ int HP_loginlog_init_post;
+ int HP_loginlog_final_pre;
+ int HP_loginlog_final_post;
+ int HP_loginlog_config_read_names_pre;
+ int HP_loginlog_config_read_names_post;
+ int HP_loginlog_config_read_log_pre;
+ int HP_loginlog_config_read_log_post;
+ int HP_loginlog_config_read_pre;
+ int HP_loginlog_config_read_post;
int HP_md5_string_pre;
int HP_md5_string_post;
int HP_md5_binary_pre;
@@ -1433,15 +1589,19 @@ struct {
struct {
struct HCache_interface HCache;
+ struct account_interface account;
struct cmdline_interface cmdline;
struct console_interface console;
struct core_interface core;
struct db_interface DB;
struct des_interface des;
+ struct ipban_interface ipban;
+ struct lchrif_interface lchrif;
struct lclif_interface lclif;
struct lclif_interface_private PRIV__lclif;
struct libconfig_interface libconfig;
struct login_interface login;
+ struct loginlog_interface loginlog;
struct md5_interface md5;
struct mutex_interface mutex;
struct nullpo_interface nullpo;
diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
index 8cec39974..6eb2e8121 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
@@ -30,6 +30,26 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(HCache->init, HP_HCache_init) },
{ HP_POP(HCache->check, HP_HCache_check) },
{ HP_POP(HCache->open, HP_HCache_open) },
+/* account_interface */
+ { HP_POP(account->db_sql_up, HP_account_db_sql_up) },
+ { HP_POP(account->mmo_send_accreg2, HP_account_mmo_send_accreg2) },
+ { HP_POP(account->mmo_save_accreg2, HP_account_mmo_save_accreg2) },
+ { HP_POP(account->mmo_auth_fromsql, HP_account_mmo_auth_fromsql) },
+ { HP_POP(account->mmo_auth_tosql, HP_account_mmo_auth_tosql) },
+ { HP_POP(account->db_sql, HP_account_db_sql) },
+ { HP_POP(account->db_sql_init, HP_account_db_sql_init) },
+ { HP_POP(account->db_sql_destroy, HP_account_db_sql_destroy) },
+ { HP_POP(account->db_sql_get_property, HP_account_db_sql_get_property) },
+ { HP_POP(account->db_sql_set_property, HP_account_db_sql_set_property) },
+ { HP_POP(account->db_sql_create, HP_account_db_sql_create) },
+ { HP_POP(account->db_sql_remove, HP_account_db_sql_remove) },
+ { HP_POP(account->db_sql_save, HP_account_db_sql_save) },
+ { HP_POP(account->db_sql_load_num, HP_account_db_sql_load_num) },
+ { HP_POP(account->db_sql_load_str, HP_account_db_sql_load_str) },
+ { HP_POP(account->db_sql_iterator, HP_account_db_sql_iterator) },
+ { HP_POP(account->db_sql_iter_destroy, HP_account_db_sql_iter_destroy) },
+ { HP_POP(account->db_sql_iter_next, HP_account_db_sql_iter_next) },
+ { HP_POP(account->db_read_inter, HP_account_db_read_inter) },
/* cmdline_interface */
{ HP_POP(cmdline->init, HP_cmdline_init) },
{ HP_POP(cmdline->final, HP_cmdline_final) },
@@ -67,6 +87,21 @@ struct HookingPointData HookingPoints[] = {
/* des_interface */
{ HP_POP(des->decrypt_block, HP_des_decrypt_block) },
{ HP_POP(des->decrypt, HP_des_decrypt) },
+/* ipban_interface */
+ { HP_POP(ipban->init, HP_ipban_init) },
+ { HP_POP(ipban->final, HP_ipban_final) },
+ { HP_POP(ipban->cleanup, HP_ipban_cleanup) },
+ { HP_POP(ipban->config_read_inter, HP_ipban_config_read_inter) },
+ { HP_POP(ipban->config_read_connection, HP_ipban_config_read_connection) },
+ { HP_POP(ipban->config_read_dynamic, HP_ipban_config_read_dynamic) },
+ { HP_POP(ipban->config_read, HP_ipban_config_read) },
+ { HP_POP(ipban->check, HP_ipban_check) },
+ { HP_POP(ipban->log, HP_ipban_log) },
+/* lchrif_interface */
+ { HP_POP(lchrif->server_init, HP_lchrif_server_init) },
+ { HP_POP(lchrif->server_destroy, HP_lchrif_server_destroy) },
+ { HP_POP(lchrif->server_reset, HP_lchrif_server_reset) },
+ { HP_POP(lchrif->on_disconnect, HP_lchrif_on_disconnect) },
/* lclif_interface */
{ HP_POP(lclif->init, HP_lclif_init) },
{ HP_POP(lclif->final, HP_lclif_final) },
@@ -226,6 +261,14 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(login->clear_client_hash_nodes, HP_login_clear_client_hash_nodes) },
{ HP_POP(login->config_set_md5hash, HP_login_config_set_md5hash) },
{ HP_POP(login->convert_users_to_colors, HP_login_convert_users_to_colors) },
+/* loginlog_interface */
+ { HP_POP(loginlog->failedattempts, HP_loginlog_failedattempts) },
+ { HP_POP(loginlog->log, HP_loginlog_log) },
+ { HP_POP(loginlog->init, HP_loginlog_init) },
+ { HP_POP(loginlog->final, HP_loginlog_final) },
+ { HP_POP(loginlog->config_read_names, HP_loginlog_config_read_names) },
+ { HP_POP(loginlog->config_read_log, HP_loginlog_config_read_log) },
+ { HP_POP(loginlog->config_read, HP_loginlog_config_read) },
/* md5_interface */
{ HP_POP(md5->string, HP_md5_string) },
{ HP_POP(md5->binary, HP_md5_binary) },
diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
index 658ee874d..e432da70d 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
@@ -106,6 +106,516 @@ FILE* HP_HCache_open(const char *file, const char *opt) {
}
return retVal___;
}
+/* account_interface */
+struct Sql* HP_account_db_sql_up(AccountDB *self) {
+ int hIndex = 0;
+ struct Sql* retVal___ = NULL;
+ if (HPMHooks.count.HP_account_db_sql_up_pre > 0) {
+ struct Sql* (*preHookFunc) (AccountDB **self);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_up_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_up_pre[hIndex].func;
+ retVal___ = preHookFunc(&self);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.db_sql_up(self);
+ }
+ if (HPMHooks.count.HP_account_db_sql_up_post > 0) {
+ struct Sql* (*postHookFunc) (struct Sql* retVal___, AccountDB *self);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_up_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_up_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, self);
+ }
+ }
+ return retVal___;
+}
+void HP_account_mmo_send_accreg2(AccountDB *self, int fd, int account_id, int char_id) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_account_mmo_send_accreg2_pre > 0) {
+ void (*preHookFunc) (AccountDB **self, int *fd, int *account_id, int *char_id);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_mmo_send_accreg2_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_mmo_send_accreg2_pre[hIndex].func;
+ preHookFunc(&self, &fd, &account_id, &char_id);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.account.mmo_send_accreg2(self, fd, account_id, char_id);
+ }
+ if (HPMHooks.count.HP_account_mmo_send_accreg2_post > 0) {
+ void (*postHookFunc) (AccountDB *self, int fd, int account_id, int char_id);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_mmo_send_accreg2_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_mmo_send_accreg2_post[hIndex].func;
+ postHookFunc(self, fd, account_id, char_id);
+ }
+ }
+ return;
+}
+void HP_account_mmo_save_accreg2(AccountDB *self, int fd, int account_id, int char_id) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_account_mmo_save_accreg2_pre > 0) {
+ void (*preHookFunc) (AccountDB **self, int *fd, int *account_id, int *char_id);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_mmo_save_accreg2_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_mmo_save_accreg2_pre[hIndex].func;
+ preHookFunc(&self, &fd, &account_id, &char_id);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.account.mmo_save_accreg2(self, fd, account_id, char_id);
+ }
+ if (HPMHooks.count.HP_account_mmo_save_accreg2_post > 0) {
+ void (*postHookFunc) (AccountDB *self, int fd, int account_id, int char_id);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_mmo_save_accreg2_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_mmo_save_accreg2_post[hIndex].func;
+ postHookFunc(self, fd, account_id, char_id);
+ }
+ }
+ return;
+}
+bool HP_account_mmo_auth_fromsql(AccountDB_SQL *db, struct mmo_account *acc, int account_id) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_account_mmo_auth_fromsql_pre > 0) {
+ bool (*preHookFunc) (AccountDB_SQL **db, struct mmo_account **acc, int *account_id);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_mmo_auth_fromsql_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_mmo_auth_fromsql_pre[hIndex].func;
+ retVal___ = preHookFunc(&db, &acc, &account_id);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.mmo_auth_fromsql(db, acc, account_id);
+ }
+ if (HPMHooks.count.HP_account_mmo_auth_fromsql_post > 0) {
+ bool (*postHookFunc) (bool retVal___, AccountDB_SQL *db, struct mmo_account *acc, int account_id);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_mmo_auth_fromsql_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_mmo_auth_fromsql_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, db, acc, account_id);
+ }
+ }
+ return retVal___;
+}
+bool HP_account_mmo_auth_tosql(AccountDB_SQL *db, const struct mmo_account *acc, bool is_new) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_account_mmo_auth_tosql_pre > 0) {
+ bool (*preHookFunc) (AccountDB_SQL **db, const struct mmo_account **acc, bool *is_new);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_mmo_auth_tosql_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_mmo_auth_tosql_pre[hIndex].func;
+ retVal___ = preHookFunc(&db, &acc, &is_new);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.mmo_auth_tosql(db, acc, is_new);
+ }
+ if (HPMHooks.count.HP_account_mmo_auth_tosql_post > 0) {
+ bool (*postHookFunc) (bool retVal___, AccountDB_SQL *db, const struct mmo_account *acc, bool is_new);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_mmo_auth_tosql_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_mmo_auth_tosql_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, db, acc, is_new);
+ }
+ }
+ return retVal___;
+}
+AccountDB* HP_account_db_sql(void) {
+ int hIndex = 0;
+ AccountDB* retVal___ = NULL;
+ if (HPMHooks.count.HP_account_db_sql_pre > 0) {
+ AccountDB* (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_pre[hIndex].func;
+ retVal___ = preHookFunc();
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.db_sql();
+ }
+ if (HPMHooks.count.HP_account_db_sql_post > 0) {
+ AccountDB* (*postHookFunc) (AccountDB* retVal___);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___);
+ }
+ }
+ return retVal___;
+}
+bool HP_account_db_sql_init(AccountDB *self) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_account_db_sql_init_pre > 0) {
+ bool (*preHookFunc) (AccountDB **self);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_init_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_init_pre[hIndex].func;
+ retVal___ = preHookFunc(&self);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.db_sql_init(self);
+ }
+ if (HPMHooks.count.HP_account_db_sql_init_post > 0) {
+ bool (*postHookFunc) (bool retVal___, AccountDB *self);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_init_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_init_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, self);
+ }
+ }
+ return retVal___;
+}
+void HP_account_db_sql_destroy(AccountDB *self) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_account_db_sql_destroy_pre > 0) {
+ void (*preHookFunc) (AccountDB **self);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_destroy_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_destroy_pre[hIndex].func;
+ preHookFunc(&self);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.account.db_sql_destroy(self);
+ }
+ if (HPMHooks.count.HP_account_db_sql_destroy_post > 0) {
+ void (*postHookFunc) (AccountDB *self);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_destroy_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_destroy_post[hIndex].func;
+ postHookFunc(self);
+ }
+ }
+ return;
+}
+bool HP_account_db_sql_get_property(AccountDB *self, const char *key, char *buf, size_t buflen) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_account_db_sql_get_property_pre > 0) {
+ bool (*preHookFunc) (AccountDB **self, const char **key, char **buf, size_t *buflen);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_get_property_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_get_property_pre[hIndex].func;
+ retVal___ = preHookFunc(&self, &key, &buf, &buflen);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.db_sql_get_property(self, key, buf, buflen);
+ }
+ if (HPMHooks.count.HP_account_db_sql_get_property_post > 0) {
+ bool (*postHookFunc) (bool retVal___, AccountDB *self, const char *key, char *buf, size_t buflen);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_get_property_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_get_property_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, self, key, buf, buflen);
+ }
+ }
+ return retVal___;
+}
+bool HP_account_db_sql_set_property(AccountDB *self, struct config_t *config, bool imported) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_account_db_sql_set_property_pre > 0) {
+ bool (*preHookFunc) (AccountDB **self, struct config_t **config, bool *imported);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_set_property_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_set_property_pre[hIndex].func;
+ retVal___ = preHookFunc(&self, &config, &imported);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.db_sql_set_property(self, config, imported);
+ }
+ if (HPMHooks.count.HP_account_db_sql_set_property_post > 0) {
+ bool (*postHookFunc) (bool retVal___, AccountDB *self, struct config_t *config, bool imported);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_set_property_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_set_property_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, self, config, imported);
+ }
+ }
+ return retVal___;
+}
+bool HP_account_db_sql_create(AccountDB *self, struct mmo_account *acc) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_account_db_sql_create_pre > 0) {
+ bool (*preHookFunc) (AccountDB **self, struct mmo_account **acc);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_create_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_create_pre[hIndex].func;
+ retVal___ = preHookFunc(&self, &acc);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.db_sql_create(self, acc);
+ }
+ if (HPMHooks.count.HP_account_db_sql_create_post > 0) {
+ bool (*postHookFunc) (bool retVal___, AccountDB *self, struct mmo_account *acc);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_create_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_create_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, self, acc);
+ }
+ }
+ return retVal___;
+}
+bool HP_account_db_sql_remove(AccountDB *self, const int account_id) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_account_db_sql_remove_pre > 0) {
+ bool (*preHookFunc) (AccountDB **self, const int *account_id);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_remove_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_remove_pre[hIndex].func;
+ retVal___ = preHookFunc(&self, &account_id);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.db_sql_remove(self, account_id);
+ }
+ if (HPMHooks.count.HP_account_db_sql_remove_post > 0) {
+ bool (*postHookFunc) (bool retVal___, AccountDB *self, const int account_id);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_remove_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_remove_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, self, account_id);
+ }
+ }
+ return retVal___;
+}
+bool HP_account_db_sql_save(AccountDB *self, const struct mmo_account *acc) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_account_db_sql_save_pre > 0) {
+ bool (*preHookFunc) (AccountDB **self, const struct mmo_account **acc);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_save_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_save_pre[hIndex].func;
+ retVal___ = preHookFunc(&self, &acc);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.db_sql_save(self, acc);
+ }
+ if (HPMHooks.count.HP_account_db_sql_save_post > 0) {
+ bool (*postHookFunc) (bool retVal___, AccountDB *self, const struct mmo_account *acc);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_save_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_save_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, self, acc);
+ }
+ }
+ return retVal___;
+}
+bool HP_account_db_sql_load_num(AccountDB *self, struct mmo_account *acc, const int account_id) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_account_db_sql_load_num_pre > 0) {
+ bool (*preHookFunc) (AccountDB **self, struct mmo_account **acc, const int *account_id);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_load_num_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_load_num_pre[hIndex].func;
+ retVal___ = preHookFunc(&self, &acc, &account_id);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.db_sql_load_num(self, acc, account_id);
+ }
+ if (HPMHooks.count.HP_account_db_sql_load_num_post > 0) {
+ bool (*postHookFunc) (bool retVal___, AccountDB *self, struct mmo_account *acc, const int account_id);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_load_num_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_load_num_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, self, acc, account_id);
+ }
+ }
+ return retVal___;
+}
+bool HP_account_db_sql_load_str(AccountDB *self, struct mmo_account *acc, const char *userid) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_account_db_sql_load_str_pre > 0) {
+ bool (*preHookFunc) (AccountDB **self, struct mmo_account **acc, const char **userid);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_load_str_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_load_str_pre[hIndex].func;
+ retVal___ = preHookFunc(&self, &acc, &userid);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.db_sql_load_str(self, acc, userid);
+ }
+ if (HPMHooks.count.HP_account_db_sql_load_str_post > 0) {
+ bool (*postHookFunc) (bool retVal___, AccountDB *self, struct mmo_account *acc, const char *userid);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_load_str_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_load_str_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, self, acc, userid);
+ }
+ }
+ return retVal___;
+}
+AccountDBIterator* HP_account_db_sql_iterator(AccountDB *self) {
+ int hIndex = 0;
+ AccountDBIterator* retVal___ = NULL;
+ if (HPMHooks.count.HP_account_db_sql_iterator_pre > 0) {
+ AccountDBIterator* (*preHookFunc) (AccountDB **self);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_iterator_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_iterator_pre[hIndex].func;
+ retVal___ = preHookFunc(&self);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.db_sql_iterator(self);
+ }
+ if (HPMHooks.count.HP_account_db_sql_iterator_post > 0) {
+ AccountDBIterator* (*postHookFunc) (AccountDBIterator* retVal___, AccountDB *self);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_iterator_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_iterator_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, self);
+ }
+ }
+ return retVal___;
+}
+void HP_account_db_sql_iter_destroy(AccountDBIterator *self) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_account_db_sql_iter_destroy_pre > 0) {
+ void (*preHookFunc) (AccountDBIterator **self);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_iter_destroy_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_iter_destroy_pre[hIndex].func;
+ preHookFunc(&self);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.account.db_sql_iter_destroy(self);
+ }
+ if (HPMHooks.count.HP_account_db_sql_iter_destroy_post > 0) {
+ void (*postHookFunc) (AccountDBIterator *self);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_iter_destroy_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_iter_destroy_post[hIndex].func;
+ postHookFunc(self);
+ }
+ }
+ return;
+}
+bool HP_account_db_sql_iter_next(AccountDBIterator *self, struct mmo_account *acc) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_account_db_sql_iter_next_pre > 0) {
+ bool (*preHookFunc) (AccountDBIterator **self, struct mmo_account **acc);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_iter_next_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_sql_iter_next_pre[hIndex].func;
+ retVal___ = preHookFunc(&self, &acc);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.db_sql_iter_next(self, acc);
+ }
+ if (HPMHooks.count.HP_account_db_sql_iter_next_post > 0) {
+ bool (*postHookFunc) (bool retVal___, AccountDBIterator *self, struct mmo_account *acc);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_sql_iter_next_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_sql_iter_next_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, self, acc);
+ }
+ }
+ return retVal___;
+}
+bool HP_account_db_read_inter(AccountDB_SQL *db, const char *filename, bool imported) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_account_db_read_inter_pre > 0) {
+ bool (*preHookFunc) (AccountDB_SQL **db, const char **filename, bool *imported);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_read_inter_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_account_db_read_inter_pre[hIndex].func;
+ retVal___ = preHookFunc(&db, &filename, &imported);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.account.db_read_inter(db, filename, imported);
+ }
+ if (HPMHooks.count.HP_account_db_read_inter_post > 0) {
+ bool (*postHookFunc) (bool retVal___, AccountDB_SQL *db, const char *filename, bool imported);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_account_db_read_inter_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_account_db_read_inter_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, db, filename, imported);
+ }
+ }
+ return retVal___;
+}
/* cmdline_interface */
void HP_cmdline_init(void) {
int hIndex = 0;
@@ -964,6 +1474,352 @@ void HP_des_decrypt(unsigned char *data, size_t size) {
}
return;
}
+/* ipban_interface */
+void HP_ipban_init(void) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_ipban_init_pre > 0) {
+ void (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_init_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_ipban_init_pre[hIndex].func;
+ preHookFunc();
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.ipban.init();
+ }
+ if (HPMHooks.count.HP_ipban_init_post > 0) {
+ void (*postHookFunc) (void);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_init_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_ipban_init_post[hIndex].func;
+ postHookFunc();
+ }
+ }
+ return;
+}
+void HP_ipban_final(void) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_ipban_final_pre > 0) {
+ void (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_final_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_ipban_final_pre[hIndex].func;
+ preHookFunc();
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.ipban.final();
+ }
+ if (HPMHooks.count.HP_ipban_final_post > 0) {
+ void (*postHookFunc) (void);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_final_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_ipban_final_post[hIndex].func;
+ postHookFunc();
+ }
+ }
+ return;
+}
+int HP_ipban_cleanup(int tid, int64 tick, int id, intptr_t data) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if (HPMHooks.count.HP_ipban_cleanup_pre > 0) {
+ int (*preHookFunc) (int *tid, int64 *tick, int *id, intptr_t *data);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_cleanup_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_ipban_cleanup_pre[hIndex].func;
+ retVal___ = preHookFunc(&tid, &tick, &id, &data);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.ipban.cleanup(tid, tick, id, data);
+ }
+ if (HPMHooks.count.HP_ipban_cleanup_post > 0) {
+ int (*postHookFunc) (int retVal___, int tid, int64 tick, int id, intptr_t data);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_cleanup_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_ipban_cleanup_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, tid, tick, id, data);
+ }
+ }
+ return retVal___;
+}
+bool HP_ipban_config_read_inter(const char *filename, bool imported) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_ipban_config_read_inter_pre > 0) {
+ bool (*preHookFunc) (const char **filename, bool *imported);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_config_read_inter_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_ipban_config_read_inter_pre[hIndex].func;
+ retVal___ = preHookFunc(&filename, &imported);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.ipban.config_read_inter(filename, imported);
+ }
+ if (HPMHooks.count.HP_ipban_config_read_inter_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *filename, bool imported);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_config_read_inter_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_ipban_config_read_inter_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename, imported);
+ }
+ }
+ return retVal___;
+}
+bool HP_ipban_config_read_connection(const char *filename, struct config_t *config, bool imported) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_ipban_config_read_connection_pre > 0) {
+ bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_config_read_connection_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_ipban_config_read_connection_pre[hIndex].func;
+ retVal___ = preHookFunc(&filename, &config, &imported);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.ipban.config_read_connection(filename, config, imported);
+ }
+ if (HPMHooks.count.HP_ipban_config_read_connection_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_config_read_connection_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_ipban_config_read_connection_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename, config, imported);
+ }
+ }
+ return retVal___;
+}
+bool HP_ipban_config_read_dynamic(const char *filename, struct config_t *config, bool imported) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_ipban_config_read_dynamic_pre > 0) {
+ bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_config_read_dynamic_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_ipban_config_read_dynamic_pre[hIndex].func;
+ retVal___ = preHookFunc(&filename, &config, &imported);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.ipban.config_read_dynamic(filename, config, imported);
+ }
+ if (HPMHooks.count.HP_ipban_config_read_dynamic_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_config_read_dynamic_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_ipban_config_read_dynamic_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename, config, imported);
+ }
+ }
+ return retVal___;
+}
+bool HP_ipban_config_read(const char *filename, struct config_t *config, bool imported) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_ipban_config_read_pre > 0) {
+ bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_config_read_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_ipban_config_read_pre[hIndex].func;
+ retVal___ = preHookFunc(&filename, &config, &imported);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.ipban.config_read(filename, config, imported);
+ }
+ if (HPMHooks.count.HP_ipban_config_read_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_config_read_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_ipban_config_read_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename, config, imported);
+ }
+ }
+ return retVal___;
+}
+bool HP_ipban_check(uint32 ip) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_ipban_check_pre > 0) {
+ bool (*preHookFunc) (uint32 *ip);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_check_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_ipban_check_pre[hIndex].func;
+ retVal___ = preHookFunc(&ip);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.ipban.check(ip);
+ }
+ if (HPMHooks.count.HP_ipban_check_post > 0) {
+ bool (*postHookFunc) (bool retVal___, uint32 ip);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_check_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_ipban_check_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, ip);
+ }
+ }
+ return retVal___;
+}
+void HP_ipban_log(uint32 ip) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_ipban_log_pre > 0) {
+ void (*preHookFunc) (uint32 *ip);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_log_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_ipban_log_pre[hIndex].func;
+ preHookFunc(&ip);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.ipban.log(ip);
+ }
+ if (HPMHooks.count.HP_ipban_log_post > 0) {
+ void (*postHookFunc) (uint32 ip);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_ipban_log_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_ipban_log_post[hIndex].func;
+ postHookFunc(ip);
+ }
+ }
+ return;
+}
+/* lchrif_interface */
+void HP_lchrif_server_init(int id) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_lchrif_server_init_pre > 0) {
+ void (*preHookFunc) (int *id);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_lchrif_server_init_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_lchrif_server_init_pre[hIndex].func;
+ preHookFunc(&id);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.lchrif.server_init(id);
+ }
+ if (HPMHooks.count.HP_lchrif_server_init_post > 0) {
+ void (*postHookFunc) (int id);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_lchrif_server_init_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_lchrif_server_init_post[hIndex].func;
+ postHookFunc(id);
+ }
+ }
+ return;
+}
+void HP_lchrif_server_destroy(int id) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_lchrif_server_destroy_pre > 0) {
+ void (*preHookFunc) (int *id);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_lchrif_server_destroy_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_lchrif_server_destroy_pre[hIndex].func;
+ preHookFunc(&id);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.lchrif.server_destroy(id);
+ }
+ if (HPMHooks.count.HP_lchrif_server_destroy_post > 0) {
+ void (*postHookFunc) (int id);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_lchrif_server_destroy_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_lchrif_server_destroy_post[hIndex].func;
+ postHookFunc(id);
+ }
+ }
+ return;
+}
+void HP_lchrif_server_reset(int id) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_lchrif_server_reset_pre > 0) {
+ void (*preHookFunc) (int *id);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_lchrif_server_reset_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_lchrif_server_reset_pre[hIndex].func;
+ preHookFunc(&id);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.lchrif.server_reset(id);
+ }
+ if (HPMHooks.count.HP_lchrif_server_reset_post > 0) {
+ void (*postHookFunc) (int id);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_lchrif_server_reset_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_lchrif_server_reset_post[hIndex].func;
+ postHookFunc(id);
+ }
+ }
+ return;
+}
+void HP_lchrif_on_disconnect(int id) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_lchrif_on_disconnect_pre > 0) {
+ void (*preHookFunc) (int *id);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_lchrif_on_disconnect_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_lchrif_on_disconnect_pre[hIndex].func;
+ preHookFunc(&id);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.lchrif.on_disconnect(id);
+ }
+ if (HPMHooks.count.HP_lchrif_on_disconnect_post > 0) {
+ void (*postHookFunc) (int id);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_lchrif_on_disconnect_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_lchrif_on_disconnect_post[hIndex].func;
+ postHookFunc(id);
+ }
+ }
+ return;
+}
/* lclif_interface */
void HP_lclif_init(void) {
int hIndex = 0;
@@ -5117,6 +5973,195 @@ uint16 HP_login_convert_users_to_colors(uint16 users) {
}
return retVal___;
}
+/* loginlog_interface */
+unsigned long HP_loginlog_failedattempts(uint32 ip, unsigned int minutes) {
+ int hIndex = 0;
+ unsigned long retVal___ = 0;
+ if (HPMHooks.count.HP_loginlog_failedattempts_pre > 0) {
+ unsigned long (*preHookFunc) (uint32 *ip, unsigned int *minutes);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_failedattempts_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_loginlog_failedattempts_pre[hIndex].func;
+ retVal___ = preHookFunc(&ip, &minutes);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.loginlog.failedattempts(ip, minutes);
+ }
+ if (HPMHooks.count.HP_loginlog_failedattempts_post > 0) {
+ unsigned long (*postHookFunc) (unsigned long retVal___, uint32 ip, unsigned int minutes);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_failedattempts_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_loginlog_failedattempts_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, ip, minutes);
+ }
+ }
+ return retVal___;
+}
+void HP_loginlog_log(uint32 ip, const char *username, int rcode, const char *message) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_loginlog_log_pre > 0) {
+ void (*preHookFunc) (uint32 *ip, const char **username, int *rcode, const char **message);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_log_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_loginlog_log_pre[hIndex].func;
+ preHookFunc(&ip, &username, &rcode, &message);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.loginlog.log(ip, username, rcode, message);
+ }
+ if (HPMHooks.count.HP_loginlog_log_post > 0) {
+ void (*postHookFunc) (uint32 ip, const char *username, int rcode, const char *message);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_log_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_loginlog_log_post[hIndex].func;
+ postHookFunc(ip, username, rcode, message);
+ }
+ }
+ return;
+}
+bool HP_loginlog_init(void) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_loginlog_init_pre > 0) {
+ bool (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_init_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_loginlog_init_pre[hIndex].func;
+ retVal___ = preHookFunc();
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.loginlog.init();
+ }
+ if (HPMHooks.count.HP_loginlog_init_post > 0) {
+ bool (*postHookFunc) (bool retVal___);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_init_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_loginlog_init_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___);
+ }
+ }
+ return retVal___;
+}
+bool HP_loginlog_final(void) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_loginlog_final_pre > 0) {
+ bool (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_final_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_loginlog_final_pre[hIndex].func;
+ retVal___ = preHookFunc();
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.loginlog.final();
+ }
+ if (HPMHooks.count.HP_loginlog_final_post > 0) {
+ bool (*postHookFunc) (bool retVal___);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_final_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_loginlog_final_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___);
+ }
+ }
+ return retVal___;
+}
+bool HP_loginlog_config_read_names(const char *filename, struct config_t *config, bool imported) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_loginlog_config_read_names_pre > 0) {
+ bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_config_read_names_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_loginlog_config_read_names_pre[hIndex].func;
+ retVal___ = preHookFunc(&filename, &config, &imported);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.loginlog.config_read_names(filename, config, imported);
+ }
+ if (HPMHooks.count.HP_loginlog_config_read_names_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_config_read_names_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_loginlog_config_read_names_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename, config, imported);
+ }
+ }
+ return retVal___;
+}
+bool HP_loginlog_config_read_log(const char *filename, struct config_t *config, bool imported) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_loginlog_config_read_log_pre > 0) {
+ bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_config_read_log_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_loginlog_config_read_log_pre[hIndex].func;
+ retVal___ = preHookFunc(&filename, &config, &imported);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.loginlog.config_read_log(filename, config, imported);
+ }
+ if (HPMHooks.count.HP_loginlog_config_read_log_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_config_read_log_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_loginlog_config_read_log_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename, config, imported);
+ }
+ }
+ return retVal___;
+}
+bool HP_loginlog_config_read(const char *filename, bool imported) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_loginlog_config_read_pre > 0) {
+ bool (*preHookFunc) (const char **filename, bool *imported);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_config_read_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_loginlog_config_read_pre[hIndex].func;
+ retVal___ = preHookFunc(&filename, &imported);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.loginlog.config_read(filename, imported);
+ }
+ if (HPMHooks.count.HP_loginlog_config_read_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *filename, bool imported);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_loginlog_config_read_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_loginlog_config_read_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename, imported);
+ }
+ }
+ return retVal___;
+}
/* md5_interface */
void HP_md5_string(const char *string, char *output) {
int hIndex = 0;
diff --git a/src/plugins/HPMHooking/HPMHooking_login.sources.inc b/src/plugins/HPMHooking/HPMHooking_login.sources.inc
index 55ced3025..78c506043 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.sources.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.sources.inc
@@ -26,15 +26,19 @@
/* GENERATED FILE DO NOT EDIT */
HPMHooks.source.HCache = *HCache;
+HPMHooks.source.account = *account;
HPMHooks.source.cmdline = *cmdline;
HPMHooks.source.console = *console;
HPMHooks.source.core = *core;
HPMHooks.source.DB = *DB;
HPMHooks.source.des = *des;
+HPMHooks.source.ipban = *ipban;
+HPMHooks.source.lchrif = *lchrif;
HPMHooks.source.lclif = *lclif;
HPMHooks.source.PRIV__lclif = *lclif->p;
HPMHooks.source.libconfig = *libconfig;
HPMHooks.source.login = *login;
+HPMHooks.source.loginlog = *loginlog;
HPMHooks.source.md5 = *md5;
HPMHooks.source.mutex = *mutex;
HPMHooks.source.nullpo = *nullpo;
diff --git a/vcproj-11/login-server.vcxproj b/vcproj-11/login-server.vcxproj
index 6e9088f10..9abd5dc90 100644
--- a/vcproj-11/login-server.vcxproj
+++ b/vcproj-11/login-server.vcxproj
@@ -196,12 +196,12 @@
<ClCompile Include="..\src\common\des.c" />
<ClCompile Include="..\src\common\mutex.c" />
<ClCompile Include="..\src\common\thread.c" />
- <ClCompile Include="..\src\login\account_sql.c" />
+ <ClCompile Include="..\src\login\account.c" />
<ClCompile Include="..\src\login\HPMlogin.c" />
- <ClCompile Include="..\src\login\ipban_sql.c" />
+ <ClCompile Include="..\src\login\ipban.c" />
<ClCompile Include="..\src\login\lclif.c" />
<ClCompile Include="..\src\login\login.c" />
- <ClCompile Include="..\src\login\loginlog_sql.c" />
+ <ClCompile Include="..\src\login\loginlog.c" />
<ClCompile Include="..\src\common\conf.c" />
<ClCompile Include="..\src\common\core.c" />
<ClCompile Include="..\src\common\console.c" />
diff --git a/vcproj-11/login-server.vcxproj.filters b/vcproj-11/login-server.vcxproj.filters
index f41fcdfac..1f3b6ba0f 100644
--- a/vcproj-11/login-server.vcxproj.filters
+++ b/vcproj-11/login-server.vcxproj.filters
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <ClCompile Include="..\src\login\account_sql.c">
+ <ClCompile Include="..\src\login\account.c">
<Filter>login</Filter>
</ClCompile>
<ClCompile Include="..\src\login\HPMlogin.c">
<Filter>login</Filter>
</ClCompile>
- <ClCompile Include="..\src\login\ipban_sql.c">
+ <ClCompile Include="..\src\login\ipban.c">
<Filter>login</Filter>
</ClCompile>
<ClCompile Include="..\src\login\login.c">
<Filter>login</Filter>
</ClCompile>
- <ClCompile Include="..\src\login\loginlog_sql.c">
+ <ClCompile Include="..\src\login\loginlog.c">
<Filter>login</Filter>
</ClCompile>
<ClCompile Include="..\src\common\conf.c">
diff --git a/vcproj-12/login-server.vcxproj b/vcproj-12/login-server.vcxproj
index 91fa58082..a1cd6fc0e 100644
--- a/vcproj-12/login-server.vcxproj
+++ b/vcproj-12/login-server.vcxproj
@@ -196,12 +196,12 @@
<ClCompile Include="..\src\common\des.c" />
<ClCompile Include="..\src\common\mutex.c" />
<ClCompile Include="..\src\common\thread.c" />
- <ClCompile Include="..\src\login\account_sql.c" />
+ <ClCompile Include="..\src\login\account.c" />
<ClCompile Include="..\src\login\HPMlogin.c" />
- <ClCompile Include="..\src\login\ipban_sql.c" />
+ <ClCompile Include="..\src\login\ipban.c" />
<ClCompile Include="..\src\login\lclif.c" />
<ClCompile Include="..\src\login\login.c" />
- <ClCompile Include="..\src\login\loginlog_sql.c" />
+ <ClCompile Include="..\src\login\loginlog.c" />
<ClCompile Include="..\src\common\conf.c" />
<ClCompile Include="..\src\common\core.c" />
<ClCompile Include="..\src\common\console.c" />
diff --git a/vcproj-12/login-server.vcxproj.filters b/vcproj-12/login-server.vcxproj.filters
index f41fcdfac..1f3b6ba0f 100644
--- a/vcproj-12/login-server.vcxproj.filters
+++ b/vcproj-12/login-server.vcxproj.filters
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <ClCompile Include="..\src\login\account_sql.c">
+ <ClCompile Include="..\src\login\account.c">
<Filter>login</Filter>
</ClCompile>
<ClCompile Include="..\src\login\HPMlogin.c">
<Filter>login</Filter>
</ClCompile>
- <ClCompile Include="..\src\login\ipban_sql.c">
+ <ClCompile Include="..\src\login\ipban.c">
<Filter>login</Filter>
</ClCompile>
<ClCompile Include="..\src\login\login.c">
<Filter>login</Filter>
</ClCompile>
- <ClCompile Include="..\src\login\loginlog_sql.c">
+ <ClCompile Include="..\src\login\loginlog.c">
<Filter>login</Filter>
</ClCompile>
<ClCompile Include="..\src\common\conf.c">
diff --git a/vcproj-14/login-server.vcxproj b/vcproj-14/login-server.vcxproj
index 445d21ee4..44dee52be 100644
--- a/vcproj-14/login-server.vcxproj
+++ b/vcproj-14/login-server.vcxproj
@@ -194,12 +194,12 @@
<ClCompile Include="..\src\common\des.c" />
<ClCompile Include="..\src\common\mutex.c" />
<ClCompile Include="..\src\common\thread.c" />
- <ClCompile Include="..\src\login\account_sql.c" />
+ <ClCompile Include="..\src\login\account.c" />
<ClCompile Include="..\src\login\HPMlogin.c" />
- <ClCompile Include="..\src\login\ipban_sql.c" />
+ <ClCompile Include="..\src\login\ipban.c" />
<ClCompile Include="..\src\login\lclif.c" />
<ClCompile Include="..\src\login\login.c" />
- <ClCompile Include="..\src\login\loginlog_sql.c" />
+ <ClCompile Include="..\src\login\loginlog.c" />
<ClCompile Include="..\src\common\conf.c" />
<ClCompile Include="..\src\common\core.c" />
<ClCompile Include="..\src\common\console.c" />
diff --git a/vcproj-14/login-server.vcxproj.filters b/vcproj-14/login-server.vcxproj.filters
index f41fcdfac..1f3b6ba0f 100644
--- a/vcproj-14/login-server.vcxproj.filters
+++ b/vcproj-14/login-server.vcxproj.filters
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <ClCompile Include="..\src\login\account_sql.c">
+ <ClCompile Include="..\src\login\account.c">
<Filter>login</Filter>
</ClCompile>
<ClCompile Include="..\src\login\HPMlogin.c">
<Filter>login</Filter>
</ClCompile>
- <ClCompile Include="..\src\login\ipban_sql.c">
+ <ClCompile Include="..\src\login\ipban.c">
<Filter>login</Filter>
</ClCompile>
<ClCompile Include="..\src\login\login.c">
<Filter>login</Filter>
</ClCompile>
- <ClCompile Include="..\src\login\loginlog_sql.c">
+ <ClCompile Include="..\src\login\loginlog.c">
<Filter>login</Filter>
</ClCompile>
<ClCompile Include="..\src\common\conf.c">