summaryrefslogtreecommitdiffstats
path: root/classes/ssl/tightvnc-1.3dev7_javasrc-vncviewer-ssl.patch
diff options
context:
space:
mode:
authorrunge <runge>2007-09-05 03:37:57 +0000
committerrunge <runge>2007-09-05 03:37:57 +0000
commite30552512933e6f0a07b83dd3246a97ff5281503 (patch)
tree722387685728374ce1b63b676520a105cbd75f55 /classes/ssl/tightvnc-1.3dev7_javasrc-vncviewer-ssl.patch
parent84d6dd0e92cf26b44ffea7dd8b52f54e2b8a304c (diff)
downloadlibtdevnc-e30552512933e6f0a07b83dd3246a97ff5281503.tar.gz
libtdevnc-e30552512933e6f0a07b83dd3246a97ff5281503.zip
classes/ssl: improve timeouts, port fallback, and connection time.
Diffstat (limited to 'classes/ssl/tightvnc-1.3dev7_javasrc-vncviewer-ssl.patch')
-rw-r--r--classes/ssl/tightvnc-1.3dev7_javasrc-vncviewer-ssl.patch94
1 files changed, 81 insertions, 13 deletions
diff --git a/classes/ssl/tightvnc-1.3dev7_javasrc-vncviewer-ssl.patch b/classes/ssl/tightvnc-1.3dev7_javasrc-vncviewer-ssl.patch
index 0ce4474..b67703f 100644
--- a/classes/ssl/tightvnc-1.3dev7_javasrc-vncviewer-ssl.patch
+++ b/classes/ssl/tightvnc-1.3dev7_javasrc-vncviewer-ssl.patch
@@ -73,8 +73,8 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/RfbProto.java vnc_javasrc/RfbProto
serverMajor = (b[4] - '0') * 100 + (b[5] - '0') * 10 + (b[6] - '0');
diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSLSocketToMe.java
--- vnc_javasrc.orig/SSLSocketToMe.java 1969-12-31 19:00:00.000000000 -0500
-+++ vnc_javasrc/SSLSocketToMe.java 2007-04-29 20:40:35.000000000 -0400
-@@ -0,0 +1,1421 @@
++++ vnc_javasrc/SSLSocketToMe.java 2007-09-04 23:13:00.000000000 -0400
+@@ -0,0 +1,1452 @@
+/*
+ * SSLSocketToMe.java: add SSL encryption to Java VNC Viewer.
+ *
@@ -587,7 +587,15 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSL
+ throw new Exception("forcing CONNECT");
+ }
+
-+ socket = (SSLSocket) factory.createSocket(host, port);
++ int timeout = 10;
++ if (timeout > 0) {
++ socket = (SSLSocket) factory.createSocket();
++ InetSocketAddress inetaddr = new InetSocketAddress(host, port);
++ dbg("Using timeout of " + timeout + " secs to: " + host + ":" + port);
++ socket.connect(inetaddr, timeout * 1000);
++ } else {
++ socket = (SSLSocket) factory.createSocket(host, port);
++ }
+
+ } catch (Exception esock) {
+ dbg("esock: " + esock.getMessage());
@@ -640,7 +648,9 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSL
+ user_wants_to_see_cert = false;
+ } else {
+ bcd = new BrowserCertsDialog(serv, host + ":" + port);
++ dbg("bcd START");
+ bcd.queryUser();
++ dbg("bcd DONE");
+ if (bcd.showCertDialog) {
+ String msg = "user wants to see cert";
+ dbg(msg);
@@ -745,8 +755,22 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSL
+ str += "\r\n";
+ System.out.println("sending GET: " + str);
+ OutputStream os = socket.getOutputStream();
-+ os.write(str.getBytes());
-+ os.flush();
++ String type = "os";
++ if (type == "os") {
++ os.write(str.getBytes());
++ os.flush();
++ System.out.println("used OutputStream");
++ } else if (type == "bs") {
++ BufferedOutputStream bs = new BufferedOutputStream(os);
++ bs.write(str.getBytes());
++ bs.flush();
++ System.out.println("used BufferedOutputStream");
++ } else if (type == "ds") {
++ DataOutputStream ds = new DataOutputStream(os);
++ ds.write(str.getBytes());
++ ds.flush();
++ System.out.println("used DataOutputStream");
++ }
+ if (false) {
+ String rep = "";
+ DataInputStream is = new DataInputStream(
@@ -1178,13 +1202,15 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSL
+ } else {
+ trust_this_session = false;
+ }
-+ dialog.dispose();
++ //dialog.dispose();
++ dialog.hide();
+
+ } else if (evt.getSource() == cancel) {
+ /* Cancel button clicked */
+ trust_this_session = false;
+
-+ dialog.dispose();
++ //dialog.dispose();
++ dialog.hide();
+ }
+ }
+
@@ -1316,7 +1342,8 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSL
+ System.out.println(evt.getActionCommand());
+ if (evt.getSource() == ok) {
+ reply = entry.getText();
-+ dialog.dispose();
++ //dialog.dispose();
++ dialog.hide();
+ }
+ }
+}
@@ -1361,7 +1388,8 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSL
+ System.out.println(evt.getActionCommand());
+ if (evt.getSource() == ok) {
+ reply = entry.getText();
-+ dialog.dispose();
++ //dialog.dispose();
++ dialog.hide();
+ }
+ }
+}
@@ -1426,7 +1454,9 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSL
+ dialog.pack();
+ dialog.resize(dialog.preferredSize());
+
++ System.out.println("calling show()");
+ dialog.show(); /* block here til Yes or No pressed. */
++ System.out.println("done show()");
+ return;
+ }
+
@@ -1434,11 +1464,12 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSL
+ System.out.println(evt.getActionCommand());
+ if (evt.getSource() == yes) {
+ showCertDialog = false;
-+ dialog.dispose();
+ } else if (evt.getSource() == no) {
+ showCertDialog = true;
-+ dialog.dispose();
+ }
++ //dialog.dispose();
++ dialog.hide();
++ System.out.println("done actionPerformed()");
+ }
+}
+
@@ -1498,7 +1529,16 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSL
+}
diff -x VncCanvas.java -Naur vnc_javasrc.orig/VncViewer.java vnc_javasrc/VncViewer.java
--- vnc_javasrc.orig/VncViewer.java 2004-03-04 08:34:25.000000000 -0500
-+++ vnc_javasrc/VncViewer.java 2007-03-31 23:35:26.000000000 -0400
++++ vnc_javasrc/VncViewer.java 2007-09-03 23:22:13.000000000 -0400
+@@ -80,7 +80,7 @@
+ // Variables read from parameter values.
+ String socketFactory;
+ String host;
+- int port;
++ int port, vncserverport;
+ boolean showControls;
+ boolean offerRelogin;
+ boolean showOfflineDesktop;
@@ -88,6 +88,17 @@
int deferCursorUpdates;
int deferUpdateRequests;
@@ -1517,7 +1557,35 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/VncViewer.java vnc_javasrc/VncView
// Reference to this applet for inter-applet communication.
public static java.applet.Applet refApplet;
-@@ -626,6 +637,68 @@
+@@ -591,8 +602,25 @@
+ }
+ }
+
+- String str = readParameter("PORT", true);
+- port = Integer.parseInt(str);
++ port = 0;
++ String str = readParameter("PORT", false);
++ if (str != null) {
++ port = Integer.parseInt(str);
++ }
++ // When there is a proxy VNCSERVERPORT may be inaccessible (inside firewall).
++ vncserverport = 0;
++ str = readParameter("VNCSERVERPORT", false);
++ if (str != null) {
++ vncserverport = Integer.parseInt(str);
++ }
++ if (port == 0 && vncserverport == 0) {
++ fatalError("Neither PORT nor VNCSERVERPORT parameters specified");
++ }
++ if (port == 0) {
++ // Nevertheless, fall back to vncserverport if we have to.
++ System.out.println("using vncserverport: '" + vncserverport + "' for PORT.");
++ port = vncserverport;
++ }
+
+ if (inAnApplet) {
+ str = readParameter("Open New Window", false);
+@@ -626,6 +654,68 @@
// SocketFactory.
socketFactory = readParameter("SocketFactory", false);