From: Brian Hinz Date: Wed, 23 May 2012 03:40:07 +0000 (+0000) Subject: Shortened SSH tunneling System property names, fixed problem with parsing of '-via... X-Git-Tag: v1.2.90~169 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fd9419bbbc69d09d794f39192ae85f75a6973815;p=tigervnc.git Shortened SSH tunneling System property names, fixed problem with parsing of '-via' cmd line option, fixed intermittent problem with SSH password dialog. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4916 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/java/com/tigervnc/vncviewer/VncViewer.java b/java/com/tigervnc/vncviewer/VncViewer.java index a15ee58e..cc743945 100644 --- a/java/com/tigervnc/vncviewer/VncViewer.java +++ b/java/com/tigervnc/vncviewer/VncViewer.java @@ -139,6 +139,7 @@ public class VncViewer extends java.applet.Applet implements Runnable if (argv[i].equalsIgnoreCase("-tunnel") || argv[i].equalsIgnoreCase("-via")) { if (!tunnel.createTunnel(argv.length, argv, i)) System.exit(1); + if (argv[i].equalsIgnoreCase("-via")) i++; continue; } @@ -203,10 +204,10 @@ public class VncViewer extends java.applet.Applet implements Runnable String propertiesString = ("\n"+ "\u001B[1mSystem Properties\u001B[0m (adapted from the TurboVNC vncviewer man page)\n"+ " When started with the -via option, vncviewer reads the\n"+ -" \u001B[1mcom.tigervnc.VNC_VIA_CMD\u001B[0m System property, expands\n"+ +" \u001B[1mVNC_VIA_CMD\u001B[0m System property, expands\n"+ " patterns beginning with the \"%\" character, and uses the resulting\n"+ " command line to establish the secure tunnel to the VNC gateway.\n"+ -" If \u001B[1mcom.tigervnc.VNC_VIA_CMD\u001B[0m is not set, this \n"+ +" If \u001B[1mVNC_VIA_CMD\u001B[0m is not set, this \n"+ " command line defaults to \"/usr/bin/ssh -f -L %L:%H:%R %G sleep 20\".\n"+ "\n"+ " The following patterns are recognized in the VNC_VIA_CMD property\n"+ @@ -224,10 +225,10 @@ public class VncViewer extends java.applet.Applet implements Runnable " \t%R remote TCP port number.\n"+ "\n"+ " When started with the -tunnel option, vncviewer reads the\n"+ -" \u001B[1mcom.tigervnc.VNC_TUNNEL_CMD\u001B[0m System property, expands\n"+ +" \u001B[1mVNC_TUNNEL_CMD\u001B[0m System property, expands\n"+ " patterns beginning with the \"%\" character, and uses the resulting\n"+ " command line to establish the secure tunnel to the VNC server.\n"+ -" If \u001B[1mcom.tigervnc.VNC_TUNNEL_CMD\u001B[0m is not set, this command \n"+ +" If \u001B[1mVNC_TUNNEL_CMD\u001B[0m is not set, this command \n"+ " line defaults to \"/usr/bin/ssh -f -L %L:localhost:%R %H sleep 20\".\n"+ "\n"+ " The following patterns are recognized in the VNC_TUNNEL_CMD property\n"+ diff --git a/java/com/tigervnc/vncviewer/tunnel.java b/java/com/tigervnc/vncviewer/tunnel.java index 2fc12a6b..23da0a99 100644 --- a/java/com/tigervnc/vncviewer/tunnel.java +++ b/java/com/tigervnc/vncviewer/tunnel.java @@ -194,9 +194,9 @@ public class tunnel try { if (tunnelOption) { - pattern = System.getProperty("com.tigervnc.VNC_TUNNEL_CMD"); + pattern = System.getProperty("VNC_TUNNEL_CMD"); } else { - pattern = System.getProperty("com.tigervnc.VNC_VIA_CMD"); + pattern = System.getProperty("VNC_VIA_CMD"); } } catch (java.lang.Exception e) { vlog.info(e.toString()); @@ -294,10 +294,10 @@ public class tunnel } // username and passphrase will be given via UserInfo interface. PasswdDialog dlg = new PasswdDialog(new String("SSH Authentication"), false, false); - dlg.userEntry.setText((String)System.getProperties().get("user.name")); + dlg.promptPassword(new String("SSH Authentication")); Session session=jsch.getSession(dlg.userEntry.getText(), tunnelEndpoint, 22); - session.setUserInfo(dlg); + session.setPassword(new String(dlg.passwdEntry.getPassword())); session.connect(); String[] tokens = cmd.split("\\s");