diff options
author | Brian P. Hinz <bphinz@users.sf.net> | 2016-08-27 17:33:04 -0400 |
---|---|---|
committer | Brian P. Hinz <bphinz@users.sf.net> | 2016-08-27 17:33:04 -0400 |
commit | c456387fe1ed922c5bfb5daf0e780f0000cab2fb (patch) | |
tree | 269a8b95eff08344098afdf89a511ce443ec2bf1 /java/com/tigervnc/rfb | |
parent | da33c36638482d014996a3d99c90e2781304cebb (diff) | |
download | tigervnc-c456387fe1ed922c5bfb5daf0e780f0000cab2fb.tar.gz tigervnc-c456387fe1ed922c5bfb5daf0e780f0000cab2fb.zip |
Make all viewer parameters static. Viewer instances are isolated from each other by spawning a completely new process for each viewer, rather than simply starting a new thread. All dialogs were redesigned to better match the look of the native viewer, and also to be more tolerant of sizing differences between platforms.
Diffstat (limited to 'java/com/tigervnc/rfb')
-rw-r--r-- | java/com/tigervnc/rfb/AliasParameter.java | 8 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/CConnection.java | 12 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/CSecurityTLS.java | 16 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/CSecurityVeNCrypt.java | 2 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/Configuration.java | 76 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/Security.java | 38 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/SecurityClient.java | 6 |
7 files changed, 68 insertions, 90 deletions
diff --git a/java/com/tigervnc/rfb/AliasParameter.java b/java/com/tigervnc/rfb/AliasParameter.java index a1ae838c..3f20ae46 100644 --- a/java/com/tigervnc/rfb/AliasParameter.java +++ b/java/com/tigervnc/rfb/AliasParameter.java @@ -44,5 +44,13 @@ public class AliasParameter extends VoidParameter { param.setImmutable(); } + public void setHasBeenSet() { + param.setHasBeenSet(); + } + + public boolean hasBeenSet() { + return param.hasBeenSet(); + } + protected VoidParameter param; } diff --git a/java/com/tigervnc/rfb/CConnection.java b/java/com/tigervnc/rfb/CConnection.java index c354868b..483d1f84 100644 --- a/java/com/tigervnc/rfb/CConnection.java +++ b/java/com/tigervnc/rfb/CConnection.java @@ -111,7 +111,7 @@ abstract public class CConnection extends CMsgHandler { int secType = Security.secTypeInvalid; List<Integer> secTypes = new ArrayList<Integer>(); - secTypes = Security.GetEnabledSecTypes(); + secTypes = security.GetEnabledSecTypes(); if (cp.isVersion(3,3)) { @@ -292,6 +292,16 @@ abstract public class CConnection extends CMsgHandler { // Ownership of the IdentityVerifier is retained by the CConnection instance. //public IdentityVerifier getIdentityVerifier() { return 0; } + public void framebufferUpdateStart() + { + super.framebufferUpdateStart(); + } + + public void framebufferUpdateEnd() + { + super.framebufferUpdateEnd(); + } + // authSuccess() is called when authentication has succeeded. public void authSuccess() {} diff --git a/java/com/tigervnc/rfb/CSecurityTLS.java b/java/com/tigervnc/rfb/CSecurityTLS.java index a8f6df35..4b20e0bf 100644 --- a/java/com/tigervnc/rfb/CSecurityTLS.java +++ b/java/com/tigervnc/rfb/CSecurityTLS.java @@ -58,11 +58,11 @@ import com.tigervnc.vncviewer.*; public class CSecurityTLS extends CSecurity { - public static StringParameter x509ca - = new StringParameter("x509ca", + public static StringParameter X509CA + = new StringParameter("X509CA", "X509 CA certificate", "", Configuration.ConfigurationObject.ConfViewer); - public static StringParameter x509crl - = new StringParameter("x509crl", + public static StringParameter X509CRL + = new StringParameter("X509CRL", "X509 CRL file", "", Configuration.ConfigurationObject.ConfViewer); private void initGlobal() @@ -80,8 +80,8 @@ public class CSecurityTLS extends CSecurity { manager = null; setDefaults(); - cafile = x509ca.getData(); - crlfile = x509crl.getData(); + cafile = X509CA.getData(); + crlfile = X509CRL.getData(); } public static String getDefaultCA() { @@ -99,9 +99,9 @@ public class CSecurityTLS extends CSecurity { public static void setDefaults() { if (new File(getDefaultCA()).exists()) - x509ca.setDefaultStr(getDefaultCA()); + X509CA.setDefaultStr(getDefaultCA()); if (new File(getDefaultCRL()).exists()) - x509crl.setDefaultStr(getDefaultCRL()); + X509CRL.setDefaultStr(getDefaultCRL()); } // FIXME: diff --git a/java/com/tigervnc/rfb/CSecurityVeNCrypt.java b/java/com/tigervnc/rfb/CSecurityVeNCrypt.java index f353874c..179900a4 100644 --- a/java/com/tigervnc/rfb/CSecurityVeNCrypt.java +++ b/java/com/tigervnc/rfb/CSecurityVeNCrypt.java @@ -134,7 +134,7 @@ public class CSecurityVeNCrypt extends CSecurity { Iterator<Integer> j; List<Integer> secTypes = new ArrayList<Integer>(); - secTypes = Security.GetEnabledExtSecTypes(); + secTypes = security.GetEnabledExtSecTypes(); /* Honor server's security type order */ for (i = 0; i < nAvailableTypes; i++) { diff --git a/java/com/tigervnc/rfb/Configuration.java b/java/com/tigervnc/rfb/Configuration.java index 5d140d95..11fc89a4 100644 --- a/java/com/tigervnc/rfb/Configuration.java +++ b/java/com/tigervnc/rfb/Configuration.java @@ -26,14 +26,19 @@ package com.tigervnc.rfb; import java.io.FileInputStream; import java.io.PrintWriter; +import java.lang.reflect.Field; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; +import com.tigervnc.vncviewer.VncViewer; + public class Configuration { static LogWriter vlog = new LogWriter("Configuration"); + private static final String IDENTIFIER_STRING = "TigerVNC Configuration file Version 1.0"; + public enum ConfigurationObject { ConfGlobal, ConfServer, ConfViewer }; // -=- The Global/server/viewer Configuration objects @@ -259,77 +264,6 @@ public class Configuration { list(79, 10); } - public void readAppletParams(java.applet.Applet applet) { - VoidParameter current = head; - while (current != null) { - String str = applet.getParameter(current.getName()); - if (str != null) - current.setParam(str); - current = current._next; - } - } - - public static void load(String filename) { - if (filename == null) - return; - - /* Read parameters from file */ - Properties props = new Properties(); - try { - props.load(new FileInputStream(filename)); - } catch(java.security.AccessControlException e) { - vlog.error("Cannot access system properties:"+e.getMessage()); - return; - } catch (java.lang.Exception e) { - vlog.error("Error opening config file:"+e.getMessage()); - return; - } - - for (Iterator<String> i = props.stringPropertyNames().iterator(); i.hasNext();) { - String name = (String)i.next(); - if (name.startsWith("[")) { - // skip the section delimiters - continue; - } else if (name.equals("host")) { - setParam("Server", props.getProperty(name)); - } else if (name.equals("disableclipboard")) { - setParam("RecvClipboard", props.getProperty(name)); - setParam("SendClipboard", props.getProperty(name)); - } else if (name.equals("localcursor")) { - setParam("UseLocalCursor", props.getProperty(name)); - } else { - if (!setParam(name, props.getProperty(name))) - vlog.debug("Cannot set parameter: "+name); - } - } - } - - public static void save(String filename) { - PrintWriter pw = null; - try { - pw = new PrintWriter(filename, "UTF-8"); - } catch (java.lang.Exception e) { - vlog.error("Error opening config file:"+e.getMessage()); - return; - } - - pw.println("# TigerVNC viewer configuration"); - DateFormat dateFormat = new SimpleDateFormat("E MMM d k:m:s z yyyy"); - Date date = new Date(); - pw.println("# "+dateFormat.format(date)); - VoidParameter current = Configuration.global().head; - while (current != null) { - String name = current.getName(); - String value = current.getValueStr(); - if (!name.equals("Server") && !name.equals("Port") && - value != null && value != current.getDefaultStr()) - pw.println(name+"="+current.getValueStr()); - current = current._next; - } - pw.flush(); - pw.close(); - } - // Name for this Configuration private String name; diff --git a/java/com/tigervnc/rfb/Security.java b/java/com/tigervnc/rfb/Security.java index a68ae3e9..e256e6eb 100644 --- a/java/com/tigervnc/rfb/Security.java +++ b/java/com/tigervnc/rfb/Security.java @@ -60,6 +60,8 @@ public class Security { public static final int secResultFailed = 1; public static final int secResultTooMany = 2; // deprecated + public Security() { } + public Security(StringParameter secTypes) { String secTypesStr; @@ -70,9 +72,9 @@ public class Security { secTypesStr = null; } - public static List<Integer> enabledSecTypes = new ArrayList<Integer>(); + private List<Integer> enabledSecTypes = new ArrayList<Integer>(); - public static final List<Integer> GetEnabledSecTypes() + public final List<Integer> GetEnabledSecTypes() { List<Integer> result = new ArrayList<Integer>(); @@ -98,7 +100,7 @@ public class Security { return (result); } - public static final List<Integer> GetEnabledExtSecTypes() + public final List<Integer> GetEnabledExtSecTypes() { List<Integer> result = new ArrayList<Integer>(); @@ -111,7 +113,7 @@ public class Security { return (result); } - public static final void EnableSecType(int secType) + public final void EnableSecType(int secType) { for (Iterator<Integer> i = enabledSecTypes.iterator(); i.hasNext(); ) @@ -134,7 +136,29 @@ public class Security { return false; } - public static void DisableSecType(int secType) { enabledSecTypes.remove((Object)secType); } + public String ToString() + { + Iterator<Integer> i; + String out = new String(""); + boolean firstpass = true; + String name; + + for (i = enabledSecTypes.iterator(); i.hasNext(); ) { + name = secTypeName((Integer)i.next()); + if (name.startsWith("[")) /* Unknown security type */ + continue; + + if (!firstpass) + out = out.concat(","); + else + firstpass = false; + out = out.concat(name); + } + + return out; + } + + public void DisableSecType(int secType) { enabledSecTypes.remove((Object)secType); } public static int secTypeNum(String name) { if (name.equalsIgnoreCase("None")) return secTypeNone; @@ -203,7 +227,9 @@ public class Security { return (result); } - public final void SetSecTypes(List<Integer> secTypes) { enabledSecTypes = secTypes; } + public final void SetSecTypes(List<Integer> secTypes) { + enabledSecTypes = secTypes; + } static LogWriter vlog = new LogWriter("Security"); } diff --git a/java/com/tigervnc/rfb/SecurityClient.java b/java/com/tigervnc/rfb/SecurityClient.java index 59499b1e..ff2433c2 100644 --- a/java/com/tigervnc/rfb/SecurityClient.java +++ b/java/com/tigervnc/rfb/SecurityClient.java @@ -78,9 +78,9 @@ public class SecurityClient extends Security { //UserPasswdGetter upg = null; String msg = null; - static StringParameter secTypes + public static StringParameter secTypes = new StringParameter("SecurityTypes", - "Specify which security scheme to use (None, VncAuth)", - "Ident,TLSIdent,X509Ident,X509Plain,TLSPlain,X509Vnc,TLSVnc,X509None,TLSNone,VncAuth,None", Configuration.ConfigurationObject.ConfViewer); + "Specify which security scheme to use (None, VncAuth, Plain, Ident, TLSNone, TLSVnc, TLSPlain, TLSIdent, X509None, X509Vnc, X509Plain, X509Ident)", + "X509Ident,X509Plain,TLSIdent,TLSPlain,X509Vnc,TLSVnc,X509None,TLSNone,Ident,VncAuth,None", Configuration.ConfigurationObject.ConfViewer); } |