diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthResponse.java index bffafd67..3c30a6ae 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthResponse.java @@ -40,7 +40,10 @@ public AuthResponse(LaunchServer server, long session, HInput input, HOutput out @Override public void reply() throws Exception { String login = input.readString(SerializeLimits.MAX_LOGIN); - String client = input.readString(SerializeLimits.MAX_CLIENT); + boolean isClient = input.readBoolean(); + String client = null; + if(isClient) + client = input.readString(SerializeLimits.MAX_CLIENT); int auth_id = input.readInt(); long hwid_hdd = input.readLong(); long hwid_cpu = input.readLong(); @@ -73,17 +76,19 @@ public void reply() throws Exception { AuthProvider.authError(String.format("Illegal result: '%s'", result.username)); return; } - Collection> profiles = server.getProfiles(); - for (SignedObjectHolder p : profiles) { - if (p.object.getTitle().equals(client)) { - if (!p.object.isWhitelistContains(login)) { - throw new AuthException(server.config.whitelistRejectString); + if(isClient) { + Collection> profiles = server.getProfiles(); + for (SignedObjectHolder p : profiles) { + if (p.object.getTitle().equals(client)) { + if (!p.object.isWhitelistContains(login)) { + throw new AuthException(server.config.whitelistRejectString); + } + clientData.profile = p.object; } - clientData.profile = p.object; } - } - if(clientData.profile == null) { - throw new AuthException("You profile not found"); + if (clientData.profile == null) { + throw new AuthException("You profile not found"); + } } server.config.hwidHandler.check(HWID.gen(hwid_hdd, hwid_bios, hwid_cpu), result.username); } catch (AuthException | HWIDException e) { diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/texture/RequestTextureProvider.java b/LaunchServer/src/main/java/ru/gravit/launchserver/texture/RequestTextureProvider.java index 386a7149..face508f 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/texture/RequestTextureProvider.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/texture/RequestTextureProvider.java @@ -28,7 +28,7 @@ private static Texture getTexture(String url, boolean cloak) throws IOException private static String getTextureURL(String url, UUID uuid, String username, String client) { return CommonHelper.replace(url, "username", IOHelper.urlEncode(username), "uuid", IOHelper.urlEncode(uuid.toString()), "hash", IOHelper.urlEncode(Launcher.toHash(uuid)), - "client", IOHelper.urlEncode(client)); + "client", IOHelper.urlEncode(client == null ? "unknown" : client)); } // Instance diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/AuthRequest.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/AuthRequest.java index 339ea99c..0af81609 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/AuthRequest.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/AuthRequest.java @@ -67,7 +67,9 @@ public Integer getType() { @Override protected Result requestDo(HInput input, HOutput output) throws IOException { output.writeString(login, SerializeLimits.MAX_LOGIN); - output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT); + output.writeBoolean(Launcher.profile != null); + if(Launcher.profile != null) + output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT); output.writeInt(auth_id); output.writeLong(Launcher.isUsingAvanguard() ? GuardBind.avnGetHddId() : 0); output.writeLong(Launcher.isUsingAvanguard() ? GuardBind.avnGetCpuid() : 0);