mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Add bypass host check
Paper.bypassHostCheck Seriously, fix your firewalls. -.-
This commit is contained in:
parent
3ab3613d10
commit
635832cc39
1 changed files with 8 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
@@ -13,8 +13,22 @@
|
||||
@@ -13,11 +13,26 @@
|
||||
import net.minecraft.network.protocol.status.StatusProtocols;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
|
@ -23,7 +23,11 @@
|
|||
private static final Component IGNORE_STATUS_REASON = Component.translatable("disconnect.ignoring_status_request");
|
||||
private final MinecraftServer server;
|
||||
private final Connection connection;
|
||||
@@ -26,6 +40,7 @@
|
||||
+ private static final boolean BYPASS_HOSTCHECK = Boolean.getBoolean("Paper.bypassHostCheck"); // Paper
|
||||
|
||||
public ServerHandshakePacketListenerImpl(MinecraftServer server, Connection connection) {
|
||||
this.server = server;
|
||||
@@ -26,6 +41,7 @@
|
||||
|
||||
@Override
|
||||
public void handleIntention(ClientIntentionPacket packet) {
|
||||
|
@ -31,7 +35,7 @@
|
|||
switch (packet.intention()) {
|
||||
case LOGIN:
|
||||
this.beginLogin(packet, false);
|
||||
@@ -55,23 +70,122 @@
|
||||
@@ -55,23 +71,122 @@
|
||||
throw new UnsupportedOperationException("Invalid intention " + String.valueOf(packet.intention()));
|
||||
}
|
||||
|
||||
|
@ -133,7 +137,7 @@
|
|||
+ String[] split = packet.hostName().split("\00");
|
||||
+ if (!handledByEvent && proxyLogicEnabled) { // Paper
|
||||
+ // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||||
+ if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) {
|
||||
+ if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper - Add bypass host check
|
||||
+ this.connection.hostname = split[0];
|
||||
+ this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
|
||||
+ this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );
|
||||
|
|
Loading…
Reference in a new issue