summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2023-06-16 15:05:26 +0200
committerSimon Rettberg2023-06-16 15:05:26 +0200
commit45354db0679f436a48d1c855564ece885e34f5f0 (patch)
tree1667ec663ca844baa3fcb48a3c42daa663bf9912
parentRefactor meta data merging (diff)
downloadbwlp-guacamole-ext-45354db0679f436a48d1c855564ece885e34f5f0.tar.gz
bwlp-guacamole-ext-45354db0679f436a48d1c855564ece885e34f5f0.tar.xz
bwlp-guacamole-ext-45354db0679f436a48d1c855564ece885e34f5f0.zip
Fix reading supported authentication schemes
-rw-r--r--src/main/java/de/bwlehrpool/bwlp_guac/VncConnection.java8
1 files 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;
}