changeset 1479:9b0b945113de

- Unescape " (rhbz: 483095) - Use custom authenticator so that javaws can handle unknown ssl certs (rhbz: 480075)
author Deepak Bhole <dbhole@redhat.com>
date Mon, 27 Apr 2009 11:15:01 -0400
parents 010cb02d0958
children 6123e2454ad9
files ChangeLog plugin/icedtea/sun/applet/PluginAppletViewer.java rt/net/sourceforge/jnlp/runtime/Boot.java
diffstat 3 files changed, 46 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Apr 27 07:13:07 2009 -0400
+++ b/ChangeLog	Mon Apr 27 11:15:01 2009 -0400
@@ -1,3 +1,9 @@
+2009-04-27 Deepak Bhole <dbhole@redhat.com>
+
+	* plugin/icedtea/sun/applet/PluginAppletViewer.java: Unescape &quot;
+	* rt/net/sourceforge/jnlp/runtime/Boot.java: Use custom authenticator for
+	javaws, so that it can handle SSL sites correctly
+
 2009-04-27  Gary Benson  <gbenson@redhat.com>
 
 	* ports/hotspot/src/share/vm/shark/sharkBlock.hpp
--- a/plugin/icedtea/sun/applet/PluginAppletViewer.java	Mon Apr 27 07:13:07 2009 -0400
+++ b/plugin/icedtea/sun/applet/PluginAppletViewer.java	Mon Apr 27 11:15:01 2009 -0400
@@ -1635,12 +1635,14 @@
     							 att = att.replace("&amp;", "&");
     							 att = att.replace("&#10;", "\n");
     							 att = att.replace("&#13;", "\r");
+    							 att = att.replace("&quot;", "\"");
 
     							 val = val.replace("&gt;", ">");
     							 val = val.replace("&lt;", "<");
     							 val = val.replace("&amp;", "&");
     							 val = val.replace("&#10;", "\n");
     							 val = val.replace("&#13;", "\r");
+    							 val = val.replace("&quot;", "\"");
     							 PluginDebug.debug("PUT " + att + " = " + val);
    							     atts.put(att.toLowerCase(), val);
     						 } else {
@@ -1721,13 +1723,6 @@
                              atts.put("type", ((String) atts.get("java_type")));
                          }
 
-    					 // The <OBJECT> attribute codebase isn't what
-    					 // we want when not dealing with jars. If its 
-    					 // defined, remove it in that case.
-    					 if(atts.get("archive") == null && atts.get("codebase") != null) {
-    						 atts.remove("codebase");
-    					 }
-
     					 if (atts.get("width") == null || !isInt(atts.get("width"))) {
     						 atts.put("width", "1000");
     						 atts.put("widthPercentage", 100);
--- a/rt/net/sourceforge/jnlp/runtime/Boot.java	Mon Apr 27 07:13:07 2009 -0400
+++ b/rt/net/sourceforge/jnlp/runtime/Boot.java	Mon Apr 27 11:15:01 2009 -0400
@@ -17,17 +17,32 @@
 
 package net.sourceforge.jnlp.runtime;
 
-import java.util.*;
-import java.io.*;
-import java.net.*;
-import java.security.*;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.List;
 
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.cache.*;
-import net.sourceforge.jnlp.runtime.*;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+
+import net.sourceforge.jnlp.AppletDesc;
+import net.sourceforge.jnlp.ApplicationDesc;
+import net.sourceforge.jnlp.JNLPFile;
+import net.sourceforge.jnlp.LaunchException;
+import net.sourceforge.jnlp.Launcher;
+import net.sourceforge.jnlp.ParseException;
+import net.sourceforge.jnlp.PropertyDesc;
+import net.sourceforge.jnlp.ResourcesDesc;
+import net.sourceforge.jnlp.cache.UpdatePolicy;
+import net.sourceforge.jnlp.security.VariableX509TrustManager;
 import net.sourceforge.jnlp.security.viewer.CertificateViewer;
-import net.sourceforge.jnlp.services.*;
-import net.sourceforge.jnlp.util.*;
+import net.sourceforge.jnlp.services.ServiceUtil;
 
 /**
  * This is the main entry point for the JNLP client.  The main
@@ -153,6 +168,20 @@
 
         if (null != getOption("-noupdate"))
             JNLPRuntime.setDefaultUpdatePolicy(UpdatePolicy.NEVER);
+        
+        // wire in custom authenticator
+        try {
+            SSLSocketFactory sslSocketFactory;
+            SSLContext context = SSLContext.getInstance("SSL");
+            TrustManager[] trust = new TrustManager[] { VariableX509TrustManager.getInstance() };
+            context.init(null, trust, null);
+            sslSocketFactory = context.getSocketFactory();
+            
+            HttpsURLConnection.setDefaultSSLSocketFactory(sslSocketFactory);
+        } catch (Exception e) {
+            System.err.println("Unable to set SSLSocketfactory (may _prevent_ access to sites that should be trusted)! Continuing anyway...");
+            e.printStackTrace();
+        }
 
         // do in a privileged action to clear the security context of
         // the Boot13 class, which doesn't have any privileges in