changeset 2069:6d2beb513332

2010-07-23 Deepak Bhole <dbhole@redhat.com> * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java (activateJars): Add security descriptor mapping for nested jars.
author doko@ubuntu.com
date Sat, 24 Jul 2010 00:54:29 +0200
parents 7c6d03b64403
children 1419166fcebf
files ChangeLog netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
diffstat 2 files changed, 30 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Jul 24 00:53:53 2010 +0200
+++ b/ChangeLog	Sat Jul 24 00:54:29 2010 +0200
@@ -1,3 +1,8 @@
+2010-07-23  Deepak Bhole <dbhole@redhat.com>
+
+	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java (activateJars): Add
+	security descriptor mapping for nested jars.
+
 2010-07-22  Deepak Bhole <dbhole@redhat.com>
 
 	* netx/net/sourceforge/jnlp/SecurityDesc.java (getPermissions): Clean up
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Sat Jul 24 00:53:53 2010 +0200
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Sat Jul 24 00:54:29 2010 +0200
@@ -654,8 +654,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");