Preparations for the login server TXT/SQL merge

- copied the sql login server code to /src/login
- merged the login server header files
- moved the account savefile name config setting to inter_athena.conf and renamed it to match the other settings

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12478 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2008-04-04 17:07:31 +00:00
parent ccaf9887c1
commit 6148165707
14 changed files with 2019 additions and 38 deletions

View File

@ -2,6 +2,9 @@
// TXT version options only // TXT version options only
// Account flatfile database, stores account information.
account_txt: save/account.txt
// Storage flatfile database, used for Karfa storage. // Storage flatfile database, used for Karfa storage.
storage_txt: save/storage.txt storage_txt: save/storage.txt

View File

@ -62,9 +62,6 @@ new_account: yes
allowed_regs: 1 allowed_regs: 1
time_allowed: 10 time_allowed: 10
// Account flatfile database, stores account information.
account_filename: save/account.txt
// What account AIDs have GM privs, and what level? // What account AIDs have GM privs, and what level?
gm_account_filename: conf/GM_account.txt gm_account_filename: conf/GM_account.txt

View File

@ -10,7 +10,7 @@ COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h
../common/grfio.h ../common/mapindex.h \ ../common/grfio.h ../common/mapindex.h \
../common/ers.h ../common/md5calc.h ../common/ers.h ../common/md5calc.h
LOGIN_OBJ = obj_txt/login.o obj_txt/admin.o LOGIN_OBJ = obj_txt/login_txt.o obj_txt/admin.o
LOGIN_H = login.h LOGIN_H = login.h
@SET_MAKE@ @SET_MAKE@

View File

