mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 12:19:56 +01:00
31 lines
2.2 KiB
Diff
31 lines
2.2 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Shane Freeder <theboyetronic@gmail.com>
|
||
|
Date: Sun, 18 Apr 2021 21:27:01 +0100
|
||
|
Subject: [PATCH] Add bypass host check
|
||
|
|
||
|
Paper.bypassHostCheck
|
||
|
|
||
|
Seriously, fix your firewalls. -.-
|
||
|
|
||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||
|
index c648b73a4c478f9d8020274205d6684f7c7c416f..4e055a41de3ee410682cc05a3b883ac8babeb290 100644
|
||
|
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||
|
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||
|
@@ -30,6 +30,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||
|
private static final Component IGNORE_STATUS_REASON = new TextComponent("Ignoring status request");
|
||
|
private final MinecraftServer server;
|
||
|
private final Connection connection; final Connection getNetworkManager() { return this.connection; } // Paper - OBFHELPER
|
||
|
+ private static final boolean BYPASS_HOSTCHECK = Boolean.getBoolean("Paper.bypassHostCheck"); // Paper
|
||
|
|
||
|
public ServerHandshakePacketListenerImpl(MinecraftServer server, Connection connection) {
|
||
|
this.server = server;
|
||
|
@@ -118,7 +119,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||
|
// Spigot Start
|
||
|
//if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||
|
String[] split = packet.hostName.split("\00");
|
||
|
- if ( ( split.length == 3 || split.length == 4 ) && ( HOST_PATTERN.matcher( split[1] ).matches() ) ) {
|
||
|
+ if ( ( split.length == 3 || split.length == 4 ) && ( BYPASS_HOSTCHECK || HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper
|
||
|
packet.hostName = split[0];
|
||
|
connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) connection.getRemoteAddress()).getPort());
|
||
|
connection.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] );
|