summaryrefslogtreecommitdiff
path: root/src/login/login.c
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/login/login.c
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/login/login.c')
-rw-r--r--src/login/login.c81
1 files changed, 40 insertions, 41 deletions
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);