mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 02:25:28 +01:00
Updated Upstream (Spigot) (#5550)
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Spigot Changes: 4225eac0 SPIGOT-6423: Improve IP forwarding
This commit is contained in:
parent
fdf2a59d59
commit
91ef740292
@ -1220,7 +1220,7 @@ index e818bf022b74cae34a512d8c98b47ec3e5c74b9a..bb309790dc90aedabb3c48ea21cd87d1
|
||||
// CraftBukkit end
|
||||
this.bY = packetplayinsettings.d();
|
||||
diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
index 49f6b20ceee1b58e66e72d161d20226fa17850fd..c4e3dd34c20c97ae1397cf51125f51a5b77d9437 100644
|
||||
index 16275208954bfc008115aa169c5bfc149f6a4eeb..49a0aefc7f9544b36175fdf3161b255e878952a6 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
@@ -37,6 +37,7 @@ import org.apache.logging.log4j.Logger;
|
||||
@ -1231,7 +1231,7 @@ index 49f6b20ceee1b58e66e72d161d20226fa17850fd..c4e3dd34c20c97ae1397cf51125f51a5
|
||||
import org.bukkit.craftbukkit.util.Waitable;
|
||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
import org.bukkit.event.player.PlayerPreLoginEvent;
|
||||
@@ -300,7 +301,7 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -301,7 +302,7 @@ public class LoginListener implements PacketLoginInListener {
|
||||
if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
|
||||
final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);
|
||||
if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
|
||||
@ -1240,7 +1240,7 @@ index 49f6b20ceee1b58e66e72d161d20226fa17850fd..c4e3dd34c20c97ae1397cf51125f51a5
|
||||
}
|
||||
Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>() {
|
||||
@Override
|
||||
@@ -311,12 +312,12 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -312,12 +313,12 @@ public class LoginListener implements PacketLoginInListener {
|
||||
|
||||
LoginListener.this.server.processQueue.add(waitable);
|
||||
if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
index b1714750538a0107d9922812d08471921b755925..31011ec34e5eeae29705f6ec167fb2e832284873 100644
|
||||
index 9b24afa4f4fe41d2261b16aaecec2144ac7d049f..5047a742d2e6a9749aa7d37e761d023a3425944b 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
@@ -25,7 +25,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
@@ -29,7 +29,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
// CraftBukkit end
|
||||
private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request");
|
||||
private final MinecraftServer b;
|
||||
@ -18,7 +18,7 @@ index b1714750538a0107d9922812d08471921b755925..31011ec34e5eeae29705f6ec167fb2e8
|
||||
|
||||
public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
|
||||
this.b = minecraftserver;
|
||||
@@ -84,8 +84,34 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
@@ -88,8 +88,34 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
this.c.close(chatmessage);
|
||||
} else {
|
||||
this.c.setPacketListener(new LoginListener(this.b, this.c));
|
||||
@ -52,5 +52,5 @@ index b1714750538a0107d9922812d08471921b755925..31011ec34e5eeae29705f6ec167fb2e8
|
||||
- if (org.spigotmc.SpigotConfig.bungee) {
|
||||
+ //if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||||
String[] split = packethandshakinginsetprotocol.hostname.split("\00");
|
||||
if ( split.length == 3 || split.length == 4 ) {
|
||||
if ( ( split.length == 3 || split.length == 4 ) && ( HOST_PATTERN.matcher( split[1] ).matches() ) ) {
|
||||
packethandshakinginsetprotocol.hostname = split[0];
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Optimise removeQueue
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
index c4e3dd34c20c97ae1397cf51125f51a5b77d9437..9f87503c58f64bbfa829faa58600d7d9e64aecf1 100644
|
||||
index 49a0aefc7f9544b36175fdf3161b255e878952a6..c45647f2d05ed6b170aad10c0a3fb94570d2dd90 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
@@ -116,6 +116,12 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@ -21,7 +21,7 @@ index c4e3dd34c20c97ae1397cf51125f51a5b77d9437..9f87503c58f64bbfa829faa58600d7d9
|
||||
// Spigot start
|
||||
public void initUUID()
|
||||
{
|
||||
@@ -194,8 +200,8 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -195,8 +201,8 @@ public class LoginListener implements PacketLoginInListener {
|
||||
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic().getEncoded(), this.e));
|
||||
} else {
|
||||
// Spigot start
|
||||
@ -32,7 +32,7 @@ index c4e3dd34c20c97ae1397cf51125f51a5b77d9437..9f87503c58f64bbfa829faa58600d7d9
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -206,7 +212,8 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -207,7 +213,8 @@ public class LoginListener implements PacketLoginInListener {
|
||||
server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex);
|
||||
}
|
||||
}
|
||||
@ -42,7 +42,7 @@ index c4e3dd34c20c97ae1397cf51125f51a5b77d9437..9f87503c58f64bbfa829faa58600d7d9
|
||||
// Spigot end
|
||||
}
|
||||
|
||||
@@ -235,7 +242,8 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -236,7 +243,8 @@ public class LoginListener implements PacketLoginInListener {
|
||||
throw new IllegalStateException("Protocol error", cryptographyexception);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ index c4e3dd34c20c97ae1397cf51125f51a5b77d9437..9f87503c58f64bbfa829faa58600d7d9
|
||||
public void run() {
|
||||
GameProfile gameprofile = LoginListener.this.i;
|
||||
|
||||
@@ -280,10 +288,8 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -281,10 +289,8 @@ public class LoginListener implements PacketLoginInListener {
|
||||
|
||||
return LoginListener.this.server.W() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null;
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ index 48319aaf1c525c6fb7bdee5c2f570a0d056d4eae..52954fc3bf932cfc9d5ce63e3d3cace3
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
index 651b84b3bba316407a217c941be4c20074c5bb90..5b96c69014dbfb8eb3e2ecf370ad69f2ffc31453 100644
|
||||
index 401833b7aeb9955fad2a3f1fe51d195cf0131094..9e175747e110e32be80498ed27a71d21e8c01c5e 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
@@ -276,6 +276,10 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -277,6 +277,10 @@ public class LoginListener implements PacketLoginInListener {
|
||||
LoginListener.this.i = LoginListener.this.a(gameprofile);
|
||||
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
} else {
|
||||
|
@ -88,10 +88,10 @@ index b290ddfbc19aed3e44169281c3dae5429dac0062..14c002376540d2039fc2fe2ef746e534
|
||||
return this.a;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
index 31011ec34e5eeae29705f6ec167fb2e832284873..965dd2a4a446ca31597b9e91bd405e4f01ad8348 100644
|
||||
index 5047a742d2e6a9749aa7d37e761d023a3425944b..24486bc7290ec6ef1e00a94e289ca35b804ab172 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
@@ -145,6 +145,10 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
@@ -149,6 +149,10 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.b());
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent
|
||||
This will allow you to change the players name or skin on login.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
index 714f44a668eb35b3c61bb9ab140f884917efd6f5..a903a073e6f5e8ae6ea383b786d930af69a966c5 100644
|
||||
index f95f5a8b30f42c8f5b6cee3ef6adb1f4e09832dc..31d404c5343c33b9b64724c5ac40d0c52ad5af66 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
@@ -1,5 +1,7 @@
|
||||
@ -25,7 +25,7 @@ index 714f44a668eb35b3c61bb9ab140f884917efd6f5..a903a073e6f5e8ae6ea383b786d930af
|
||||
import org.bukkit.craftbukkit.util.Waitable;
|
||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
import org.bukkit.event.player.PlayerPreLoginEvent;
|
||||
@@ -315,8 +318,16 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -316,8 +319,16 @@ public class LoginListener implements PacketLoginInListener {
|
||||
java.util.UUID uniqueId = i.getId();
|
||||
final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server;
|
||||
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Player.setPlayerProfile API
|
||||
This can be useful for changing name or skins after a player has logged in.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
index a903a073e6f5e8ae6ea383b786d930af69a966c5..2ce081e68fe27381d3e7f851b685cc547de35eb7 100644
|
||||
index 31d404c5343c33b9b64724c5ac40d0c52ad5af66..21e70a133278d85ecd65fec36a273ed4faabf6cc 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
@@ -56,7 +56,7 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@ -18,7 +18,7 @@ index a903a073e6f5e8ae6ea383b786d930af69a966c5..2ce081e68fe27381d3e7f851b685cc54
|
||||
private final String j;
|
||||
private SecretKey loginKey;
|
||||
private EntityPlayer l;
|
||||
@@ -319,12 +319,12 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -320,12 +320,12 @@ public class LoginListener implements PacketLoginInListener {
|
||||
final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server;
|
||||
|
||||
// Paper start
|
||||
|
@ -21,10 +21,10 @@ index 62621562137cba4804f0465c58d25ca2786328e5..7178b37f7978c7e9031a22726005c509
|
||||
Object val = config.get("settings.save-player-data");
|
||||
if (val instanceof Boolean) {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
index 965dd2a4a446ca31597b9e91bd405e4f01ad8348..6d001843d8f899e91f19c384ddf57e6987bfb79e 100644
|
||||
index 24486bc7290ec6ef1e00a94e289ca35b804ab172..3d5381a6737876d3d7de40cacef900ab7ad27e27 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
@@ -46,7 +46,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
@@ -50,7 +50,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
synchronized (throttleTracker) {
|
||||
if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
|
||||
throttleTracker.put(address, currentTime);
|
||||
|
@ -189,7 +189,7 @@ index eb970c1e954cb0aa83aa12e83c471778809e69b2..2d8c917509f10a96fc82404908b452cb
|
||||
public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
this.a = packetdataserializer.i();
|
||||
diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
index 2ce081e68fe27381d3e7f851b685cc547de35eb7..a3c989ef850919fa90590b942f037c1f6d519608 100644
|
||||
index 21e70a133278d85ecd65fec36a273ed4faabf6cc..36f747af18347197bab7c335d5d7dfc01a5aff80 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
@@ -18,12 +18,14 @@ import javax.crypto.Cipher;
|
||||
@ -223,7 +223,7 @@ index 2ce081e68fe27381d3e7f851b685cc547de35eb7..a3c989ef850919fa90590b942f037c1f
|
||||
|
||||
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
|
||||
this.g = LoginListener.EnumProtocolState.HELLO;
|
||||
@@ -212,6 +216,14 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -213,6 +217,14 @@ public class LoginListener implements PacketLoginInListener {
|
||||
this.g = LoginListener.EnumProtocolState.KEY;
|
||||
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic().getEncoded(), this.e));
|
||||
} else {
|
||||
@ -238,7 +238,7 @@ index 2ce081e68fe27381d3e7f851b685cc547de35eb7..a3c989ef850919fa90590b942f037c1f
|
||||
// Spigot start
|
||||
// Paper start - Cache authenticator threads
|
||||
authenticatorPool.execute(new Runnable() {
|
||||
@@ -313,6 +325,12 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -314,6 +326,12 @@ public class LoginListener implements PacketLoginInListener {
|
||||
public class LoginHandler {
|
||||
|
||||
public void fireEvents() throws Exception {
|
||||
@ -251,7 +251,7 @@ index 2ce081e68fe27381d3e7f851b685cc547de35eb7..a3c989ef850919fa90590b942f037c1f
|
||||
String playerName = i.getName();
|
||||
java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress();
|
||||
java.util.UUID uniqueId = i.getId();
|
||||
@@ -360,6 +378,35 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -361,6 +379,35 @@ public class LoginListener implements PacketLoginInListener {
|
||||
// Spigot end
|
||||
|
||||
public void a(PacketLoginInCustomPayload packetloginincustompayload) {
|
||||
|
@ -18,7 +18,7 @@ index 6e5d21af43261dc2f12ceec7b7e3269be635cf7a..ecf4cd6dfea777ab9daea0b40724d247
|
||||
boolean flag1 = this.playerChunkMap.b();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
index eaeac60b2d54d8e7d298ea412d888471a7ea9e79..36b4792687a5c6316bf95995e761bf4aa49779f6 100644
|
||||
index abd2554b6e98c25b59b9989936af8b0624e255a3..56a4de74d665b5dba97340bb6d9d35ec112c11f9 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -31,6 +31,7 @@ import net.minecraft.core.NonNullList;
|
||||
@ -71,7 +71,7 @@ index 218dc900e125a11548485887b1918742072c7a77..2c932d36f982e7f8713aabff9a6c6310
|
||||
public static final TicketType<ChunkCoordIntPair> UNKNOWN = a("unknown", Comparator.comparingLong(ChunkCoordIntPair::pair), 1);
|
||||
public static final TicketType<Unit> PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit
|
||||
diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
index 4dd2f7fb32b8618d752e0988acadcb41223c0e4c..78a8eb89e9113a1002ba6177f96d5734a10e8d7d 100644
|
||||
index 09ceac61f873ee0cb689c66a403c42677961011d..06e2b48ed6d6d52d0eb17301254ed07fb69cb8af 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
@@ -88,7 +88,7 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@ -83,7 +83,7 @@ index 4dd2f7fb32b8618d752e0988acadcb41223c0e4c..78a8eb89e9113a1002ba6177f96d5734
|
||||
|
||||
if (entityplayer == null) {
|
||||
this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
@@ -187,7 +187,7 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -188,7 +188,7 @@ public class LoginListener implements PacketLoginInListener {
|
||||
}
|
||||
|
||||
this.networkManager.sendPacket(new PacketLoginOutSuccess(this.i));
|
||||
|
@ -57,10 +57,10 @@ index ab70eeaeca222de7de7cab1b3db14b2c4761c3c3..878f879f8d410c428ad8a4c49e0c86c5
|
||||
|
||||
if (this.packetListener instanceof PlayerConnection) {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
index 78a8eb89e9113a1002ba6177f96d5734a10e8d7d..39aa50a386d0ab94914cd8f85c69cf404e0dc4b2 100644
|
||||
index 06e2b48ed6d6d52d0eb17301254ed07fb69cb8af..e9fc38f69af815f021a08a94dd41b91171dbf2d6 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
@@ -416,7 +416,7 @@ public class LoginListener implements PacketLoginInListener {
|
||||
@@ -417,7 +417,7 @@ public class LoginListener implements PacketLoginInListener {
|
||||
return new GameProfile(uuid, gameprofile.getName());
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix hex colors not working in some kick messages
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
index 6d001843d8f899e91f19c384ddf57e6987bfb79e..b97d289afdff81d9959e238639f4e3e186f8e9c8 100644
|
||||
index 3d5381a6737876d3d7de40cacef900ab7ad27e27..97c7914e9826defc3e7167879e387fe697c10f3e 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
@@ -46,7 +46,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
@@ -50,7 +50,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
synchronized (throttleTracker) {
|
||||
if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
|
||||
throttleTracker.put(address, currentTime);
|
||||
@ -17,7 +17,7 @@ index 6d001843d8f899e91f19c384ddf57e6987bfb79e..b97d289afdff81d9959e238639f4e3e1
|
||||
this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
||||
this.c.close(chatmessage);
|
||||
return;
|
||||
@@ -72,12 +72,12 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
@@ -76,12 +76,12 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (packethandshakinginsetprotocol.c() != SharedConstants.getGameVersion().getProtocolVersion()) {
|
||||
@ -33,7 +33,7 @@ index 6d001843d8f899e91f19c384ddf57e6987bfb79e..b97d289afdff81d9959e238639f4e3e1
|
||||
}
|
||||
|
||||
this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
||||
@@ -94,7 +94,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
@@ -98,7 +98,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
if (event.callEvent()) {
|
||||
// If we've failed somehow, let the client know so and go no further.
|
||||
if (event.isFailed()) {
|
||||
@ -43,7 +43,7 @@ index 6d001843d8f899e91f19c384ddf57e6987bfb79e..b97d289afdff81d9959e238639f4e3e1
|
||||
this.getNetworkManager().close(chatmessage);
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
index 39aa50a386d0ab94914cd8f85c69cf404e0dc4b2..185667110cd6f566b23546728d20fc79223f3c92 100644
|
||||
index e9fc38f69af815f021a08a94dd41b91171dbf2d6..c67b94840e4c967baebf6eb351df15f0e4ead4be 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
@@ -106,14 +106,7 @@ public class LoginListener implements PacketLoginInListener {
|
||||
|
30
Spigot-Server-Patches/0703-Add-bypass-host-check.patch
Normal file
30
Spigot-Server-Patches/0703-Add-bypass-host-check.patch
Normal file
@ -0,0 +1,30 @@
|
||||
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/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
index 97c7914e9826defc3e7167879e387fe697c10f3e..c30270ab3e822977a87240bbb98289e1d03d3748 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
@@ -30,6 +30,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request");
|
||||
private final MinecraftServer b;
|
||||
private final NetworkManager c; final NetworkManager getNetworkManager() { return this.c; } // Paper - OBFHELPER
|
||||
+ private static final boolean BYPASS_HOSTCHECK = Boolean.getBoolean("Paper.bypassHostCheck"); // Paper
|
||||
|
||||
public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
|
||||
this.b = minecraftserver;
|
||||
@@ -117,7 +118,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
// Spigot Start
|
||||
//if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||||
String[] split = packethandshakinginsetprotocol.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
|
||||
packethandshakinginsetprotocol.hostname = split[0];
|
||||
c.socketAddress = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) c.getSocketAddress()).getPort());
|
||||
c.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] );
|
@ -1,55 +0,0 @@
|
||||
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] Validate bungee forwarded hostname
|
||||
|
||||
Seriously, fix your firewalls. -.-
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
index b97d289afdff81d9959e238639f4e3e186f8e9c8..423696df365ceb20b673a87714b753d7b3b7a3af 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
@@ -1,5 +1,8 @@
|
||||
package net.minecraft.server.network;
|
||||
|
||||
+import com.google.common.net.InetAddresses;
|
||||
+import com.google.common.net.InternetDomainName;
|
||||
+
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.network.EnumProtocol;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
@@ -26,6 +29,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request");
|
||||
private final MinecraftServer b;
|
||||
private final NetworkManager c; final NetworkManager getNetworkManager() { return this.c; } // Paper - OBFHELPER
|
||||
+ private static final boolean BYPASS_HOSTCHECK = Boolean.getBoolean("Paper.bypassHostCheck"); // Paper
|
||||
|
||||
public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
|
||||
this.b = minecraftserver;
|
||||
@@ -114,6 +118,14 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
//if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||||
String[] split = packethandshakinginsetprotocol.hostname.split("\00");
|
||||
if ( split.length == 3 || split.length == 4 ) {
|
||||
+ // Paper start
|
||||
+ if (!BYPASS_HOSTCHECK && !validate(split[1])) {
|
||||
+ final ChatMessage message = new ChatMessage("Invalid hostname");
|
||||
+ this.getNetworkManager().sendPacket(new PacketLoginOutDisconnect(message));
|
||||
+ this.getNetworkManager().close(message);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
packethandshakinginsetprotocol.hostname = split[0];
|
||||
c.socketAddress = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) c.getSocketAddress()).getPort());
|
||||
c.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] );
|
||||
@@ -158,4 +170,11 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
public NetworkManager a() {
|
||||
return this.c;
|
||||
}
|
||||
+
|
||||
+ // Paper start - https://stackoverflow.com/questions/9954140/check-if-a-string-is-a-hostname-or-an-ip-address-in-java
|
||||
+ public static boolean validate(final String hostname) {
|
||||
+ //noinspection UnstableApiUsage
|
||||
+ return InetAddresses.isUriInetAddress(hostname);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
@ -1 +1 @@
|
||||
Subproject commit a25e8ed26cbca903b4d6ee3823d1b9f4f5d06cc3
|
||||
Subproject commit 4225eac084af31c8b9dca9eed3f7d146f3bc3625
|
Loading…
Reference in New Issue
Block a user