Commit 5c53ccbb authored by runge's avatar runge

Improvements to Java viewer: troubleshooting settings and workarounds, misc bug fixes.

parent 91d0e2fd
This diff is collapsed.
......@@ -38,7 +38,7 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/Makefile vnc_javasrc/Makefile
@$(ExportJavaClasses)
diff -x VncCanvas.java -Naur vnc_javasrc.orig/RfbProto.java vnc_javasrc/RfbProto.java
--- vnc_javasrc.orig/RfbProto.java 2004-03-04 08:34:25.000000000 -0500
+++ vnc_javasrc/RfbProto.java 2006-04-16 11:17:37.000000000 -0400
+++ vnc_javasrc/RfbProto.java 2010-03-27 17:58:37.000000000 -0400
@@ -199,7 +199,21 @@
host = h;
port = p;
......@@ -71,9 +71,68 @@ 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');
@@ -992,6 +1006,19 @@
boolean down = (evt.getID() == KeyEvent.KEY_PRESSED);
int key;
+ if (viewer.debugKeyboard) {
+ System.out.println("----------------------------------------");
+ System.out.println("evt.getKeyChar: " + evt.getKeyChar());
+ System.out.println("getKeyText: " + KeyEvent.getKeyText(evt.getKeyCode()));
+ System.out.println("evt.getKeyCode: " + evt.getKeyCode());
+ System.out.println("evt.getID: " + evt.getID());
+ System.out.println("evt.getKeyLocation: " + evt.getKeyLocation());
+ System.out.println("evt.isActionKey: " + evt.isActionKey());
+ System.out.println("evt.isControlDown: " + evt.isControlDown());
+ System.out.println("evt.getModifiers: " + evt.getModifiers());
+ System.out.println("getKeyModifiersText: " + KeyEvent.getKeyModifiersText(evt.getModifiers()));
+ System.out.println("evt.paramString: " + evt.paramString());
+ }
if (evt.isActionKey()) {
//
@@ -1025,6 +1052,13 @@
return;
}
+ if(key == 0xffc2 && viewer.mapF5_to_atsign) {
+ if (viewer.debugKeyboard) {
+ System.out.println("Mapping: F5 -> AT ");
+ }
+ key = 0x40;
+ }
+
} else {
//
@@ -1036,6 +1070,7 @@
key = keyChar;
+
if (key < 0x20) {
if (evt.isControlDown()) {
key += 0x60;
@@ -1121,6 +1156,16 @@
int oldModifiers = 0;
void writeModifierKeyEvents(int newModifiers) {
+ if(viewer.forbid_Ctrl_Alt) {
+ if ((newModifiers & CTRL_MASK) != 0 && (newModifiers & ALT_MASK) != 0) {
+ int orig = newModifiers;
+ newModifiers &= ~ALT_MASK;
+ newModifiers &= ~CTRL_MASK;
+ if (viewer.debugKeyboard) {
+ System.out.println("Ctrl+Alt modifiers: " + orig + " -> " + newModifiers);
+ }
+ }
+ }
if ((newModifiers & CTRL_MASK) != (oldModifiers & CTRL_MASK))
writeKeyEvent(0xffe3, (newModifiers & CTRL_MASK) != 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 2010-03-19 12:52:08.000000000 -0400
+++ vnc_javasrc/SSLSocketToMe.java 2010-03-21 12:53:24.000000000 -0400
@@ -0,0 +1,2055 @@
+/*
+ * SSLSocketToMe.java: add SSL encryption to Java VNC Viewer.
......@@ -1028,7 +1087,7 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSL
+ str += "Pragma: No-Cache\r\n";
+ str += "\r\n";
+
+ System.out.println("sending GET: " + str);
+ System.out.println("sending: " + str);
+ OutputStream os = socket.getOutputStream();
+ String type = "os";
+
......@@ -2132,7 +2191,7 @@ 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 2010-03-20 19:49:14.000000000 -0400
+++ vnc_javasrc/VncViewer.java 2010-03-27 17:57:04.000000000 -0400
@@ -29,6 +29,7 @@
import java.awt.event.*;
import java.io.*;
......@@ -2150,7 +2209,7 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/VncViewer.java vnc_javasrc/VncView
boolean showControls;
boolean offerRelogin;
boolean showOfflineDesktop;
@@ -88,6 +89,21 @@
@@ -88,6 +89,24 @@
int deferCursorUpdates;
int deferUpdateRequests;
......@@ -2168,11 +2227,54 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/VncViewer.java vnc_javasrc/VncView
+ boolean trustAllVncCerts;
+ boolean trustUrlVncCert;
+ boolean debugCerts;
+ boolean debugKeyboard;
+ boolean mapF5_to_atsign;
+ boolean forbid_Ctrl_Alt;
+
// Reference to this applet for inter-applet communication.
public static java.applet.Applet refApplet;
@@ -590,9 +606,28 @@
@@ -282,10 +301,24 @@
validate();
}
- while (!tryAuthenticate()) {
- authenticator.retry();
- authenticatorUnixLogin.retry();
- }
+ if (false) {
+ /* a bug on retries: 'Error: bad position: 8' sun.awt.X11.XTextFieldPeer.setCaretPosition(XTextFieldPeer.java:215) */
+ while (!tryAuthenticate()) {
+ authenticator.retry();
+ authenticatorUnixLogin.retry();
+ }
+ } else {
+ /* just try once and not forever... */
+ if (!tryAuthenticate()) {
+ showConnectionStatus("Authentication Failed.");
+ showMessage("Authentication Failed.");
+ if (!offerRelogin) {
+ fatalError("auth failed.");
+ }
+ } else {
+ //showConnectionStatus("Authentication OK.");
+ }
+ }
}
@@ -428,7 +461,10 @@
gbc.ipadx = 100;
gbc.ipady = 50;
gridbag.setConstraints(authPanel, gbc);
+ try {
vncContainer.add(authPanel);
+ } catch (Exception e) {
+ }
if (inSeparateFrame) {
vncFrame.pack();
@@ -590,9 +626,28 @@
fatalError("HOST parameter not specified");
}
}
......@@ -2203,7 +2305,7 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/VncViewer.java vnc_javasrc/VncView
if (inAnApplet) {
str = readParameter("Open New Window", false);
@@ -626,6 +661,106 @@
@@ -626,6 +681,121 @@
// SocketFactory.
socketFactory = readParameter("SocketFactory", false);
......@@ -2306,6 +2408,21 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/VncViewer.java vnc_javasrc/VncView
+ str = readParameter("debugCerts", false);
+ if (str != null && str.equalsIgnoreCase("Yes")) {
+ debugCerts = true;
+ }
+ debugKeyboard = false;
+ str = readParameter("debugKeyboard", false);
+ if (str != null && str.equalsIgnoreCase("Yes")) {
+ debugKeyboard = true;
+ }
+ mapF5_to_atsign = false;
+ str = readParameter("mapF5_to_atsign", false);
+ if (str != null && str.equalsIgnoreCase("Yes")) {
+ mapF5_to_atsign = true;
+ }
+ forbid_Ctrl_Alt = false;
+ str = readParameter("forbid_Ctrl_Alt", false);
+ if (str != null && str.equalsIgnoreCase("Yes")) {
+ forbid_Ctrl_Alt = true;
+ }
}
......
......@@ -1665,7 +1665,7 @@ diff -Naur JavaViewer.orig/OptionsFrame.java JavaViewer/OptionsFrame.java
choices[shareDesktopIndex].select("Yes");
diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
--- JavaViewer.orig/RfbProto.java 2006-05-24 15:14:40.000000000 -0400
+++ JavaViewer/RfbProto.java 2008-10-06 13:32:30.000000000 -0400
+++ JavaViewer/RfbProto.java 2010-03-27 17:59:56.000000000 -0400
@@ -31,6 +31,7 @@
import java.net.Socket;
import java.util.*;
......@@ -1909,8 +1909,8 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
}
-
+ return maxc;
+ }
+
}
+ String guess_encoding(char[] chars) {
+ boolean saw_high_char = false;
+
......@@ -1964,8 +1964,8 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
+ } else {
+ return "ISO-8859-1";
+ }
}
+ }
+
+
//Internally used. Write an rfb message to the server for sending files ONLY
int writeRfbFileTransferMsgForSendFile(
......@@ -2642,9 +2642,58 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
os.write(b);
// }
@@ -1610,6 +1971,21 @@
boolean down = (evt.getID() == KeyEvent.KEY_PRESSED);
+ if (viewer.debugKeyboard) {
+ System.out.println("----------------------------------------");
+ System.out.println("evt.getKeyChar: " + evt.getKeyChar());
+ System.out.println("getKeyText: " + KeyEvent.getKeyText(evt.getKeyCode()));
+ System.out.println("evt.getKeyCode: " + evt.getKeyCode());
+ System.out.println("evt.getID: " + evt.getID());
+ System.out.println("evt.getKeyLocation: " + evt.getKeyLocation());
+ System.out.println("evt.isActionKey: " + evt.isActionKey());
+ System.out.println("evt.isControlDown: " + evt.isControlDown());
+ System.out.println("evt.getModifiers: " + evt.getModifiers());
+ System.out.println("getKeyModifiersText: " + KeyEvent.getKeyModifiersText(evt.getModifiers()));
+ System.out.println("evt.paramString: " + evt.paramString());
+ }
+
+
int key;
if (evt.isActionKey()) {
@@ -1685,6 +2061,9 @@
default :
return;
}
+ if (key == 0xffc2 && viewer.mapF5_to_atsign) {
+ key = 0x40;
+ }
} else {
@@ -1794,6 +2173,16 @@
int oldModifiers = 0;
void writeModifierKeyEvents(int newModifiers) {
+ if(viewer.forbid_Ctrl_Alt) {
+ if ((newModifiers & CTRL_MASK) != 0 && (newModifiers & ALT_MASK) != 0) {
+ int orig = newModifiers;
+ newModifiers &= ~ALT_MASK;
+ newModifiers &= ~CTRL_MASK;
+ if (viewer.debugKeyboard) {
+ System.out.println("Ctrl+Alt modifiers: " + orig + " -> " + newModifiers);
+ }
+ }
+ }
if ((newModifiers & CTRL_MASK) != (oldModifiers & CTRL_MASK))
writeKeyEvent(0xffe3, (newModifiers & CTRL_MASK) != 0);
diff -Naur JavaViewer.orig/SSLSocketToMe.java JavaViewer/SSLSocketToMe.java
--- JavaViewer.orig/SSLSocketToMe.java 1969-12-31 19:00:00.000000000 -0500
+++ JavaViewer/SSLSocketToMe.java 2010-03-19 12:52:08.000000000 -0400
+++ JavaViewer/SSLSocketToMe.java 2010-03-21 12:53:24.000000000 -0400
@@ -0,0 +1,2055 @@
+/*
+ * SSLSocketToMe.java: add SSL encryption to Java VNC Viewer.
......@@ -3599,7 +3648,7 @@ diff -Naur JavaViewer.orig/SSLSocketToMe.java JavaViewer/SSLSocketToMe.java
+ str += "Pragma: No-Cache\r\n";
+ str += "\r\n";
+
+ System.out.println("sending GET: " + str);
+ System.out.println("sending: " + str);
+ OutputStream os = socket.getOutputStream();
+ String type = "os";
+
......@@ -4826,7 +4875,7 @@ diff -Naur JavaViewer.orig/VncCanvas.java JavaViewer/VncCanvas.java
result = 0; // Transparent pixel
diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
--- JavaViewer.orig/VncViewer.java 2006-05-24 15:14:40.000000000 -0400
+++ JavaViewer/VncViewer.java 2010-03-20 19:50:16.000000000 -0400
+++ JavaViewer/VncViewer.java 2010-03-27 18:00:28.000000000 -0400
@@ -41,6 +41,7 @@
import java.io.*;
import java.net.*;
......@@ -4858,7 +4907,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
String passwordParam;
String encPasswordParam;
boolean showControls;
@@ -115,28 +116,72 @@
@@ -115,28 +116,75 @@
int i;
// mslogon support 2 end
......@@ -4878,6 +4927,9 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
+boolean trustAllVncCerts;
+boolean trustUrlVncCert;
+boolean debugCerts;
+boolean debugKeyboard;
+boolean mapF5_to_atsign;
+boolean forbid_Ctrl_Alt;
+
+boolean ignoreMSLogonCheck;
+boolean delayAuthPanel;
......@@ -4937,7 +4989,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
// authenticator = new AuthPanel(false); // mslogon support : go to connectAndAuthenticate()
if (RecordingFrame.checkSecurity())
rec = new RecordingFrame(this);
@@ -147,10 +192,11 @@
@@ -147,10 +195,11 @@
cursorUpdatesDef = null;
eightBitColorsDef = null;
......@@ -4951,7 +5003,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
rfbThread = new Thread(this);
rfbThread.start();
}
@@ -186,6 +232,30 @@
@@ -186,6 +235,30 @@
gbc.weightx = 1.0;
gbc.weighty = 1.0;
......@@ -4982,7 +5034,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
// Add ScrollPanel to applet mode
// Create a panel which itself is resizeable and can hold
@@ -286,6 +356,24 @@
@@ -286,6 +359,24 @@
void connectAndAuthenticate() throws Exception {
......@@ -5007,7 +5059,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
// If "ENCPASSWORD" parameter is set, decrypt the password into
// the passwordParam string.
@@ -336,7 +424,22 @@
@@ -336,7 +427,22 @@
//
......@@ -5031,18 +5083,29 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
authenticator = new AuthPanel(mslogon);
@@ -390,6 +493,10 @@
@@ -371,6 +477,7 @@
//mslogon support end
}
+ int tries = 0;
while (true) {
// Wait for user entering a password, or a username and a password
synchronized(authenticator) {
@@ -390,6 +497,13 @@
break;
//mslogon support end
+// begin runge/x11vnc
+ gotAuth = false;
+ gotAuth = false;
+ if (++tries > 2) {
+ throw new Exception("Incorrect password entered " + tries + " times.");
+ }
+// end runge/x11vnc
+
// Retry on authentication failure.
authenticator.retry();
}
@@ -405,9 +512,11 @@
@@ -405,9 +519,11 @@
void prologueDetectAuthProtocol() throws Exception {
......@@ -5056,7 +5119,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
System.out.println("RFB server supports protocol version " +
rfb.serverMajor + "." + rfb.serverMinor);
@@ -431,16 +540,36 @@
@@ -431,16 +547,36 @@
boolean tryAuthenticate(String us, String pw) throws Exception {
......@@ -5074,10 +5137,10 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
- rfb.writeVersionMsg();
+ System.out.println("RFB server supports protocol version: " +
+ rfb.serverMajor + "." + rfb.serverMinor);
+
+ rfb.writeVersionMsg();
- int authScheme = rfb.readAuthScheme();
+ rfb.writeVersionMsg();
+
+ authScheme = rfb.readAuthScheme();
+
+ gotAuth = true;
......@@ -5099,7 +5162,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
switch (authScheme) {
@@ -629,6 +758,10 @@
@@ -629,6 +765,10 @@
void doProtocolInitialisation() throws IOException {
......@@ -5110,7 +5173,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
rfb.writeClientInit();
rfb.readServerInit();
@@ -774,9 +907,28 @@
@@ -774,9 +914,28 @@
fatalError("HOST parameter not specified");
}
}
......@@ -5141,7 +5204,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
if (inAnApplet) {
str = readParameter("Open New Window", false);
@@ -804,6 +956,143 @@
@@ -804,6 +963,158 @@
deferScreenUpdates = readIntParameter("Defer screen updates", 20);
deferCursorUpdates = readIntParameter("Defer cursor updates", 10);
deferUpdateRequests = readIntParameter("Defer update requests", 50);
......@@ -5256,6 +5319,21 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
+ if (str != null && str.equalsIgnoreCase("Yes")) {
+ debugCerts = true;
+ }
+ debugKeyboard = false;
+ str = readParameter("debugKeyboard", false);
+ if (str != null && str.equalsIgnoreCase("Yes")) {
+ debugKeyboard = true;
+ }
+ mapF5_to_atsign = false;
+ str = readParameter("mapF5_to_atsign", false);
+ if (str != null && str.equalsIgnoreCase("Yes")) {
+ mapF5_to_atsign = true;
+ }
+ forbid_Ctrl_Alt = false;
+ str = readParameter("forbid_Ctrl_Alt", false);
+ if (str != null && str.equalsIgnoreCase("Yes")) {
+ forbid_Ctrl_Alt = true;
+ }
+ ignoreMSLogonCheck = false;
+ str = readParameter("ignoreMSLogonCheck", false);
+ if (str != null && str.equalsIgnoreCase("Yes")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment