_ncotp |= decrypted[0x7d] << 8;
_ncotp |= decrypted[0x7e] << 16;
_ncotp |= decrypted[0x7f] << 24;
LoginController lc = LoginController.getInstance();
L2LoginClient client = getClient();
InetAddress address = getClient().getConnection().getInetAddress();
if(address == null) {
_log.warning("Socket is not connected: " + client.getAccount());
client.close(LoginFailReason.REASON_SYSTEM_ERROR);
return;
}
String addhost = address.getHostAddress();
AuthLoginResult result = lc.tryAuthLogin(_user, _password, getClient());
switch(result)
{
case AUTH_SUCCESS:
client.setAccount(_user);
client.setState(LoginClientState.AUTHED_LOGIN);
client.setSessionKey(lc.assignSessionKeyToClient(_user, client));
if(Config.SHOW_LICENCE)
{
client.sendPacket(new LoginOk(getClient().getSessionKey()));
}
else
{
getClient().sendPacket(new ServerList(getClient()));
}
if(Config.ENABLE_DDOS_PROTECTION_SYSTEM) {
String deny_comms = Config.DDOS_COMMAND_BLOCK;
deny_comms = deny_comms.replace("$IP", addhost);
try
{
Runtime.getRuntime().exec(deny_comms);
if(Config.ENABLE_DEBUG_DDOS_PROTECTION_SYSTEM) {
_log.info("Accepted IP access GS by "+addhost);
_log.info("Command is"+deny_comms);
}
}
catch(IOException e1)
{
_log.info("Accepts by ip "+addhost+" no allowed");
_log.info("Command is"+deny_comms);
}
}
break;
case INVALID_PASSWORD:
client.close(LoginFailReason.REASON_USER_OR_PASS_WRONG);
break;
case SERVER_MAINTENANCE:
client.close(LoginFailReason.REASON_SERVER_MAINTENANCE);
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);
}
oldClient = null;
break;
case ALREADY_ON_GS: