summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2021-03-22 12:46:29 +0100
committerSimon Rettberg2021-03-22 12:46:29 +0100
commit8fd5bea336bf8d292d5e65c1f36c190d1ca95920 (patch)
tree893b40ac95271633e5f088b0a9060a6b0354104c
parentUpdate to Java 1.8 (diff)
downloadbwlp-guacamole-ext-8fd5bea336bf8d292d5e65c1f36c190d1ca95920.tar.gz
bwlp-guacamole-ext-8fd5bea336bf8d292d5e65c1f36c190d1ca95920.tar.xz
bwlp-guacamole-ext-8fd5bea336bf8d292d5e65c1f36c190d1ca95920.zip
Honor VNC port in jsonv1.3.1v1.2.1
-rw-r--r--src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java15
-rw-r--r--src/main/java/de/bwlehrpool/bwlp_guac/JsonClient.java2
2 files changed, 13 insertions, 4 deletions
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java b/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java
index 67df329..f0d0da8 100644
--- a/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java
+++ b/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java
@@ -24,6 +24,8 @@ public class AvailableClient implements Cloneable {
private static final AtomicLong CON_ID = new AtomicLong();
private final String clientip;
+
+ private int vncport;
private String password;
@@ -56,8 +58,9 @@ public class AvailableClient implements Cloneable {
update(source);
}
- private AvailableClient(String clientip) {
+ private AvailableClient(String clientip, int port) {
this.clientip = clientip;
+ this.vncport = port;
}
/**
@@ -94,6 +97,10 @@ public class AvailableClient implements Cloneable {
this.locationid = source.locationid;
this.deadline = 0;
+ this.vncport = source.vncport;
+ if (this.vncport <= 0 || this.vncport >= 65536) {
+ this.vncport = 5900;
+ }
}
/**
@@ -171,7 +178,7 @@ public class AvailableClient implements Cloneable {
GuacamoleConfiguration cfg = new GuacamoleConfiguration();
cfg.setProtocol("vnc");
cfg.setParameter("hostname", this.clientip);
- cfg.setParameter("port", Integer.toString(5900)); // TODO
+ cfg.setParameter("port", Integer.toString(this.vncport));
cfg.setParameter("password", password);
return cfg;
}
@@ -190,7 +197,7 @@ public class AvailableClient implements Cloneable {
return this.connectionOk;
for (;;) {
String version = null;
- try (VncConnection vnc = new VncConnection(this.clientip, 5900)) {
+ try (VncConnection vnc = new VncConnection(this.clientip, this.vncport)) {
version = vnc.handshake();
if (version == null) {
LOGGER.info("Host " + this.clientip + " doesn't speak RFB protocol");
@@ -256,7 +263,7 @@ public class AvailableClient implements Cloneable {
@Override
public AvailableClient clone() {
- AvailableClient c = new AvailableClient(this.clientip);
+ AvailableClient c = new AvailableClient(this.clientip, this.vncport);
c.state = this.state;
c.inUseBy = this.inUseBy;
c.password = this.password;
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/JsonClient.java b/src/main/java/de/bwlehrpool/bwlp_guac/JsonClient.java
index 09a80e4..6609622 100644
--- a/src/main/java/de/bwlehrpool/bwlp_guac/JsonClient.java
+++ b/src/main/java/de/bwlehrpool/bwlp_guac/JsonClient.java
@@ -4,6 +4,8 @@ public class JsonClient {
public String clientip;
+ public int vncport;
+
public String password;
public int locationid;