From 69158eed22017d1f85c181f28460c31332d40bb0 Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Tue, 15 Mar 2005 13:03:49 +0000 Subject: [PATCH] 2005-03-15 Sebastien Pouliot * CodeAccessPermission.cs: Fixed depth for starting the stack walk (imperative) and fixed assert condition. * PermissionSet.cs: Fixed depth for starting the stack walk. * SecurityFrame.cs: Reversed stack. Added optional debugging code. svn path=/trunk/mcs/; revision=41834 --- mcs/class/corlib/System.Security/ChangeLog | 7 +++++++ mcs/class/corlib/System.Security/CodeAccessPermission.cs | 4 ++-- mcs/class/corlib/System.Security/PermissionSet.cs | 2 +- mcs/class/corlib/System.Security/SecurityFrame.cs | 9 +++++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/mcs/class/corlib/System.Security/ChangeLog b/mcs/class/corlib/System.Security/ChangeLog index 99c0a1b96ea..b4c12f5db40 100755 --- a/mcs/class/corlib/System.Security/ChangeLog +++ b/mcs/class/corlib/System.Security/ChangeLog @@ -1,3 +1,10 @@ +2005-03-15 Sebastien Pouliot + + * CodeAccessPermission.cs: Fixed depth for starting the stack walk + (imperative) and fixed assert condition. + * PermissionSet.cs: Fixed depth for starting the stack walk. + * SecurityFrame.cs: Reversed stack. Added optional debugging code. + 2005-03-14 Sebastien Pouliot * SecurityManager.cs: Fix CodeAccessPermissionTest.CustomCAS unit test diff --git a/mcs/class/corlib/System.Security/CodeAccessPermission.cs b/mcs/class/corlib/System.Security/CodeAccessPermission.cs index 6db7e0ab82c..00012104ba8 100755 --- a/mcs/class/corlib/System.Security/CodeAccessPermission.cs +++ b/mcs/class/corlib/System.Security/CodeAccessPermission.cs @@ -100,7 +100,7 @@ namespace System.Security { return; // skip frames until we get the caller (of our caller) - new PermissionSet (this).CasOnlyDemand (2); + new PermissionSet (this).CasOnlyDemand (3); } [MonoTODO ("Imperative mode isn't supported")] @@ -355,7 +355,7 @@ namespace System.Security { // 4. CheckAssert if (frame.Assert != null) { foreach (IPermission p in frame.Assert) { - if (!CheckAssert (p as CodeAccessPermission)) { + if (CheckAssert (p as CodeAccessPermission)) { // FIXME: partial asserts return true; // stop the stack walk } diff --git a/mcs/class/corlib/System.Security/PermissionSet.cs b/mcs/class/corlib/System.Security/PermissionSet.cs index afae930622e..2cd421f9e92 100644 --- a/mcs/class/corlib/System.Security/PermissionSet.cs +++ b/mcs/class/corlib/System.Security/PermissionSet.cs @@ -216,7 +216,7 @@ namespace System.Security { // - the permission set only contains non CAS permissions; or // - security isn't enabled (applis only to CAS!) if (!cas.IsEmpty () && SecurityManager.SecurityEnabled) - CasOnlyDemand (_declsec ? 4 : 2); + CasOnlyDemand (_declsec ? 5 : 3); } // The number of frames to skip depends on who's calling diff --git a/mcs/class/corlib/System.Security/SecurityFrame.cs b/mcs/class/corlib/System.Security/SecurityFrame.cs index 2d620fd0d51..c0b031c0519 100644 --- a/mcs/class/corlib/System.Security/SecurityFrame.cs +++ b/mcs/class/corlib/System.Security/SecurityFrame.cs @@ -148,6 +148,15 @@ namespace System.Security { foreach (RuntimeSecurityFrame frame in stack) { al.Add (new SecurityFrame (frame)); } + al.Reverse (); +#if false + Console.WriteLine ("Stack Dump (skip {0})", skipFrames); + int i=1; + foreach (SecurityFrame f in al) { + Console.WriteLine ("\t{0}. {1}", i++, f.Method); + } + Console.WriteLine ("End Stack Dump"); +#endif return al; } } -- 2.25.1