Skip to content

Commit

Permalink
Use UUIDs for host key checks
Browse files Browse the repository at this point in the history
  • Loading branch information
slide23 committed Jan 20, 2015
1 parent 5ad6864 commit 1c17d46
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
70 changes: 35 additions & 35 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>nu.nerd</groupId>
<artifactId>KitchenSink</artifactId>
Expand Down Expand Up @@ -34,7 +34,7 @@
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version>
<type>jar</type>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
Expand Down Expand Up @@ -104,7 +104,7 @@
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
<finalName>KitchenSink</finalName>
<finalName>KitchenSink-${project.version}</finalName>
</configuration>
</plugin>
<plugin>
Expand All @@ -119,38 +119,38 @@
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<configuration>
<minimizeJar>true</minimizeJar>
<relocations>
<relocation>
<pattern>com.google.gson</pattern>
<shadedPattern>nu.nerd.kitchensink.libs.com.google.gson</shadedPattern>
</relocation>
</relocations>
<excludes>
</excludes>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<shadedClassifierName>Bundle</shadedClassifierName>
<artifactSet>
<includes>
<include>com.google.code.gson:gson:jar:*</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<configuration>
<minimizeJar>true</minimizeJar>
<relocations>
<relocation>
<pattern>com.google.gson</pattern>
<shadedPattern>nu.nerd.kitchensink.libs.com.google.gson</shadedPattern>
</relocation>
</relocations>
<excludes>
</excludes>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<shadedClassifierName>Bundle</shadedClassifierName>
<artifactSet>
<includes>
<include>com.google.code.gson:gson:jar:*</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
4 changes: 2 additions & 2 deletions src/nu/nerd/kitchensink/KitchenSink.java
Original file line number Diff line number Diff line change
Expand Up @@ -1012,9 +1012,9 @@ public void sendList(CommandSender sender) {
* name that the player must connect with, or the empty string if there are
* no restrictions.
*/
public String getHostKey(String playerName) {
public String getHostKey(Player player) {
File hostKeysDir = new File(getDataFolder(), HOST_KEYS_DIRECTORY);
File hostKeyFile = new File(hostKeysDir, playerName);
File hostKeyFile = new File(hostKeysDir, player.getUniqueId().toString());
try {
BufferedReader reader = null;
try {
Expand Down
2 changes: 1 addition & 1 deletion src/nu/nerd/kitchensink/KitchenSinkListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void onPlayerLogin(PlayerLoginEvent event) {
hostPrefix = hostPrefix.substring(0, colonIndex);
}

String hostKey = plugin.getHostKey(player.getName());
String hostKey = plugin.getHostKey(player);
if (!hostPrefix.equals(hostKey)) {
// The host key check failed.
// Do not leak host key details into the server log.
Expand Down

0 comments on commit 1c17d46

Please sign in to comment.