diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2005-06-01 22:52:56 +0400 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2005-06-01 22:52:56 +0400 |
commit | 7657b23dcbf2d9760157d56e618ddf48954d4a84 (patch) | |
tree | 7a0f9d8fda95c53764048f41262fa2549b21f202 /mcs/class/corlib/System.Security/SecurityManager.cs | |
parent | e8a41d0bfa6b9cb6b6e9612d9972dfd43ebdd1f2 (diff) |
2005-06-01 Sebastien Pouliot <sebastien@ximian.com>
* PermissionBuilder.cs: Removed unification stuff. This is done at a
lower level.
* SecurityManager.cs: Split loading PolicyLevel in two phases. The
PolicyHierarchy is now available after phase 1 which ensures we can
load permission from outside corlib.
svn path=/trunk/mcs/; revision=45305
Diffstat (limited to 'mcs/class/corlib/System.Security/SecurityManager.cs')
-rw-r--r-- | mcs/class/corlib/System.Security/SecurityManager.cs | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/mcs/class/corlib/System.Security/SecurityManager.cs b/mcs/class/corlib/System.Security/SecurityManager.cs index d53cb699aeb..7fd46a62e5f 100644 --- a/mcs/class/corlib/System.Security/SecurityManager.cs +++ b/mcs/class/corlib/System.Security/SecurityManager.cs @@ -216,6 +216,7 @@ namespace System.Security { try { pl = new PolicyLevel (type.ToString (), type); pl.LoadFromFile (path); + pl.Initialize (); } catch (Exception e) { throw new ArgumentException (Locale.GetText ("Invalid policy XML"), e); @@ -387,17 +388,26 @@ namespace System.Security { // note: use InternalGetFolderPath to avoid recursive policy initialization string userPolicyPath = Path.Combine (Environment.InternalGetFolderPath (Environment.SpecialFolder.ApplicationData), "mono"); - ArrayList al = new ArrayList (); - al.Add (new PolicyLevel ("Enterprise", PolicyLevelType.Enterprise, - Path.Combine (machinePolicyPath, "enterprisesec.config"))); - - al.Add (new PolicyLevel ("Machine", PolicyLevelType.Machine, - Path.Combine (machinePolicyPath, "security.config"))); + PolicyLevel enterprise = new PolicyLevel ("Enterprise", PolicyLevelType.Enterprise); + PolicyLevel machine = new PolicyLevel ("Machine", PolicyLevelType.Machine); + PolicyLevel user = new PolicyLevel ("User", PolicyLevelType.User); - al.Add (new PolicyLevel ("User", PolicyLevelType.User, - Path.Combine (userPolicyPath, "security.config"))); + enterprise.LoadFromFile (Path.Combine (machinePolicyPath, "enterprisesec.config")); + machine.LoadFromFile (Path.Combine (machinePolicyPath, "security.config")); + user.LoadFromFile (Path.Combine (userPolicyPath, "security.config")); + ArrayList al = new ArrayList (); + al.Add (enterprise); + al.Add (machine); + al.Add (user); + // setting _hierarchy here allows for loading assemblies containing permissions + // FIXME: we still need to enforce the FullTrust list _hierarchy = ArrayList.Synchronized (al); + + // part II - creating the permission sets + enterprise.Initialize (); + machine.Initialize (); + user.Initialize (); } internal static bool ResolvePolicyLevel (ref PermissionSet ps, PolicyLevel pl, Evidence evidence) |