// // API for PermissionSets // public virtual void Assert(PermissionSet permSet, ref StackCrawlMark stackMark) { // Note: if the "AssertPermission" is not a permission that implements IUnrestrictedPermission // you need to change the fourth parameter to a zero. FrameSecurityDescriptor secObj = CodeAccessSecurityEngine.CheckNReturnSO( CodeAccessSecurityEngine.AssertPermissionToken, CodeAccessSecurityEngine.AssertPermission, ref stackMark, 1, 1); BCLDebug.Assert(secObj != null || !SecurityManager.SecurityEnabled, "Failure in SecurityRuntime.Assert() - secObj != null"); if (secObj == null) { if (SecurityManager.SecurityEnabled) { // Security: REQ_SQ flag is missing. Bad compiler ? throw new ExecutionEngineException(Environment.GetResourceString("ExecutionEngine_MissingSecurityDescriptor")); } } else { if (secObj.GetAssertions() != null) { throw new SecurityException(Environment.GetResourceString("Security_MustRevertOverride")); } secObj.SetAssert(permSet); } }
[System.Security.SecurityCritical] // auto-generated internal static void Assert(CodeAccessPermission cap, ref StackCrawlMark stackMark) { // Make sure the caller of assert has the permission to assert //WARNING: The placement of the call here is just right to check // the appropriate frame. // Note: if the "AssertPermission" is not a permission that implements IUnrestrictedPermission // you need to change the last parameter to a zero. Contract.Assert(AssertPermissionToken != null && AssertPermission != null, "Assert Permission not setup correctly"); FrameSecurityDescriptor secObj = CheckNReturnSO(AssertPermissionToken, AssertPermission, ref stackMark, 1); if (secObj == null) { // Security: REQ_SQ flag is missing. Bad compiler ? // This can happen when you create delegates over functions that need the REQ_SQ System.Environment.FailFast(Environment.GetResourceString("ExecutionEngine_MissingSecurityDescriptor")); } else { if (secObj.HasImperativeAsserts()) { throw new SecurityException(Environment.GetResourceString("Security_MustRevertOverride")); } secObj.SetAssert(cap); } }
internal virtual void Assert(CodeAccessPermission cap, ref StackCrawlMark stackMark) { // Make sure the caller of assert has the permission to assert //WARNING: The placement of the call here is just right to check // the appropriate frame. // Note: if the "AssertPermission" is not a permission that implements IUnrestrictedPermission // you need to change the last parameter to a zero. FrameSecurityDescriptor secObj = CheckNReturnSO(AssertPermissionToken, AssertPermission, ref stackMark, 1, 1); if (secObj == null) { if (SecurityManager.SecurityEnabled) { // Security: REQ_SQ flag is missing. Bad compiler ? // This can happen when you create delegates over functions that need the REQ_SQ throw new ExecutionEngineException(Environment.GetResourceString("ExecutionEngine_MissingSecurityDescriptor")); } } else { if (secObj.GetAssertions() != null) { throw new SecurityException(Environment.GetResourceString("Security_MustRevertOverride")); } secObj.SetAssert(cap); } }
[System.Security.SecurityCritical] // auto-generated internal static void Assert(PermissionSet permSet, ref StackCrawlMark stackMark) { // Note: if the "AssertPermission" is not a permission that implements IUnrestrictedPermission // you need to change the fourth parameter to a zero. FrameSecurityDescriptor secObj = CodeAccessSecurityEngine.CheckNReturnSO( CodeAccessSecurityEngine.AssertPermissionToken, CodeAccessSecurityEngine.AssertPermission, ref stackMark, 1); Contract.Assert(secObj != null, "Failure in SecurityRuntime.Assert() - secObj != null"); if (secObj == null) { // Security: REQ_SQ flag is missing. Bad compiler ? System.Environment.FailFast(Environment.GetResourceString("ExecutionEngine_MissingSecurityDescriptor")); } else { if (secObj.HasImperativeAsserts()) { throw new SecurityException(Environment.GetResourceString("Security_MustRevertOverride")); } secObj.SetAssert(permSet); } }
internal static void Assert(PermissionSet permSet, ref StackCrawlMark stackMark) { FrameSecurityDescriptor frameSecurityDescriptor = CodeAccessSecurityEngine.CheckNReturnSO(CodeAccessSecurityEngine.AssertPermissionToken, CodeAccessSecurityEngine.AssertPermission, ref stackMark, 1); if (frameSecurityDescriptor == null) { Environment.FailFast(Environment.GetResourceString("ExecutionEngine_MissingSecurityDescriptor")); return; } if (frameSecurityDescriptor.HasImperativeAsserts()) { throw new SecurityException(Environment.GetResourceString("Security_MustRevertOverride")); } frameSecurityDescriptor.SetAssert(permSet); }
internal static void Assert(CodeAccessPermission cap, ref StackCrawlMark stackMark) { FrameSecurityDescriptor descriptor = CheckNReturnSO(AssertPermissionToken, AssertPermission, ref stackMark, 1); if (descriptor == null) { Environment.FailFast(Environment.GetResourceString("ExecutionEngine_MissingSecurityDescriptor")); } else { if (descriptor.HasImperativeAsserts()) { throw new SecurityException(Environment.GetResourceString("Security_MustRevertOverride")); } descriptor.SetAssert(cap); } }