diff options
-rw-r--r-- | java/CMakeLists.txt | 27 | ||||
-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 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/UserDialog.java | 25 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/insecure.png | bin | 0 -> 521 bytes | |||
-rw-r--r-- | java/com/tigervnc/vncviewer/secure.png | bin | 0 -> 453 bytes |
13 files changed, 62 insertions, 17 deletions
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 7d6c70a8..82de6c09 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -126,15 +126,18 @@ configure_file(${CLASSPATH}/timestamp.in ${CLASSPATH}/timestamp) if(NOT "${SRCDIR}" STREQUAL "${BINDIR}") -add_custom_command(OUTPUT ${BINDIR}/${CLASSPATH}/tigervnc.png - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${SRCDIR}/${CLASSPATH}/tigervnc.png ${BINDIR}/${CLASSPATH}/tigervnc.png - DEPENDS ${SRCDIR}/${CLASSPATH}/tigervnc.png) - -add_custom_command(OUTPUT ${BINDIR}/${CLASSPATH}/tigervnc.ico - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${SRCDIR}/${CLASSPATH}/tigervnc.ico ${BINDIR}/${CLASSPATH}/tigervnc.ico - DEPENDS ${SRCDIR}/${CLASSPATH}/tigervnc.ico) +set(ICONS +tigervnc.ico +tigervnc.png +insecure.png +secure.png) + +foreach(icon ${ICONS}) + add_custom_command(OUTPUT ${BINDIR}/${CLASSPATH}/${icon} + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${SRCDIR}/${CLASSPATH}/${icon} ${BINDIR}/${CLASSPATH}/${icon} + DEPENDS ${SRCDIR}/${CLASSPATH}/${icon}) +endforeach() endif() @@ -145,8 +148,10 @@ add_custom_command(OUTPUT VncViewer.jar DEPENDS ${JAVA_CLASSES} ${SRCDIR}/${CLASSPATH}/MANIFEST.MF ${BINDIR}/${CLASSPATH}/timestamp - ${BINDIR}/${CLASSPATH}/tigervnc.png ${BINDIR}/${CLASSPATH}/tigervnc.ico + ${BINDIR}/${CLASSPATH}/tigervnc.png + ${BINDIR}/${CLASSPATH}/insecure.png + ${BINDIR}/${CLASSPATH}/secure.png COMMAND ${JAVA_ARCHIVE} ARGS cfm VncViewer.jar ${SRCDIR}/${CLASSPATH}/MANIFEST.MF @@ -159,7 +164,7 @@ add_custom_command(OUTPUT VncViewer.jar com/jcraft/jsch/jcraft/*.class com/jcraft/jsch/jce/*.class com/jcraft/jsch/*.class - com/tigervnc/vncviewer/tigervnc.png + com/tigervnc/vncviewer/*.png com/tigervnc/vncviewer/tigervnc.ico COMMAND ${CMAKE_COMMAND} ARGS -DJava_PATH=${Java_PATH} -DJAR_FILE=${BINDIR}/VncViewer.jar 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); } diff --git a/java/com/tigervnc/vncviewer/UserDialog.java b/java/com/tigervnc/vncviewer/UserDialog.java index fad836a5..dfced983 100644 --- a/java/com/tigervnc/vncviewer/UserDialog.java +++ b/java/com/tigervnc/vncviewer/UserDialog.java @@ -68,7 +68,7 @@ public class UserDialog implements UserPasswdGetter, UserMsgBox } } - public final void getUserPasswd(StringBuffer user, StringBuffer password) + public final void getUserPasswd(boolean secure, StringBuffer user, StringBuffer password) { String passwordFileStr = passwordFile.getValue(); @@ -98,6 +98,7 @@ public class UserDialog implements UserPasswdGetter, UserMsgBox } JDialog win; + JLabel banner; JTextField username = null; JPasswordField passwd = null; JLayer icon; @@ -107,7 +108,27 @@ public class UserDialog implements UserPasswdGetter, UserMsgBox JPanel msg = new JPanel(null); msg.setSize(410, 145); - y = 10; + banner = new JLabel(); + banner.setBounds(0, 0, msg.getPreferredSize().width, 20); + banner.setHorizontalAlignment(JLabel.CENTER); + banner.setOpaque(true); + + if (secure) { + banner.setText("This connection is secure"); + banner.setBackground(Color.GREEN); + ImageIcon secure_icon = + new ImageIcon(VncViewer.class.getResource("secure.png")); + banner.setIcon(secure_icon); + } else { + banner.setText("This connection is not secure"); + banner.setBackground(Color.RED); + ImageIcon insecure_icon = + new ImageIcon(VncViewer.class.getResource("insecure.png")); + banner.setIcon(insecure_icon); + } + msg.add(banner); + + y = 20 + 10; JButton iconb = new JButton("?"); iconb.setVerticalAlignment(JLabel.CENTER); diff --git a/java/com/tigervnc/vncviewer/insecure.png b/java/com/tigervnc/vncviewer/insecure.png Binary files differnew file mode 100644 index 00000000..f48faffe --- /dev/null +++ b/java/com/tigervnc/vncviewer/insecure.png diff --git a/java/com/tigervnc/vncviewer/secure.png b/java/com/tigervnc/vncviewer/secure.png Binary files differnew file mode 100644 index 00000000..93833717 --- /dev/null +++ b/java/com/tigervnc/vncviewer/secure.png |