From: Brian P. Hinz Date: Sat, 6 May 2017 18:35:38 +0000 (-0400) Subject: Fix for issue #455 X-Git-Tag: v1.8.90~153 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e9ed16b3836049404df4d7aca761a9bf4e22fec8;p=tigervnc.git Fix for issue #455 --- diff --git a/java/com/tigervnc/vncviewer/OptionsDialog.java b/java/com/tigervnc/vncviewer/OptionsDialog.java index a7c87784..186c1fca 100644 --- a/java/com/tigervnc/vncviewer/OptionsDialog.java +++ b/java/com/tigervnc/vncviewer/OptionsDialog.java @@ -616,6 +616,8 @@ class OptionsDialog extends Dialog { String sshPort = viaPortInput.getText(); String viaStr = sshUser.concat("@").concat(sshHost).concat(":").concat(sshPort); via.setParam(viaStr); + } else { + via.setParam(""); } extSSH.setParam(extSSHCheckbox.isSelected()); if (!sshClientInput.getText().isEmpty()) diff --git a/java/com/tigervnc/vncviewer/Tunnel.java b/java/com/tigervnc/vncviewer/Tunnel.java index 8d083f8e..2e19160a 100644 --- a/java/com/tigervnc/vncviewer/Tunnel.java +++ b/java/com/tigervnc/vncviewer/Tunnel.java @@ -58,17 +58,16 @@ public class Tunnel { String remoteHost; remotePort = cc.getServerPort(); - if (tunnel.getValue() && via.getValue().isEmpty()) { - gatewayHost = cc.getServerName(); - remoteHost = "localhost"; - } else { + gatewayHost = cc.getServerName(); + remoteHost = "localhost"; + if (!via.getValue().isEmpty()) { gatewayHost = getSshHost(); remoteHost = cc.getServerName(); } String pattern = extSSHArgs.getValue(); if (pattern == null || pattern.isEmpty()) { - if (tunnel.getValue()) + if (tunnel.getValue() && via.getValue().isEmpty()) pattern = System.getProperty("VNC_TUNNEL_CMD"); else pattern = System.getProperty("VNC_VIA_CMD"); @@ -207,7 +206,7 @@ public class Tunnel { int remotePort, int localPort, String pattern) throws Exception { if (pattern == null || pattern.length() < 1) { - if (tunnel.getValue()) + if (tunnel.getValue() && via.getValue().isEmpty()) pattern = DEFAULT_TUNNEL_TEMPLATE; else pattern = DEFAULT_VIA_TEMPLATE; @@ -240,7 +239,7 @@ public class Tunnel { if (pattern.charAt(i) == '%') { switch (pattern.charAt(++i)) { case 'H': - cmd += (tunnel.getValue() ? gatewayHost : remoteHost); + cmd += remoteHost; H_found = true; continue; case 'G':