diff options
Diffstat (limited to 'java/com/tigervnc/rfb')
-rw-r--r-- | java/com/tigervnc/rfb/CConnection.java | 2 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/CSecurity.java | 1 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/CSecurityIdent.java | 2 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/CSecurityPlain.java | 2 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/CSecurityStack.java | 9 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/CSecurityTLS.java | 1 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/CSecurityVeNCrypt.java | 6 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/CSecurityVncAuth.java | 2 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/UserPasswdGetter.java | 2 |
9 files changed, 23 insertions, 4 deletions
diff --git a/java/com/tigervnc/rfb/CConnection.java b/java/com/tigervnc/rfb/CConnection.java index aefc2760..c9b6b89a 100644 --- a/java/com/tigervnc/rfb/CConnection.java +++ b/java/com/tigervnc/rfb/CConnection.java @@ -389,6 +389,8 @@ abstract public class CConnection extends CMsgHandler { // Identities, to determine the unique(ish) name of the server. public String getServerName() { return serverName; } + public boolean isSecure() { return csecurity != null ? csecurity.isSecure() : false; } + public static final int RFBSTATE_UNINITIALISED = 0; public static final int RFBSTATE_PROTOCOL_VERSION = 1; public static final int RFBSTATE_SECURITY_TYPES = 2; diff --git a/java/com/tigervnc/rfb/CSecurity.java b/java/com/tigervnc/rfb/CSecurity.java index a99a5f87..f192d301 100644 --- a/java/com/tigervnc/rfb/CSecurity.java +++ b/java/com/tigervnc/rfb/CSecurity.java @@ -37,6 +37,7 @@ abstract public class CSecurity { abstract public boolean processMsg(CConnection cc); abstract public int getType(); abstract public String description(); + public boolean isSecure() { return false; } /* * Use variable directly instead of dumb get/set methods. diff --git a/java/com/tigervnc/rfb/CSecurityIdent.java b/java/com/tigervnc/rfb/CSecurityIdent.java index e53432bf..872b84a0 100644 --- a/java/com/tigervnc/rfb/CSecurityIdent.java +++ b/java/com/tigervnc/rfb/CSecurityIdent.java @@ -30,7 +30,7 @@ public class CSecurityIdent extends CSecurity { StringBuffer username = new StringBuffer(); - upg.getUserPasswd(username, null); + upg.getUserPasswd(cc.isSecure(), username, null); // Return the response to the server os.writeU32(username.length()); diff --git a/java/com/tigervnc/rfb/CSecurityPlain.java b/java/com/tigervnc/rfb/CSecurityPlain.java index 98f6b8cc..ef7a10ee 100644 --- a/java/com/tigervnc/rfb/CSecurityPlain.java +++ b/java/com/tigervnc/rfb/CSecurityPlain.java @@ -34,7 +34,7 @@ public class CSecurityPlain extends CSecurity { StringBuffer username = new StringBuffer(); StringBuffer password = new StringBuffer(); - upg.getUserPasswd(username, password); + upg.getUserPasswd(cc.isSecure(), username, password); // Return the response to the server os.writeU32(username.length()); diff --git a/java/com/tigervnc/rfb/CSecurityStack.java b/java/com/tigervnc/rfb/CSecurityStack.java index e4f5988e..31e21f72 100644 --- a/java/com/tigervnc/rfb/CSecurityStack.java +++ b/java/com/tigervnc/rfb/CSecurityStack.java @@ -59,6 +59,15 @@ public class CSecurityStack extends CSecurity { return res; } + public boolean isSecure() + { + if (state0 != null && state0.isSecure()) + return true; + if (state == 1 && state1 != null && state1.isSecure()) + return true; + return false; + } + public final int getType() { return type; } public final String description() { return name; } diff --git a/java/com/tigervnc/rfb/CSecurityTLS.java b/java/com/tigervnc/rfb/CSecurityTLS.java index c91f36a1..e07ab9bb 100644 --- a/java/com/tigervnc/rfb/CSecurityTLS.java +++ b/java/com/tigervnc/rfb/CSecurityTLS.java @@ -462,6 +462,7 @@ public class CSecurityTLS extends CSecurity { public final int getType() { return anon ? Security.secTypeTLSNone : Security.secTypeX509None; } public final String description() { return anon ? "TLS Encryption without VncAuth" : "X509 Encryption without VncAuth"; } + public boolean isSecure() { return !anon; } protected CConnection client; diff --git a/java/com/tigervnc/rfb/CSecurityVeNCrypt.java b/java/com/tigervnc/rfb/CSecurityVeNCrypt.java index daf205cd..8bffedfd 100644 --- a/java/com/tigervnc/rfb/CSecurityVeNCrypt.java +++ b/java/com/tigervnc/rfb/CSecurityVeNCrypt.java @@ -185,6 +185,12 @@ public class CSecurityVeNCrypt extends CSecurity { return "VeNCrypt"; } + public final boolean isSecure() + { + if (csecurity != null && csecurity.isSecure()) + return true; + return false; + } public static StringParameter secTypesStr; diff --git a/java/com/tigervnc/rfb/CSecurityVncAuth.java b/java/com/tigervnc/rfb/CSecurityVncAuth.java index e8c5686d..06154953 100644 --- a/java/com/tigervnc/rfb/CSecurityVncAuth.java +++ b/java/com/tigervnc/rfb/CSecurityVncAuth.java @@ -36,7 +36,7 @@ public class CSecurityVncAuth extends CSecurity { byte[] challenge = new byte[vncAuthChallengeSize]; is.readBytes(challenge, 0, vncAuthChallengeSize); StringBuffer passwd = new StringBuffer(); - upg.getUserPasswd(null, passwd); + upg.getUserPasswd(cc.isSecure(), null, passwd); // Calculate the correct response byte[] key = new byte[8]; diff --git a/java/com/tigervnc/rfb/UserPasswdGetter.java b/java/com/tigervnc/rfb/UserPasswdGetter.java index 7390b11a..457eaf28 100644 --- a/java/com/tigervnc/rfb/UserPasswdGetter.java +++ b/java/com/tigervnc/rfb/UserPasswdGetter.java @@ -23,5 +23,5 @@ package com.tigervnc.rfb; public interface UserPasswdGetter { - public void getUserPasswd(StringBuffer user, StringBuffer password); + public void getUserPasswd(boolean secure, StringBuffer user, StringBuffer password); } |