Add ServerHangWatchdog to TerminalTransformer whitelist. Closes #2203

This commit is contained in:
LexManos 2016-05-28 21:19:47 -07:00
parent 978861b521
commit 93be22fc8e

View file

@ -134,11 +134,15 @@ public class TerminalTransformer implements IClassTransformer
String callingClass = cause.length > 2 ? cause[3].getClassName() : "none";
String callingParent = cause.length > 3 ? cause[4].getClassName() : "none";
// FML is allowed to call system exit and the Minecraft applet (from the quit button), and the dedicated server (from itself)
if (!(callingClass.startsWith("net.minecraftforge.fml.") ||
("net.minecraft.client.Minecraft".equals(callingClass) && "net.minecraft.client.Minecraft".equals(callingParent)) ||
("net.minecraft.server.gui.MinecraftServerGui$1".equals(callingClass) && "java.awt.AWTEventMulticaster".equals(callingParent)) ||
("net.minecraft.server.dedicated.DedicatedServer".equals(callingClass) && "net.minecraft.server.MinecraftServer".equals(callingParent)))
)
boolean allowed = false;
allowed |= callingClass.startsWith("net.minecraftforge.fml.");
allowed |= callingClass.equals("net.minecraft.client.Minecraft") && callingParent.equals("net.minecraft.client.Minecraft");
allowed |= callingClass.equals("net.minecraft.server.gui.MinecraftServerGui$1") && callingParent.equals("java.awt.AWTEventMulticaster");
allowed |= callingClass.equals("net.minecraft.server.dedicated.DedicatedServer") && callingParent.equals("net.minecraft.server.MinecraftServer");
allowed |= callingClass.equals("net.minecraft.server.dedicated.ServerHangWatchdog");
allowed |= callingClass.equals("net.minecraft.server.dedicated.ServerHangWatchdog$1");
if (!allowed)
{
throw new ExitTrappedException();
}