From 2711b995e79349793b463a7726c84ebf2c305898 Mon Sep 17 00:00:00 2001 From: "Brian P. Hinz" Date: Sat, 6 May 2017 14:35:38 -0400 Subject: [PATCH] Fix for issue #455 --- java/com/tigervnc/vncviewer/OptionsDialog.java | 2 ++ java/com/tigervnc/vncviewer/Tunnel.java | 13 ++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) 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': -- 2.39.5