summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-20 17:10:53 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-20 17:10:53 +0000
commite39697a8dd79ff05538761ebe60ae4e0efa44bd4 (patch)
tree9d811de3db55a9aa1d2dfb85766a43e387687198 /src
parentd0e2bdc12e685eb0166d4aa55eee6fe2f79c1b73 (diff)
downloadhercules-e39697a8dd79ff05538761ebe60ae4e0efa44bd4.tar.gz
hercules-e39697a8dd79ff05538761ebe60ae4e0efa44bd4.tar.bz2
hercules-e39697a8dd79ff05538761ebe60ae4e0efa44bd4.tar.xz
hercules-e39697a8dd79ff05538761ebe60ae4e0efa44bd4.zip
Added back SQL charserver listening socket code that got removed in the /tmpsql merge.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11251 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/char_sql/char.c4
-rw-r--r--src/char_sql/int_storage.c2
-rw-r--r--src/login/login.c81
3 files changed, 45 insertions, 42 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index e2baa3b9e..e13744754 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -3930,7 +3930,11 @@ int do_init(int argc, char **argv)
Sql_ShowDebug(sql_handle);
ShowInfo("End of char server initilization function.\n");
+
+ ShowInfo("open port %d.....\n",char_port);
+ char_fd = make_listen_bind(bind_ip, char_port);
ShowStatus("The char-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", char_port);
+
return 0;
}
diff --git a/src/char_sql/int_storage.c b/src/char_sql/int_storage.c
index b13f37200..fc8d9f8f3 100644
--- a/src/char_sql/int_storage.c
+++ b/src/char_sql/int_storage.c
@@ -24,7 +24,7 @@ struct guild_storage *guild_storage_pt=NULL;
#endif //TXT_SQL_CONVERT
/// Save guild_storage data to sql
-int storage_tosql(int account_id,struct storage* p)
+int storage_tosql(int account_id, struct storage* p)
{
memitemdata_to_sql(p->storage_, MAX_STORAGE, account_id, TABLE_STORAGE);
//ShowInfo ("storage save to DB - account: %d\n", account_id);
diff --git a/src/login/login.c b/src/login/login.c
index a1d8cd758..61d9bbf1f 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -1241,54 +1241,53 @@ int mmo_auth(struct mmo_account* account, int fd)
return 0; // 0 = Unregistered ID
}
- if( login_config.use_md5_passwds )
- MD5_String(account->passwd, user_password);
- else
- safestrncpy(user_password, account->passwd, NAME_LENGTH);
+ if( login_config.use_md5_passwds )
+ MD5_String(account->passwd, user_password);
+ else
+ safestrncpy(user_password, account->passwd, NAME_LENGTH);
- if( !check_password(session[fd]->session_data, account->passwdenc, user_password, auth_dat[i].pass) )
- {
- login_log("Invalid password (account: %s, pass: %s, received pass: %s, ip: %s)\n", account->userid, auth_dat[i].pass, (account->passwdenc) ? "[MD5]" : account->passwd, ip);
- return 1; // 1 = Incorrect Password
- }
+ if( !check_password(session[fd]->session_data, account->passwdenc, user_password, auth_dat[i].pass) )
+ {
+ login_log("Invalid password (account: %s, pass: %s, received pass: %s, ip: %s)\n", account->userid, auth_dat[i].pass, (account->passwdenc) ? "[MD5]" : account->passwd, ip);
+ return 1; // 1 = Incorrect Password
+ }
- if( auth_dat[i].connect_until_time != 0 && auth_dat[i].connect_until_time < time(NULL) )
- {
- login_log("Connection refused (account: %s, pass: %s, expired ID, ip: %s)\n", account->userid, account->passwd, ip);
- return 2; // 2 = This ID is expired
- }
+ if( auth_dat[i].connect_until_time != 0 && auth_dat[i].connect_until_time < time(NULL) )
+ {
+ login_log("Connection refused (account: %s, pass: %s, expired ID, ip: %s)\n", account->userid, account->passwd, ip);
+ return 2; // 2 = This ID is expired
+ }
- if( auth_dat[i].ban_until_time != 0 && auth_dat[i].ban_until_time > time(NULL) )
- {
- strftime(tmpstr, 20, login_config.date_format, localtime(&auth_dat[i].ban_until_time));
- tmpstr[19] = '\0';
- login_log("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n", account->userid, account->passwd, tmpstr, ip);
- return 6; // 6 = Your are Prohibited to log in until %s
- }
+ if( auth_dat[i].ban_until_time != 0 && auth_dat[i].ban_until_time > time(NULL) )
+ {
+ strftime(tmpstr, 20, login_config.date_format, localtime(&auth_dat[i].ban_until_time));
+ tmpstr[19] = '\0';
+ login_log("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n", account->userid, account->passwd, tmpstr, ip);
+ return 6; // 6 = Your are Prohibited to log in until %s
+ }
- if( auth_dat[i].state )
- {
- login_log("Connection refused (account: %s, pass: %s, state: %d, ip: %s)\n", account->userid, account->passwd, auth_dat[i].state, ip);
- return auth_dat[i].state - 1;
- }
+ if( auth_dat[i].state )
+ {
+ login_log("Connection refused (account: %s, pass: %s, state: %d, ip: %s)\n", account->userid, account->passwd, auth_dat[i].state, ip);
+ return auth_dat[i].state - 1;
+ }
- if( login_config.online_check )
+ if( login_config.online_check )
+ {
+ struct online_login_data* data = idb_get(online_db,auth_dat[i].account_id);
+ if( data && data->char_server > -1 )
{
- struct online_login_data* data = idb_get(online_db,auth_dat[i].account_id);
- if( data && data->char_server > -1 )
- {
- //Request char servers to kick this account out. [Skotlex]
- unsigned char buf[8];
- ShowNotice("User [%d] is already online - Rejected.\n",auth_dat[i].account_id);
- WBUFW(buf,0) = 0x2734;
- WBUFL(buf,2) = auth_dat[i].account_id;
- charif_sendallwos(-1, buf, 6);
- if( data->waiting_disconnect == -1 )
- data->waiting_disconnect = add_timer(gettick()+30000, waiting_disconnect_timer, auth_dat[i].account_id, 0);
- return 3; // Rejected
- }
+ //Request char servers to kick this account out. [Skotlex]
+ unsigned char buf[8];
+ ShowNotice("User [%d] is already online - Rejected.\n",auth_dat[i].account_id);
+ WBUFW(buf,0) = 0x2734;
+ WBUFL(buf,2) = auth_dat[i].account_id;
+ charif_sendallwos(-1, buf, 6);
+ if( data->waiting_disconnect == -1 )
+ data->waiting_disconnect = add_timer(gettick()+30000, waiting_disconnect_timer, auth_dat[i].account_id, 0);
+ return 3; // Rejected
}
-
+ }
login_log("Authentification accepted (account: %s (id: %d), ip: %s)\n", account->userid, auth_dat[i].account_id, ip);