@ -7,6 +7,7 @@
#include "../common/mmo.h" // NAME_LENGTH #include "../common/mmo.h" // NAME_LENGTH
#define LOGIN_CONF_NAME "conf/login_athena.conf" #define LOGIN_CONF_NAME "conf/login_athena.conf"
#define INTER_CONF_NAME "conf/inter_athena.conf"
#define LAN_CONF_NAME "conf/subnet_athena.conf" #define LAN_CONF_NAME "conf/subnet_athena.conf"
// supported encryption types: 1- passwordencrypt, 2- passwordencrypt2, 3- both // supported encryption types: 1- passwordencrypt, 2- passwordencrypt2, 3- both
@ -38,9 +39,9 @@ struct mmo_char_server {
int fd; int fd;
uint32 ip; uint32 ip;
uint16 port; uint16 port;
uint16 users; // user count on this server uint16 users; // user count on this server
uint16 maintenance; // in maintenance mode? uint16 maintenance; // in maintenance mode?
uint16 new_; // allows creating new chars? uint16 new_; // should display as 'new'?
}; };
struct Login_Config { struct Login_Config {
@ -53,19 +54,19 @@ struct Login_Config {
bool console; // console input system enabled? bool console; // console input system enabled?
bool new_account_flag; // autoregistration via _M/_F ? bool new_account_flag; // autoregistration via _M/_F ?
int start_limited_time; // new account expiration time (-1: unlimited) int start_limited_time; // new account expiration time (-1: unlimited)
// bool case_sensitive; // are logins case sensitive ? bool case_sensitive; // are logins case sensitive ?
bool use_md5_passwds; // work with password hashes instead of plaintext passwords? bool use_md5_passwds; // work with password hashes instead of plaintext passwords?
// bool login_gm_read; // should the login server handle info about gm accounts? bool login_gm_read; // should the login server handle info about gm accounts?
int min_level_to_connect; // minimum level of player/GM (0: player, 1-99: GM) to connect int min_level_to_connect; // minimum level of player/GM (0: player, 1-99: GM) to connect
bool online_check; // reject incoming players that are already registered as online ? bool online_check; // reject incoming players that are already registered as online ?
bool check_client_version; // check the clientversion set in the clientinfo ? bool check_client_version; // check the clientversion set in the clientinfo ?
int client_version_to_connect; // the client version needed to connect (if checking is enabled) int client_version_to_connect; // the client version needed to connect (if checking is enabled)
// bool ipban; // perform IP blocking (via contents of `ipbanlist`) ? bool ipban; // perform IP blocking (via contents of `ipbanlist`) ?
// bool dynamic_pass_failure_ban; // automatic IP blocking due to failed login attemps ? bool dynamic_pass_failure_ban; // automatic IP blocking due to failed login attemps ?
// unsigned int dynamic_pass_failure_ban_interval; // how far to scan the loginlog for password failures unsigned int dynamic_pass_failure_ban_interval; // how far to scan the loginlog for password failures
// unsigned int dynamic_pass_failure_ban_limit; // number of failures needed to trigger the ipban unsigned int dynamic_pass_failure_ban_limit; // number of failures needed to trigger the ipban
// unsigned int dynamic_pass_failure_ban_duration; // duration of the ipban unsigned int dynamic_pass_failure_ban_duration; // duration of the ipban
bool use_dnsbl; // dns blacklist blocking ? bool use_dnsbl; // dns blacklist blocking ?
char dnsbl_servs[1024]; // comma-separated list of dnsbl servers char dnsbl_servs[1024]; // comma-separated list of dnsbl servers

1982
src/login/login_sql.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -52,7 +52,7 @@ unsigned int new_reg_tick = 0;
// data handling (TXT) // data handling (TXT)
char account_filename[1024] = "save/account.txt"; char account_txt[1024] = "save/account.txt";
// account database // account database
struct mmo_account* auth_dat = NULL; struct mmo_account* auth_dat = NULL;
@ -368,9 +368,9 @@ int mmo_auth_init(void)
auth_max = 256; auth_max = 256;
CREATE(auth_dat, struct mmo_account, auth_max); CREATE(auth_dat, struct mmo_account, auth_max);
if ((fp = fopen(account_filename, "r")) == NULL) { if ((fp = fopen(account_txt, "r")) == NULL) {
// no account file -> no account -> no login, including char-server (ERROR) // no account file -> no account -> no login, including char-server (ERROR)
ShowError(CL_RED"mmmo_auth_init: Accounts file [%s] not found."CL_RESET"\n", account_filename); ShowError(CL_RED"mmmo_auth_init: Accounts file [%s] not found."CL_RESET"\n", account_txt);
return 0; return 0;
} }
@ -617,12 +617,12 @@ int mmo_auth_init(void)
fclose(fp); fclose(fp);
if( auth_num == 0 ) if( auth_num == 0 )
ShowNotice("mmo_auth_init: No account found in %s.\n", account_filename); ShowNotice("mmo_auth_init: No account found in %s.\n", account_txt);
else else
if( auth_num == 1 ) if( auth_num == 1 )
ShowStatus("mmo_auth_init: 1 account read in %s,\n", account_filename); ShowStatus("mmo_auth_init: 1 account read in %s,\n", account_txt);
else else
ShowStatus("mmo_auth_init: %d accounts read in %s,\n", auth_num, account_filename); ShowStatus("mmo_auth_init: %d accounts read in %s,\n", auth_num, account_txt);
if( GM_count == 0 ) if( GM_count == 0 )
ShowStatus(" of which is no GM account, and \n"); ShowStatus(" of which is no GM account, and \n");
@ -671,7 +671,7 @@ void mmo_auth_sync(void)
} }
// Data save // Data save
if ((fp = lock_fopen(account_filename, &lock)) == NULL) { if ((fp = lock_fopen(account_txt, &lock)) == NULL) {
//if (id) aFree(id); //if (id) aFree(id);
DELETE_BUFFER(id); DELETE_BUFFER(id);
return; return;
@ -699,7 +699,7 @@ void mmo_auth_sync(void)
} }
fprintf(fp, "%d\t%%newid%%\n", account_id_count); fprintf(fp, "%d\t%%newid%%\n", account_id_count);
lock_fclose(fp, account_filename, &lock); lock_fclose(fp, account_txt, &lock);
// set new counter to minimum number of auth before save // set new counter to minimum number of auth before save
auth_before_save_file = auth_num / AUTH_SAVE_FILE_DIVIDER; // Re-initialise counter. We have save. auth_before_save_file = auth_num / AUTH_SAVE_FILE_DIVIDER; // Re-initialise counter. We have save.
@ -2137,10 +2137,8 @@ int login_config_read(const char* cfgName)
admin_pass[sizeof(admin_pass)-1] = '\0'; admin_pass[sizeof(admin_pass)-1] = '\0';
} else if (strcmpi(w1, "admin_allowed_ip") == 0) } else if (strcmpi(w1, "admin_allowed_ip") == 0)
admin_allowed_ip = host2ip(w2); admin_allowed_ip = host2ip(w2);
else if (strcmpi(w1, "account_filename") == 0) { else if (strcmpi(w1, "account_txt") == 0) {
memset(account_filename, 0, sizeof(account_filename)); safestrncpy(account_txt, w2, sizeof(account_txt));
strncpy(account_filename, w2, sizeof(account_filename));
account_filename[sizeof(account_filename)-1] = '\0';
} else if (strcmpi(w1, "gm_account_filename") == 0) { } else if (strcmpi(w1, "gm_account_filename") == 0) {
memset(GM_account_filename, 0, sizeof(GM_account_filename)); memset(GM_account_filename, 0, sizeof(GM_account_filename));
strncpy(GM_account_filename, w2, sizeof(GM_account_filename)); strncpy(GM_account_filename, w2, sizeof(GM_account_filename));

View File

@ -199,11 +199,11 @@ SOURCE=..\src\common\version.h
# PROP Default_Filter "" # PROP Default_Filter ""
# Begin Source File # Begin Source File
SOURCE=..\src\login_sql\login.c SOURCE=..\src\login\login_sql.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\src\login_sql\login.h SOURCE=..\src\login\login.h
# End Source File # End Source File
# End Group # End Group
# End Target # End Target

View File

@ -191,7 +191,7 @@ SOURCE=..\src\login\admin.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\src\login\login.c SOURCE=..\src\login\login_txt.c
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@ -145,10 +145,10 @@
Name="login_sql" Name="login_sql"
Filter=""> Filter="">
<File <File
RelativePath="..\src\login_sql\login.c"> RelativePath="..\src\login\login_sql.c">
</File> </File>
<File <File
RelativePath="..\src\login_sql\login.h"> RelativePath="..\src\login\login.h">
</File> </File>
</Filter> </Filter>
<Filter <Filter

View File

@ -151,7 +151,7 @@
RelativePath="..\src\login\admin.c"> RelativePath="..\src\login\admin.c">
</File> </File>
<File <File
RelativePath="..\src\login\login.c"> RelativePath="..\src\login\login_txt.c">
</File> </File>
<File <File
RelativePath="..\src\login\login.h"> RelativePath="..\src\login\login.h">

View File

@ -208,11 +208,11 @@
Name="login_sql" Name="login_sql"
> >
<File <File
RelativePath="..\src\login_sql\login.c" RelativePath="..\src\login\login_sql.c"
> >
</File> </File>
<File <File
RelativePath="..\src\login_sql\login.h" RelativePath="..\src\login\login.h"
> >
</File> </File>
</Filter> </Filter>

View File

@ -208,7 +208,7 @@
> >
</File> </File>
<File <File
RelativePath="..\src\login\login.c" RelativePath="..\src\login\login_txt.c"
> >
</File> </File>
<File <File

View File

@ -206,11 +206,11 @@
Name="login_sql" Name="login_sql"
> >
<File <File
RelativePath="..\src\login_sql\login.c" RelativePath="..\src\login\login_sql.c"
> >
</File> </File>
<File <File
RelativePath="..\src\login_sql\login.h" RelativePath="..\src\login\login.h"
> >
</File> </File>
</Filter> </Filter>

View File

@ -205,7 +205,7 @@
> >
</File> </File>
<File <File
RelativePath="..\src\login\login.c" RelativePath="..\src\login\login_txt.c"
> >
</File> </File>
<File <File