|
@@ -14,7 +14,6 @@
|
|
*/
|
|
*/
|
|
package com.l2jserver.loginserver.network.clientpackets;
|
|
package com.l2jserver.loginserver.network.clientpackets;
|
|
|
|
|
|
-import java.net.InetAddress;
|
|
|
|
import java.security.GeneralSecurityException;
|
|
import java.security.GeneralSecurityException;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
import java.util.logging.Logger;
|
|
@@ -23,7 +22,6 @@ import javax.crypto.Cipher;
|
|
|
|
|
|
import com.l2jserver.Config;
|
|
import com.l2jserver.Config;
|
|
import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
|
|
import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
|
|
-import com.l2jserver.loginserver.HackingException;
|
|
|
|
import com.l2jserver.loginserver.LoginController;
|
|
import com.l2jserver.loginserver.LoginController;
|
|
import com.l2jserver.loginserver.LoginController.AuthLoginResult;
|
|
import com.l2jserver.loginserver.LoginController.AuthLoginResult;
|
|
import com.l2jserver.loginserver.network.L2LoginClient;
|
|
import com.l2jserver.loginserver.network.L2LoginClient;
|
|
@@ -114,62 +112,53 @@ public class RequestAuthLogin extends L2LoginClientPacket
|
|
}
|
|
}
|
|
|
|
|
|
final LoginController lc = LoginController.getInstance();
|
|
final LoginController lc = LoginController.getInstance();
|
|
- try
|
|
|
|
|
|
+ AuthLoginResult result = lc.tryAuthLogin(_user, _password, client);
|
|
|
|
+ switch (result)
|
|
{
|
|
{
|
|
- AuthLoginResult result = lc.tryAuthLogin(_user, _password, client);
|
|
|
|
- switch (result)
|
|
|
|
- {
|
|
|
|
- case AUTH_SUCCESS:
|
|
|
|
- client.setAccount(_user);
|
|
|
|
- client.setState(LoginClientState.AUTHED_LOGIN);
|
|
|
|
- client.setSessionKey(lc.assignSessionKeyToClient(_user, client));
|
|
|
|
- lc.getCharactersOnAccount(_user);
|
|
|
|
- if (Config.SHOW_LICENCE)
|
|
|
|
- {
|
|
|
|
- client.sendPacket(new LoginOk(getClient().getSessionKey()));
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- getClient().sendPacket(new ServerList(getClient()));
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
- case INVALID_PASSWORD:
|
|
|
|
- client.close(LoginFailReason.REASON_USER_OR_PASS_WRONG);
|
|
|
|
- break;
|
|
|
|
- case ACCOUNT_BANNED:
|
|
|
|
- client.close(new AccountKicked(AccountKickedReason.REASON_PERMANENTLY_BANNED));
|
|
|
|
- break;
|
|
|
|
- case ALREADY_ON_LS:
|
|
|
|
- L2LoginClient oldClient;
|
|
|
|
- if ((oldClient = lc.getAuthedClient(_user)) != null)
|
|
|
|
- {
|
|
|
|
- // kick the other client
|
|
|
|
- oldClient.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
|
|
|
|
- lc.removeAuthedLoginClient(_user);
|
|
|
|
- }
|
|
|
|
- // kick also current client
|
|
|
|
|
|
+ case AUTH_SUCCESS:
|
|
|
|
+ client.setAccount(_user);
|
|
|
|
+ client.setState(LoginClientState.AUTHED_LOGIN);
|
|
|
|
+ client.setSessionKey(lc.assignSessionKeyToClient(_user, client));
|
|
|
|
+ lc.getCharactersOnAccount(_user);
|
|
|
|
+ if (Config.SHOW_LICENCE)
|
|
|
|
+ {
|
|
|
|
+ client.sendPacket(new LoginOk(getClient().getSessionKey()));
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ getClient().sendPacket(new ServerList(getClient()));
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case INVALID_PASSWORD:
|
|
|
|
+ client.close(LoginFailReason.REASON_USER_OR_PASS_WRONG);
|
|
|
|
+ break;
|
|
|
|
+ case ACCOUNT_BANNED:
|
|
|
|
+ client.close(new AccountKicked(AccountKickedReason.REASON_PERMANENTLY_BANNED));
|
|
|
|
+ break;
|
|
|
|
+ case ALREADY_ON_LS:
|
|
|
|
+ L2LoginClient oldClient;
|
|
|
|
+ if ((oldClient = lc.getAuthedClient(_user)) != null)
|
|
|
|
+ {
|
|
|
|
+ // kick the other client
|
|
|
|
+ oldClient.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
|
|
|
|
+ lc.removeAuthedLoginClient(_user);
|
|
|
|
+ }
|
|
|
|
+ // kick also current client
|
|
|
|
+ client.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
|
|
|
|
+ break;
|
|
|
|
+ case ALREADY_ON_GS:
|
|
|
|
+ GameServerInfo gsi;
|
|
|
|
+ if ((gsi = lc.getAccountOnGameServer(_user)) != null)
|
|
|
|
+ {
|
|
client.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
|
|
client.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
|
|
- break;
|
|
|
|
- case ALREADY_ON_GS:
|
|
|
|
- GameServerInfo gsi;
|
|
|
|
- if ((gsi = lc.getAccountOnGameServer(_user)) != null)
|
|
|
|
|
|
+
|
|
|
|
+ // kick from there
|
|
|
|
+ if (gsi.isAuthed())
|
|
{
|
|
{
|
|
- client.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
|
|
|
|
-
|
|
|
|
- // kick from there
|
|
|
|
- if (gsi.isAuthed())
|
|
|
|
- {
|
|
|
|
- gsi.getGameServerThread().kickPlayer(_user);
|
|
|
|
- }
|
|
|
|
|
|
+ gsi.getGameServerThread().kickPlayer(_user);
|
|
}
|
|
}
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- catch (HackingException e)
|
|
|
|
- {
|
|
|
|
- InetAddress address = getClient().getConnection().getInetAddress();
|
|
|
|
- lc.addBanForAddress(address, Config.LOGIN_BLOCK_AFTER_BAN * 1000);
|
|
|
|
- _log.info("Banned (" + address + ") for " + Config.LOGIN_BLOCK_AFTER_BAN + " seconds, due to " + e.getConnects() + " incorrect login attempts.");
|
|
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|