Revision: 4191
http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4191&view=rev
Author: atkac
Date: 2010-11-11 13:21:55 +0000 (Thu, 11 Nov 2010)
Log Message:
-----------
[Development] java: Implement VeNCrypt chooser (Martin Koegler)
Modified Paths:
--------------
trunk/java/src/com/tigervnc/vncviewer/RfbProto.java
trunk/java/src/com/tigervnc/vncviewer/VncViewer.java
Modified: trunk/java/src/com/tigervnc/vncviewer/RfbProto.java
===================================================================
--- trunk/java/src/com/tigervnc/vncviewer/RfbProto.java 2010-11-11 13:18:02 UTC
(rev 4190)
+++ trunk/java/src/com/tigervnc/vncviewer/RfbProto.java 2010-11-11 13:21:55 UTC
(rev 4191)
@@ -391,7 +391,8 @@
// Find first supported security type.
for (int i = 0; i < nSecTypes; i++) {
- if (secTypes[i] == SecTypeNone || secTypes[i] == SecTypeVncAuth) {
+ if (secTypes[i] == SecTypeNone || secTypes[i] == SecTypeVncAuth
+ || secTypes[i] == SecTypeVeNCrypt) {
secType = secTypes[i];
break;
}
@@ -406,6 +407,36 @@
return secType;
}
+ int authenticateVeNCrypt() throws Exception {
+ int majorVersion = readU8();
+ int minorVersion = readU8();
+ int Version = (majorVersion << 8) | minorVersion;
+ if (Version < 0x0002) {
+ os.write(0);
+ os.write(0);
+ throw new Exception("Server reported an unsupported VeNCrypt
version");
+ }
+ os.write(0);
+ os.write(2);
+ if (readU8() != 0)
+ throw new Exception("Server reported it could not support the
VeNCrypt version");
+ int nSecTypes = readU8();
+ int[] secTypes = new int[nSecTypes];
+ for(int i = 0; i < nSecTypes; i++)
+ secTypes[i] = readU32();
+
+ for(int i = 0; i < nSecTypes; i++)
+ switch(secTypes[i])
+ {
+ case SecTypeNone:
+ case SecTypeVncAuth:
+ writeInt(secTypes[i]);
+ return secTypes[i];
+ }
+
+ throw new Exception("No valid VeNCrypt sub-type");
+ }
+
//
// Perform "no authentication".
//
Modified: trunk/java/src/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- trunk/java/src/com/tigervnc/vncviewer/VncViewer.java 2010-11-11
13:18:02 UTC (rev 4190)
+++ trunk/java/src/com/tigervnc/vncviewer/VncViewer.java 2010-11-11
13:21:55 UTC (rev 4191)
@@ -361,26 +361,35 @@
authType = secType;
}
- switch (authType) {
- case RfbProto.AuthNone:
- showConnectionStatus("No authentication needed");
- rfb.authenticateNone();
- break;
- case RfbProto.AuthVNC:
- showConnectionStatus("Performing standard VNC authentication");
- if (passwordParam != null) {
- rfb.authenticateVNC(passwordParam);
- } else {
- String pw = askPassword();
- rfb.authenticateVNC(pw);
- }
- break;
- default:
- throw new Exception("Unknown authentication scheme " + authType);
- }
+ doAuthentification(authType);
}
+ void doAuthentification(int secType) throws Exception {
+ switch (secType) {
+ case RfbProto.SecTypeNone:
+ showConnectionStatus("No authentication needed");
+ rfb.authenticateNone();
+ break;
+ case RfbProto.SecTypeVncAuth:
+ showConnectionStatus("Performing standard VNC authentication");
+ if (passwordParam != null) {
+ rfb.authenticateVNC(passwordParam);
+ } else {
+ String pw = askPassword();
+ rfb.authenticateVNC(pw);
+ }
+ break;
+ case RfbProto.SecTypeVeNCrypt:
+ showConnectionStatus("VeNCrypt chooser");
+ secType = rfb.authenticateVeNCrypt();
+ doAuthentification(secType);
+ break;
+ default:
+ throw new Exception("Unknown authentication scheme " + secType);
+ }
+ }
+
//
// Show a message describing the connection status.
// To hide the connection status label, use (msg == null).
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Tigervnc-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits