- Timestamp:
- 07/18/10 22:16:04 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/sources/HeuristicLab.PluginInfrastructure/Sandboxing/SandboxManager.cs
r3578 r4042 65 65 66 66 #region permission set for sandbox 67 // 68 //pset = new PermissionSet(PermissionState.None);69 //pset.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));70 //pset.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.MemberAccess));71 //FileIOPermission fPerm = new FileIOPermission(PermissionState.None);67 //Uncomment code for sandboxed appdomain 68 pset = new PermissionSet(PermissionState.None); 69 pset.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution)); 70 pset.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.AllFlags)); 71 FileIOPermission fPerm = new FileIOPermission(PermissionState.None); 72 72 73 //foreach (IPluginDescription plugin in ApplicationManager.Manager.Plugins) { 74 // fPerm.AddPathList(FileIOPermissionAccess.Read | FileIOPermissionAccess.PathDiscovery, plugin.Files.ToArray()); 75 //} 73 foreach (IPluginDescription plugin in ApplicationManager.Manager.Plugins) { 74 foreach (IPluginFile pluginFile in plugin.Files) { 75 fPerm.AddPathList(FileIOPermissionAccess.Read | FileIOPermissionAccess.PathDiscovery, pluginFile.Name); 76 //fPerm.AddPathList(FileIOPermissionAccess.AllAccess, pluginFile.Name); 77 } 78 } 76 79 77 //pset.AddPermission(fPerm);80 pset.AddPermission(fPerm); 78 81 #endregion 79 82 80 83 #region permission set of unrestricted appdomain 81 84 // unrestricted appdomain 82 pset = new PermissionSet(PermissionState.Unrestricted);85 //pset = new PermissionSet(PermissionState.Unrestricted); 83 86 #endregion 84 87 … … 86 89 //setup.PrivateBinPath = pluginDir; 87 90 setup.ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; 88 AppDomain applicationDomain = AppDomain.CreateDomain(name, AppDomain.CurrentDomain.Evidence, setup, pset, CreateStrongName(Assembly.GetExecutingAssembly())); 91 AppDomain applicationDomain = AppDomain.CreateDomain(name, AppDomain.CurrentDomain.Evidence, setup, pset, new StrongName[] {CreateStrongName(Assembly.GetExecutingAssembly())}); 92 89 93 Type applicationManagerType = typeof(DefaultApplicationManager); 90 94 DefaultApplicationManager applicationManager = … … 93 97 PluginDescription[] plugins = ApplicationManager.Manager.Plugins.Cast<PluginDescription>().ToArray(); 94 98 applicationManager.PrepareApplicationDomain(apps, plugins); 95 //if (files != null && files.Count() > 0)96 //applicationManager.LoadAssemblies(files);99 if (files != null && files.Count() > 0) 100 applicationManager.LoadAssemblies(files); 97 101 return applicationDomain; 98 102 }
Note: See TracChangeset
for help on using the changeset viewer.