summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
authorDinnerbone <dinnerbone@dinnerbone.com>2011-03-08 20:48:47 +0000
committerDinnerbone <dinnerbone@dinnerbone.com>2011-03-08 20:48:47 +0000
commite0d8c1d7ac2db448a9e120e526d278a47c674217 (patch)
tree65f5ebaefdba944093ecaed7dfccc7aa414e081e /src/main/java/net
parente8e74992cbe4f9f2eea78c365019c357eca112e8 (diff)
downloadcraftbukkit-e0d8c1d7ac2db448a9e120e526d278a47c674217.tar
craftbukkit-e0d8c1d7ac2db448a9e120e526d278a47c674217.tar.gz
craftbukkit-e0d8c1d7ac2db448a9e120e526d278a47c674217.tar.lz
craftbukkit-e0d8c1d7ac2db448a9e120e526d278a47c674217.tar.xz
craftbukkit-e0d8c1d7ac2db448a9e120e526d278a47c674217.zip
Fixed a minecraft exploit allowing anyone to pick their username
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/ThreadLoginVerifier.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
new file mode 100644
index 00000000..6680e0fa
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
@@ -0,0 +1,37 @@
+package net.minecraft.server;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLEncoder;
+
+class ThreadLoginVerifier extends Thread {
+
+ final Packet1Login a;
+
+ final NetLoginHandler b;
+
+ ThreadLoginVerifier(NetLoginHandler netloginhandler, Packet1Login packet1login) {
+ this.b = netloginhandler;
+ this.a = packet1login;
+ }
+
+ public void run() {
+ try {
+ String s = NetLoginHandler.a(this.b);
+ // Craftbukkit
+ URL url = new URL("http://www.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(this.a.b, "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
+ BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream()));
+ String s1 = bufferedreader.readLine();
+
+ bufferedreader.close();
+ if (s1.equals("YES")) {
+ NetLoginHandler.a(this.b, this.a);
+ } else {
+ this.b.a("Failed to verify username!");
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+}