]> source.dussan.org Git - tigervnc.git/commitdiff
Fix external SSH arguments dialog
authorBrian P. Hinz <bphinz@users.sf.net>
Mon, 4 Nov 2019 02:49:53 +0000 (21:49 -0500)
committerBrian P. Hinz <bphinz@users.sf.net>
Mon, 4 Nov 2019 02:51:02 +0000 (21:51 -0500)
java/com/tigervnc/vncviewer/OptionsDialog.java
java/com/tigervnc/vncviewer/Tunnel.java

index d02380cc8abab796fd5f35e8a9b7d66f8a4d8859..c2847a86030c637f34cdd532334195d30d96ecaf 100644 (file)
@@ -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())
index ecb048b712a85bef3521aa698d15996f31d0b8b0..9b8af13681a025cd3d59fd326c6c893fc233a977 100644 (file)
@@ -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 {