From: Brian P. Hinz Date: Mon, 4 Nov 2019 02:49:53 +0000 (-0500) Subject: Fix external SSH arguments dialog X-Git-Tag: v1.10.90~95 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ac61fd85b598284e512500699607871939ae3f34;p=tigervnc.git Fix external SSH arguments dialog --- diff --git a/java/com/tigervnc/vncviewer/OptionsDialog.java b/java/com/tigervnc/vncviewer/OptionsDialog.java index d02380cc..c2847a86 100644 --- a/java/com/tigervnc/vncviewer/OptionsDialog.java +++ b/java/com/tigervnc/vncviewer/OptionsDialog.java @@ -622,9 +622,12 @@ class OptionsDialog extends Dialog { extSSH.setParam(extSSHCheckbox.isSelected()); if (!sshClientInput.getText().isEmpty()) extSSHClient.setParam(sshClientInput.getText()); - if (sshArgsDefaultButton.isSelected()) - if (!sshArgsInput.getText().isEmpty()) + if (sshArgsCustomButton.isSelected() && + !sshArgsInput.getText().isEmpty()) { extSSHArgs.setParam(sshArgsInput.getText()); + } else { + extSSHArgs.setParam(new String()); + } if (!sshConfigInput.getText().isEmpty()) sshConfig.setParam(sshConfigInput.getText()); if (!sshKeyFileInput.getText().isEmpty()) diff --git a/java/com/tigervnc/vncviewer/Tunnel.java b/java/com/tigervnc/vncviewer/Tunnel.java index ecb048b7..9b8af136 100644 --- a/java/com/tigervnc/vncviewer/Tunnel.java +++ b/java/com/tigervnc/vncviewer/Tunnel.java @@ -56,17 +56,19 @@ public class Tunnel { String remoteHost, int remotePort, int localPort) throws Exception { - - String pattern = extSSHArgs.getValue(); - if (pattern == null || pattern.isEmpty()) { - if (tunnel.getValue() && via.getValue().isEmpty()) - pattern = System.getProperty("VNC_TUNNEL_CMD"); - else - pattern = System.getProperty("VNC_VIA_CMD"); - } - - if (extSSH.getValue() || - (pattern != null && pattern.length() > 0)) { + if (extSSH.getValue()) { + String pattern = extSSHArgs.getValueStr(); + if (pattern == null || pattern.isEmpty()) { + if (tunnel.getValue() && via.getValue().isEmpty()) { + pattern = System.getProperty("VNC_TUNNEL_CMD"); + if (pattern == null || pattern.isEmpty()) + pattern = DEFAULT_TUNNEL_TEMPLATE; + } else { + pattern = System.getProperty("VNC_VIA_CMD"); + if (pattern == null || pattern.isEmpty()) + pattern = DEFAULT_VIA_TEMPLATE; + } + } createTunnelExt(gatewayHost, remoteHost, remotePort, localPort, pattern); } else { createTunnelJSch(gatewayHost, remoteHost, remotePort, localPort); @@ -202,12 +204,6 @@ public class Tunnel { private static void createTunnelExt(String gatewayHost, String remoteHost, int remotePort, int localPort, String pattern) throws Exception { - if (pattern == null || pattern.length() < 1) { - if (tunnel.getValue() && via.getValue().isEmpty()) - pattern = DEFAULT_TUNNEL_TEMPLATE; - else - pattern = DEFAULT_VIA_TEMPLATE; - } String cmd = fillCmdPattern(pattern, gatewayHost, remoteHost, remotePort, localPort); try {