changeset 1962:337a1a5344da

Add security descriptor mapping for nested jars.
author Deepak Bhole <dbhole@redhat.com>
date Fri, 23 Jul 2010 12:02:01 -0400
parents 391a0a5145ca
children 26fd1324d482
files ChangeLog rt/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
diffstat 2 files changed, 30 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jul 22 19:30:39 2010 -0400
+++ b/ChangeLog	Fri Jul 23 12:02:01 2010 -0400
@@ -1,3 +1,8 @@
+2010-07-23  Deepak Bhole <dbhole@redhat.com>
+
+	* rt/net/sourceforge/jnlp/runtime/JNLPClassLoader.java (activateJars): Add
+	security descriptor mapping for nested jars.
+
 2010-07-22  Deepak Bhole <dbhole@redhat.com>
 
 	* rt/net/sourceforge/jnlp/SecurityDesc.java (getPermissions): Clean up
--- a/rt/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Thu Jul 22 19:30:39 2010 -0400
+++ b/rt/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Fri Jul 23 12:02:01 2010 -0400
@@ -655,8 +655,31 @@
                                     }
 
                                     try {
-                                        addURL(new URL("file://" + extractedJarLocation));
-                                    } catch (MalformedURLException mfue) {
+                                        URL fileURL = new URL("file://" + extractedJarLocation); 
+                                        addURL(fileURL);
+                                        
+                                        SecurityDesc jarSecurity = file.getSecurity();
+                        				
+                                        if (file instanceof PluginBridge) {
+                        					
+                                            URL codebase = null;
+
+                                            if (file.getCodeBase() != null) {
+                                                codebase = file.getCodeBase();
+                                            } else {
+                                                //Fixme: codebase should be the codebase of the Main Jar not 
+                                                //the location. Although, it still works in the current state.
+                                                codebase = file.getResources().getMainJAR().getLocation();
+                                            }
+                        					
+                                            jarSecurity = new SecurityDesc(file, 
+                                                SecurityDesc.ALL_PERMISSIONS,
+                                                codebase.getHost());
+                                        }
+                        				
+                                        jarLocationSecurityMap.put(fileURL, jarSecurity);
+                                        
+                                     } catch (MalformedURLException mfue) {
                                         if (JNLPRuntime.isDebug())
                                             System.err.println("Unable to add extracted nested jar to classpath");