Match method to detect a client token to the way a client token is generated.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 23 May 2009 16:35:45 +0000 (18:35 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 23 May 2009 16:35:45 +0000 (18:35 +0200)
src/net/pterodactylus/jsite/core/RequestManager.java

index 831c9b3..df4d1cc 100644 (file)
@@ -120,11 +120,17 @@ public class RequestManager implements NodeListener {
                if (projectIdString.length() != (IdGenerator.DEFAULT_LENGTH * 2)) {
                        return false;
                }
+               int clientTokenHashCode = -1;
                try {
                        Hex.toByte(projectIdString);
+                       Long.valueOf(clientTokenParts[1]);
+                       clientTokenHashCode = Integer.valueOf(clientTokenParts[2]);
                } catch (NumberFormatException nfe1) {
                        return false;
                }
+               if ((clientTokenParts[0] + "." + clientTokenParts[1]).hashCode() != clientTokenHashCode) {
+                       return false;
+               }
                return true;
        }