Index: C:/eclipse/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java =================================================================== --- C:/eclipse/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (revision 1474) +++ C:/eclipse/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (working copy) @@ -87,6 +87,9 @@ } else if (_command.startsWith("npc_")) { + if(!activeChar.validateBypass(_command)) + return; + int endOfId = _command.indexOf('_', 5); String id; if (endOfId > 0) @@ -122,6 +125,9 @@ } else if (_command.startsWith("Quest ")) { + if(!activeChar.validateBypass(_command)) + return; + L2PcInstance player = getClient().getActiveChar(); String p = _command.substring(6).trim(); int idx = p.indexOf(' '); @@ -133,6 +139,10 @@ } catch (Exception e) { _log.log(Level.WARNING, "Bad RequestBypassToServer: ", e); } + finally + { + activeChar.clearBypass(); + } } /** Index: C:/eclipse/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- C:/eclipse/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 1474) +++ C:/eclipse/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -457,6 +457,9 @@ /** Stored from last ValidatePosition **/ public Point3D _lastClientPosition = new Point3D(0, 0, 0); public Point3D _lastServerPosition = new Point3D(0, 0, 0); + + /** Bypass validations */ + private List _validBypass = new FastList(); /** * Create a new L2PcInstance and add it in the characters table of the database.

@@ -6326,4 +6329,26 @@ public void addExpAndSp(int addToExp, int addToSp) { getStat().addExpAndSp(addToExp, addToSp); } public void reduceCurrentHp(double i, L2Character attacker) { getStatus().reduceHp(i, attacker); } public void reduceCurrentHp(double value, L2Character attacker, boolean awake) { getStatus().reduceHp(value, attacker, awake); } + + public void addBypass(String bypass) + { + _validBypass.add(bypass); + } + + public boolean validateBypass(String cmd) + { + for(String bp : _validBypass) + { + if(bp.equals(cmd)) + return true; + } + + _log.warning("[L2PcInstance] player ["+getName()+"] sent invalid bypass, ban this player!"); + return false; + } + + public void clearBypass() + { + _validBypass.clear(); + } } Index: C:/eclipse/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/serverpackets/NpcHtmlMessage.java =================================================================== --- C:/eclipse/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/serverpackets/NpcHtmlMessage.java (revision 1474) +++ C:/eclipse/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/serverpackets/NpcHtmlMessage.java (working copy) @@ -178,9 +178,27 @@ final void runImpl() { - // no long-running tasks + buildBypassCache(); } + public final void buildBypassCache() + { + int len = _html.length(); + + for(int i=0;i