From 45354db0679f436a48d1c855564ece885e34f5f0 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 16 Jun 2023 15:05:26 +0200 Subject: Fix reading supported authentication schemes --- src/main/java/de/bwlehrpool/bwlp_guac/VncConnection.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/VncConnection.java b/src/main/java/de/bwlehrpool/bwlp_guac/VncConnection.java index d1ac1ad..5b252df 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/VncConnection.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/VncConnection.java @@ -54,8 +54,7 @@ public class VncConnection implements Closeable { boolean ok = false; for (int i = 0; i < numTypes; ++i) { if (in.read() == 2) { - ok = true; - break; // Found "VNC Authentication" + ok = true; // Found "VNC Authentication" } } if (!ok) { @@ -65,8 +64,9 @@ public class VncConnection implements Closeable { out.write(2); // Pick passwd auth // Get challenge data byte[] challenge = new byte[16]; - int ret = in.read(challenge); - if (ret != 16) { + try { + in.readFully(challenge); + } catch (Exception e) { LOGGER.info("Didn't receive challenge from VNC server @ " + sock.getRemoteSocketAddress()); return false; } -- cgit v1.2.3-55-g7522