From 7e32921c65fac9c6626038c1e5c52ffd8d5665a0 Mon Sep 17 00:00:00 2001 From: "Brian P. Hinz" Date: Sun, 3 Nov 2019 21:49:53 -0500 Subject: [PATCH] Fix external SSH arguments dialog --- .../com/tigervnc/vncviewer/OptionsDialog.java | 7 +++-- java/com/tigervnc/vncviewer/Tunnel.java | 30 ++++++++----------- 2 files changed, 18 insertions(+), 19 deletions(-) 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 { -- 2.39.5