Allow local/LAN/WAN login-phase connections

Allow clients connecting from different IP domains (local/LAN/WAN) to get past login phase and clean unnecessary local server check.
This commit is contained in:
ronancpl
2021-04-09 20:54:53 -03:00
parent fa992da2eb
commit 7a3d5d2b94
13 changed files with 66 additions and 26 deletions

View File

@@ -61,21 +61,7 @@ public final class LoginPasswordHandler implements MaplePacketHandler {
@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
String remoteHost = getRemoteIp(c.getSession());
if (!remoteHost.contentEquals("null")) {
if (YamlConfig.config.server.USE_IP_VALIDATION) { // thanks Alex-0000 (CanIGetaPR) for suggesting IP validation as a server flag
if (remoteHost.startsWith("127.")) {
if (!YamlConfig.config.server.LOCALSERVER) { // thanks Mills for noting HOST can also have a field named "localhost"
c.announce(MaplePacketCreator.getLoginFailed(13)); // cannot login as localhost if it's not a local server
return;
}
} else {
if (YamlConfig.config.server.LOCALSERVER) {
c.announce(MaplePacketCreator.getLoginFailed(13)); // cannot login as non-localhost if it's a local server
return;
}
}
}
} else {
if (remoteHost.contentEquals("null")) {
c.announce(MaplePacketCreator.getLoginFailed(14)); // thanks Alchemist for noting remoteHost could be null
return;
}