Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -1,43 +0,0 @@
//
// System.Security.AllowPartiallyTrustedCallersAttribute implementation
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2003, 2004 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Security {
[ComVisible (true)]
[AttributeUsage (AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed class AllowPartiallyTrustedCallersAttribute : Attribute {
public AllowPartiallyTrustedCallersAttribute ()
: base ()
{
}
}
}

View File

@@ -58,50 +58,6 @@ namespace System.Security {
new PermissionSet (this).Assert ();
}
internal bool CheckAssert (CodeAccessPermission asserted)
{
if (asserted == null)
return false;
if (asserted.GetType () != this.GetType ())
return false;
return IsSubsetOf (asserted);
}
internal bool CheckDemand (CodeAccessPermission target)
{
if (target == null)
return false;
if (target.GetType () != this.GetType ())
return false;
return IsSubsetOf (target);
}
internal bool CheckDeny (CodeAccessPermission denied)
{
if (denied == null)
return true;
Type t = denied.GetType ();
if (t != this.GetType ())
return true;
IPermission inter = Intersect (denied);
if (inter == null)
return true;
// sadly that's not enough :( at this stage we must also check
// if an empty (PermissionState.None) is a subset of the denied
// (which is like a empty intersection looks like for flag based
// permissions, e.g. AspNetHostingPermission).
return denied.IsSubsetOf (PermissionBuilder.Create (t));
}
internal bool CheckPermitOnly (CodeAccessPermission target)
{
if (target == null)
return false;
if (target.GetType () != this.GetType ())
return false;
return IsSubsetOf (target);
}
public abstract IPermission Copy ();
public void Demand ()
@@ -169,28 +125,7 @@ namespace System.Security {
{
if (!SecurityManager.SecurityEnabled)
return;
SecurityFrame sf = new SecurityFrame (1);
bool revert = false;
if ((sf.Assert != null) && !sf.Assert.DeclarativeSecurity) {
revert = true;
throw new NotSupportedException ("Currently only declarative Assert are supported.");
}
if ((sf.Deny != null) && !sf.Deny.DeclarativeSecurity) {
revert = true;
throw new NotSupportedException ("Currently only declarative Deny are supported.");
}
if ((sf.PermitOnly != null) && !sf.PermitOnly.DeclarativeSecurity) {
revert = true;
throw new NotSupportedException ("Currently only declarative PermitOnly are supported.");
}
if (!revert) {
string msg = Locale.GetText ("No stack modifiers are present on the current stack frame.");
// FIXME: we don't (yet) support imperative stack modifiers
msg += Environment.NewLine + "Currently only declarative stack modifiers are supported.";
throw new ExecutionEngineException (msg);
}
throw new NotImplementedException ();
}
[MonoTODO ("CAS support is experimental (and unsupported). Imperative mode is not implemented.")]
@@ -198,14 +133,7 @@ namespace System.Security {
{
if (!SecurityManager.SecurityEnabled)
return;
SecurityFrame sf = new SecurityFrame (1);
if ((sf.Assert != null) && !sf.Assert.DeclarativeSecurity) {
throw new NotSupportedException ("Currently only declarative Assert are supported.");
} else {
// we can't revert declarative security (or an empty frame) imperatively
ThrowExecutionEngineException (SecurityAction.Assert);
}
throw new NotImplementedException ();
}
[MonoTODO ("CAS support is experimental (and unsupported). Imperative mode is not implemented.")]
@@ -213,14 +141,7 @@ namespace System.Security {
{
if (!SecurityManager.SecurityEnabled)
return;
SecurityFrame sf = new SecurityFrame (1);
if ((sf.Deny != null) && !sf.Deny.DeclarativeSecurity) {
throw new NotSupportedException ("Currently only declarative Deny are supported.");
} else {
// we can't revert declarative security (or an empty frame) imperatively
ThrowExecutionEngineException (SecurityAction.Deny);
}
throw new NotImplementedException ();
}
[MonoTODO ("CAS support is experimental (and unsupported). Imperative mode is not implemented.")]
@@ -228,14 +149,7 @@ namespace System.Security {
{
if (!SecurityManager.SecurityEnabled)
return;
SecurityFrame sf = new SecurityFrame (1);
if ((sf.PermitOnly != null) && sf.PermitOnly.DeclarativeSecurity) {
throw new NotSupportedException ("Currently only declarative PermitOnly are supported.");
} else {
// we can't revert declarative security (or an empty frame) imperatively
ThrowExecutionEngineException (SecurityAction.PermitOnly);
}
throw new NotImplementedException ();
}
// Internal helpers methods
@@ -313,80 +227,11 @@ namespace System.Security {
return (String.Compare (value, Boolean.TrueString, true, CultureInfo.InvariantCulture) == 0);
}
internal bool ProcessFrame (SecurityFrame frame)
{
// 1. CheckPermitOnly
if (frame.PermitOnly != null) {
// the demanded permission must be in one of the permitted...
bool permit = frame.PermitOnly.IsUnrestricted ();
if (!permit) {
// check individual permissions
foreach (IPermission p in frame.PermitOnly) {
if (CheckPermitOnly (p as CodeAccessPermission)) {
permit = true;
break;
}
}
}
if (!permit) {
// ...or else we throw
ThrowSecurityException (this, "PermitOnly", frame, SecurityAction.Demand, null);
}
}
// 2. CheckDeny
if (frame.Deny != null) {
// special case where everything is denied (i.e. no child to be processed)
if (frame.Deny.IsUnrestricted ())
ThrowSecurityException (this, "Deny", frame, SecurityAction.Demand, null);
foreach (IPermission p in frame.Deny) {
if (!CheckDeny (p as CodeAccessPermission))
ThrowSecurityException (this, "Deny", frame, SecurityAction.Demand, p);
}
}
// 3. CheckAssert
if (frame.Assert != null) {
if (frame.Assert.IsUnrestricted ())
return true; // remove permission and continue stack walk
foreach (IPermission p in frame.Assert) {
if (CheckAssert (p as CodeAccessPermission)) {
return true; // remove permission and continue stack walk
}
}
}
// continue the stack walk
return false;
}
internal static void ThrowInvalidPermission (IPermission target, Type expected)
{
string msg = Locale.GetText ("Invalid permission type '{0}', expected type '{1}'.");
msg = String.Format (msg, target.GetType (), expected);
throw new ArgumentException (msg, "target");
}
internal static void ThrowExecutionEngineException (SecurityAction stackmod)
{
string msg = Locale.GetText ("No {0} modifier is present on the current stack frame.");
// FIXME: we don't (yet) support imperative stack modifiers
msg += Environment.NewLine + "Currently only declarative stack modifiers are supported.";
throw new ExecutionEngineException (String.Format (msg, stackmod));
}
internal static void ThrowSecurityException (object demanded, string message, SecurityFrame frame,
SecurityAction action, IPermission failed)
{
#if NET_2_1
throw new SecurityException (message);
#else
Assembly a = frame.Assembly;
throw new SecurityException (Locale.GetText (message),
a.UnprotectedGetName (), a.GrantedPermissionSet,
a.DeniedPermissionSet, frame.Method, action, demanded,
failed, a.UnprotectedGetEvidence ());
#endif
}
}
}

View File

@@ -234,34 +234,6 @@ namespace System.Security {
// special case when directly called from CodeAccessPermission.Demand
_ignored = new bool [list.Count];
}
ArrayList frames = SecurityFrame.GetStack (skip);
if ((frames != null) && (frames.Count > 0)) {
SecurityFrame first = ((SecurityFrame) frames [0]);
current = first.Assembly;
domain = first.Domain;
// skip ourself, Demand and other security runtime methods
foreach (SecurityFrame sf in frames) {
if (ProcessFrame (sf, ref current, ref domain)) {
if (AllIgnored ())
return; // reached Assert
}
}
SecurityFrame last = ((SecurityFrame) frames [frames.Count - 1]);
CheckAssembly (current, last);
CheckAppDomain (domain, last);
}
// Is there a CompressedStack to handle ?
CompressedStack stack = Thread.CurrentThread.GetCompressedStack ();
if ((stack != null) && !stack.IsEmpty ()) {
foreach (SecurityFrame frame in stack.List) {
if (ProcessFrame (frame, ref current, ref domain)) {
if (AllIgnored ())
return; // reached Assert
}
}
}
}
[MonoTODO ("CAS support is experimental (and unsupported). Imperative mode is not implemented.")]
@@ -681,65 +653,6 @@ namespace System.Security {
return true;
}
internal bool ProcessFrame (SecurityFrame frame, ref Assembly current, ref AppDomain domain)
{
if (IsUnrestricted ()) {
// we request unrestricted
if (frame.Deny != null) {
// but have restrictions (some denied permissions)
CodeAccessPermission.ThrowSecurityException (this, "Deny", frame, SecurityAction.Demand, null);
} else if ((frame.PermitOnly != null) && !frame.PermitOnly.IsUnrestricted ()) {
// but have restrictions (only some permitted permissions)
CodeAccessPermission.ThrowSecurityException (this, "PermitOnly", frame, SecurityAction.Demand, null);
}
}
// skip next steps if no Assert, Deny or PermitOnly are present
if (frame.HasStackModifiers) {
for (int i = 0; i < list.Count; i++) {
CodeAccessPermission cap = (CodeAccessPermission) list [i];
if (cap.ProcessFrame (frame)) {
_ignored [i] = true; // asserted
if (AllIgnored ())
return true; // no more, abort stack walk!
}
}
}
// however the "final" grant set is resolved by assembly, so
// there's no need to check it every time (just when we're
// changing assemblies between frames).
if (frame.Assembly != current) {
CheckAssembly (current, frame);
current = frame.Assembly;
}
if (frame.Domain != domain) {
CheckAppDomain (domain, frame);
domain = frame.Domain;
}
return false;
}
internal void CheckAssembly (Assembly a, SecurityFrame frame)
{
IPermission p = SecurityManager.CheckPermissionSet (a, this, false);
if (p != null) {
CodeAccessPermission.ThrowSecurityException (this, "Demand failed assembly permissions checks.",
frame, SecurityAction.Demand, p);
}
}
internal void CheckAppDomain (AppDomain domain, SecurityFrame frame)
{
IPermission p = SecurityManager.CheckPermissionSet (domain, this);
if (p != null) {
CodeAccessPermission.ThrowSecurityException (this, "Demand failed appdomain permissions checks.",
frame, SecurityAction.Demand, p);
}
}
// 2.0 metadata format
internal static PermissionSet CreateFromBinaryFormat (byte[] data)

View File

@@ -1,209 +0,0 @@
//
// System.Security.SecurityContext class
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Security.Principal;
using System.Threading;
namespace System.Security {
public sealed class SecurityContext
: IDisposable
{
private bool _capture;
private IntPtr _winid;
#if !MOBILE
private CompressedStack _stack;
#endif
private bool _suppressFlowWindowsIdentity;
private bool _suppressFlow;
internal SecurityContext ()
{
}
// copy constructor
internal SecurityContext (SecurityContext sc)
{
_capture = true;
#if !MOBILE
_winid = sc._winid;
if (sc._stack != null)
_stack = sc._stack.CreateCopy ();
#endif
}
public SecurityContext CreateCopy ()
{
if (!_capture)
throw new InvalidOperationException ();
return new SecurityContext (this);
}
// static methods
static public SecurityContext Capture ()
{
#if !MOBILE
SecurityContext sc = Thread.CurrentThread.ExecutionContext.SecurityContext;
if (sc.FlowSuppressed)
return null;
#endif
SecurityContext capture = new SecurityContext ();
capture._capture = true;
#if !MOBILE
capture._winid = WindowsIdentity.GetCurrentToken ();
capture._stack = CompressedStack.Capture ();
#endif
return capture;
}
public void Dispose ()
{
}
// internal stuff
internal bool FlowSuppressed {
get { return _suppressFlow; }
set { _suppressFlow = value; }
}
internal bool WindowsIdentityFlowSuppressed {
get { return _suppressFlowWindowsIdentity; }
set { _suppressFlowWindowsIdentity = value; }
}
#if !MOBILE
internal CompressedStack CompressedStack {
get { return _stack; }
set { _stack = value; }
}
#endif
internal IntPtr IdentityToken {
get { return _winid; }
set { _winid = value; }
}
// Suppressing the SecurityContext flow wasn't required before 2.0
static public bool IsFlowSuppressed ()
{
#if MOBILE
return false;
#else
return Thread.CurrentThread.ExecutionContext.SecurityContext.FlowSuppressed;
#endif
}
static public bool IsWindowsIdentityFlowSuppressed ()
{
#if MOBILE
return false;
#else
return Thread.CurrentThread.ExecutionContext.SecurityContext.WindowsIdentityFlowSuppressed;
#endif
}
static public void RestoreFlow ()
{
#if !MOBILE
SecurityContext sc = Thread.CurrentThread.ExecutionContext.SecurityContext;
// if nothing is suppressed then throw
if (!sc.FlowSuppressed && !sc.WindowsIdentityFlowSuppressed)
throw new InvalidOperationException ();
sc.FlowSuppressed = false;
sc.WindowsIdentityFlowSuppressed = false;
#endif
}
// if you got the context then you can use it
[SecurityPermission (SecurityAction.Assert, ControlPrincipal = true)]
[SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
static public void Run (SecurityContext securityContext, ContextCallback callback, object state)
{
if (securityContext == null) {
throw new InvalidOperationException (Locale.GetText (
"Null SecurityContext"));
}
#if MOBILE
callback (state);
#else
SecurityContext sc = Thread.CurrentThread.ExecutionContext.SecurityContext;
IPrincipal original = Thread.CurrentPrincipal;
try {
if (sc.IdentityToken != IntPtr.Zero) {
Thread.CurrentPrincipal = new WindowsPrincipal (new WindowsIdentity (sc.IdentityToken));
}
// FIXME: is the security manager isn't active then we may not have
// a compressed stack (bug #78652)
if (securityContext.CompressedStack != null)
CompressedStack.Run (securityContext.CompressedStack, callback, state);
else
callback (state);
}
finally {
if ((original != null) && (sc.IdentityToken != IntPtr.Zero))
Thread.CurrentPrincipal = original;
}
#endif
}
[SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
static public AsyncFlowControl SuppressFlow ()
{
#if MOBILE
throw new NotSupportedException ();
#else
Thread t = Thread.CurrentThread;
// suppress both flows
t.ExecutionContext.SecurityContext.FlowSuppressed = true;
t.ExecutionContext.SecurityContext.WindowsIdentityFlowSuppressed = true;
return new AsyncFlowControl (t, AsyncFlowControlType.Security);
#endif
}
static public AsyncFlowControl SuppressFlowWindowsIdentity ()
{
#if MOBILE
throw new NotSupportedException ();
#else
Thread t = Thread.CurrentThread;
t.ExecutionContext.SecurityContext.WindowsIdentityFlowSuppressed = true;
return new AsyncFlowControl (t, AsyncFlowControlType.Security);
#endif
}
}
}

View File

@@ -1,37 +0,0 @@
//
// System.Security.SecurityContextSource
//
// Author:
// Jb Evain <jbevain@novell.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Security {
public enum SecurityContextSource {
CurrentAppDomain,
CurrentAssembly,
}
}

View File

@@ -1,80 +0,0 @@
//
// System.Security.SecurityCriticalAttribute implementation
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005, 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Security {
#if NET_2_1
[AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property |
AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate,
AllowMultiple=false, Inherited=false)]
public sealed class SecurityCriticalAttribute : Attribute {
public SecurityCriticalAttribute ()
{
}
}
#else
[MonoTODO ("Only supported by the runtime when CoreCLR is enabled")]
[AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method |
AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Delegate,
AllowMultiple=false, Inherited=false)]
public sealed class SecurityCriticalAttribute : Attribute {
private SecurityCriticalScope _scope;
public SecurityCriticalAttribute ()
: base ()
{
_scope = SecurityCriticalScope.Explicit;
}
public SecurityCriticalAttribute (SecurityCriticalScope scope)
: base ()
{
switch (scope) {
case SecurityCriticalScope.Everything:
_scope = SecurityCriticalScope.Everything;
break;
default:
// that includes all bad enums values
_scope = SecurityCriticalScope.Explicit;
break;
}
}
[Obsolete]
public SecurityCriticalScope Scope {
get { return _scope; }
}
}
#endif
}

View File

@@ -1,37 +0,0 @@
//
// System.Security.SecurityCriticalScope enum
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Security {
[Obsolete]
public enum SecurityCriticalScope {
Explicit,
Everything
}
}

View File

@@ -33,11 +33,19 @@ using System.Globalization;
using System.Collections;
using System.Runtime.InteropServices;
using System.Text;
using System.Diagnostics.Contracts;
using Mono.Xml;
namespace System.Security {
internal enum SecurityElementType
{
Regular = 0,
Format = 1,
Comment = 2
}
[ComVisible (true)]
[Serializable]
public sealed class SecurityElement
@@ -454,5 +462,64 @@ namespace System.Security {
}
return null;
}
internal string m_strTag {
get {
return tag;
}
}
internal string m_strText {
get {
return text;
}
set {
text = value;
}
}
internal ArrayList m_lAttributes {
get {
return attributes;
}
}
internal ArrayList InternalChildren {
get {
return children;
}
}
internal String SearchForTextOfLocalName(String strLocalName)
{
// Search on each child in order and each
// child's child, depth-first
if (strLocalName == null)
throw new ArgumentNullException( "strLocalName" );
Contract.EndContractBlock();
// Note: we don't check for a valid tag here because
// an invalid tag simply won't be found.
// First we check this.
if (tag == null) return null;
if (tag.Equals( strLocalName ) || tag.EndsWith( ":" + strLocalName, StringComparison.Ordinal ))
return Unescape( text );
if (children == null)
return null;
IEnumerator enumerator = children.GetEnumerator();
while (enumerator.MoveNext())
{
String current = ((SecurityElement)enumerator.Current).SearchForTextOfLocalName( strLocalName );
if (current != null)
return current;
}
return null;
}
}
}

View File

@@ -41,147 +41,4 @@ namespace System.Security {
public int size;
public int index;
}
// Must match MonoSecurityFrame in /mono/mini/declsec.h
#pragma warning disable 649
internal class RuntimeSecurityFrame {
public AppDomain domain;
public MethodInfo method;
public RuntimeDeclSecurityEntry assert;
public RuntimeDeclSecurityEntry deny;
public RuntimeDeclSecurityEntry permitonly;
}
#pragma warning restore 649
internal struct SecurityFrame {
private AppDomain _domain;
private MethodInfo _method;
private PermissionSet _assert;
private PermissionSet _deny;
private PermissionSet _permitonly;
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern static RuntimeSecurityFrame _GetSecurityFrame (int skip);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern static Array _GetSecurityStack (int skip);
internal SecurityFrame (RuntimeSecurityFrame frame)
{
_domain = null;
_method = null;
_assert = null;
_deny = null;
_permitonly = null;
InitFromRuntimeFrame (frame);
}
internal SecurityFrame (int skip)
{
_domain = null;
_method = null;
_assert = null;
_deny = null;
_permitonly = null;
InitFromRuntimeFrame (_GetSecurityFrame (skip + 2));
// TODO - add the imperative informations into the frame
}
// Note: SecurityManager.Decode implements a cache - so not every call
// ends up making an icall
internal void InitFromRuntimeFrame (RuntimeSecurityFrame frame)
{
_domain = frame.domain;
_method = frame.method;
if (frame.assert.size > 0) {
_assert = SecurityManager.Decode (frame.assert.blob, frame.assert.size);
}
if (frame.deny.size > 0) {
_deny = SecurityManager.Decode (frame.deny.blob, frame.deny.size);
}
if (frame.permitonly.size > 0) {
_permitonly = SecurityManager.Decode (frame.permitonly.blob, frame.permitonly.size);
}
}
public Assembly Assembly {
get { return _method.ReflectedType.Assembly; }
}
public AppDomain Domain {
get { return _domain; }
}
public MethodInfo Method {
get { return _method; }
}
public PermissionSet Assert {
get { return _assert; }
}
public PermissionSet Deny {
get { return _deny; }
}
public PermissionSet PermitOnly {
get { return _permitonly; }
}
public bool HasStackModifiers {
get { return ((_assert != null) || (_deny != null) || (_permitonly != null)); }
}
public bool Equals (SecurityFrame sf)
{
if (!Object.ReferenceEquals (_domain, sf.Domain))
return false;
if (Assembly.ToString () != sf.Assembly.ToString ())
return false;
if (Method.ToString () != sf.Method.ToString ())
return false;
if ((_assert != null) && !_assert.Equals (sf.Assert))
return false;
if ((_deny != null) && !_deny.Equals (sf.Deny))
return false;
if ((_permitonly != null) && !_permitonly.Equals (sf.PermitOnly))
return false;
return true;
}
public override string ToString ()
{
StringBuilder sb = new StringBuilder ();
sb.AppendFormat ("Frame: {0}{1}", _method, Environment.NewLine);
sb.AppendFormat ("\tAppDomain: {0}{1}", Domain, Environment.NewLine);
sb.AppendFormat ("\tAssembly: {0}{1}", Assembly, Environment.NewLine);
if (_assert != null)
sb.AppendFormat ("\tAssert: {0}{1}", _assert, Environment.NewLine);
if (_deny != null)
sb.AppendFormat ("\tDeny: {0}{1}", _deny, Environment.NewLine);
if (_permitonly != null)
sb.AppendFormat ("\tPermitOnly: {0}{1}", _permitonly, Environment.NewLine);
return sb.ToString ();
}
static public ArrayList GetStack (int skipFrames)
{
Array stack = _GetSecurityStack (skipFrames+2);
ArrayList al = new ArrayList ();
for (int i = 0; i < stack.Length; i++) {
object o = stack.GetValue (i);
// null are unused slots allocated in the runtime
if (o == null)
break;
al.Add (new SecurityFrame ((RuntimeSecurityFrame)o));
}
return al;
}
}
}

View File

@@ -71,13 +71,12 @@ namespace System.Security {
// properties
[Obsolete]
extern public static bool CheckExecutionRights {
[MethodImplAttribute (MethodImplOptions.InternalCall)]
get;
[MethodImplAttribute (MethodImplOptions.InternalCall)]
[SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
set;
public static bool CheckExecutionRights {
get {
return false;
}
set {
}
}
[Obsolete ("The security manager cannot be turned off on MS runtime")]
@@ -154,68 +153,6 @@ namespace System.Security {
return true;
}
internal static IPermission CheckPermissionSet (Assembly a, PermissionSet ps, bool noncas)
{
if (ps.IsEmpty ())
return null;
foreach (IPermission p in ps) {
// note: this may contains non CAS permissions
if ((!noncas) && (p is CodeAccessPermission)) {
if (!IsGranted (a, p))
return p;
} else {
// but non-CAS will throw on failure...
try {
p.Demand ();
}
catch (SecurityException) {
// ... so we catch
return p;
}
}
}
return null;
}
internal static IPermission CheckPermissionSet (AppDomain ad, PermissionSet ps)
{
if ((ps == null) || ps.IsEmpty ())
return null;
PermissionSet granted = ad.GrantedPermissionSet;
if (granted == null)
return null;
if (granted.IsUnrestricted ())
return null;
if (ps.IsUnrestricted ())
return new SecurityPermission (SecurityPermissionFlag.NoFlags);
foreach (IPermission p in ps) {
if (p is CodeAccessPermission) {
CodeAccessPermission grant = (CodeAccessPermission) granted.GetPermission (p.GetType ());
if (grant == null) {
if (!granted.IsUnrestricted () || !(p is IUnrestrictedPermission)) {
if (!p.IsSubsetOf (null))
return p;
}
} else if (!p.IsSubsetOf (grant)) {
return p;
}
} else {
// but non-CAS will throw on failure...
try {
p.Demand ();
}
catch (SecurityException) {
// ... so we catch
return p;
}
}
}
return null;
}
[Obsolete]
[SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
public static PolicyLevel LoadPolicyLevelFromFile (string path, PolicyLevelType type)
@@ -529,179 +466,6 @@ namespace System.Security {
}
}
// security check when using reflection
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static unsafe extern bool GetLinkDemandSecurity (MethodBase method, RuntimeDeclSecurityActions *cdecl, RuntimeDeclSecurityActions *mdecl);
// When using reflection LinkDemand are promoted to full Demand (i.e. stack walk)
internal unsafe static void ReflectedLinkDemandInvoke (MethodBase mb)
{
RuntimeDeclSecurityActions klass;
RuntimeDeclSecurityActions method;
if (!GetLinkDemandSecurity (mb, &klass, &method))
return;
PermissionSet ps = null;
if (klass.cas.size > 0) {
ps = Decode (klass.cas.blob, klass.cas.size);
}
if (klass.noncas.size > 0) {
PermissionSet p = Decode (klass.noncas.blob, klass.noncas.size);
ps = (ps == null) ? p : ps.Union (p);
}
if (method.cas.size > 0) {
PermissionSet p = Decode (method.cas.blob, method.cas.size);
ps = (ps == null) ? p : ps.Union (p);
}
if (method.noncas.size > 0) {
PermissionSet p = Decode (method.noncas.blob, method.noncas.size);
ps = (ps == null) ? p : ps.Union (p);
}
// in this case we union-ed the permission sets because we want to do
// a single stack walk (not up to 4).
if (ps != null)
ps.Demand ();
}
internal unsafe static bool ReflectedLinkDemandQuery (MethodBase mb)
{
RuntimeDeclSecurityActions klass;
RuntimeDeclSecurityActions method;
if (!GetLinkDemandSecurity (mb, &klass, &method))
return true;
return LinkDemand (mb.ReflectedType.Assembly, &klass, &method);
}
private unsafe static bool LinkDemand (Assembly a, RuntimeDeclSecurityActions *klass, RuntimeDeclSecurityActions *method)
{
try {
PermissionSet ps = null;
bool result = true;
if (klass->cas.size > 0) {
ps = Decode (klass->cas.blob, klass->cas.size);
result = (SecurityManager.CheckPermissionSet (a, ps, false) == null);
}
if (result && (klass->noncas.size > 0)) {
ps = Decode (klass->noncas.blob, klass->noncas.size);
result = (SecurityManager.CheckPermissionSet (a, ps, true) == null);
}
if (result && (method->cas.size > 0)) {
ps = Decode (method->cas.blob, method->cas.size);
result = (SecurityManager.CheckPermissionSet (a, ps, false) == null);
}
if (result && (method->noncas.size > 0)) {
ps = Decode (method->noncas.blob, method->noncas.size);
result = (SecurityManager.CheckPermissionSet (a, ps, true) == null);
}
return result;
}
catch (SecurityException) {
return false;
}
}
#pragma warning disable 169
private static bool LinkDemandFullTrust (Assembly a)
{
// FullTrust is immutable (and means Unrestricted)
// so we can skip the subset operations and jump to IsUnrestricted.
PermissionSet granted = a.GrantedPermissionSet;
if ((granted != null) && !granted.IsUnrestricted ())
return false;
PermissionSet denied = a.DeniedPermissionSet;
if ((denied != null) && !denied.IsEmpty ())
return false;
return true;
}
private static bool LinkDemandUnmanaged (Assembly a)
{
// note: we know that UnmanagedCode (SecurityPermission) implements IUnrestrictedPermission
return IsGranted (a, UnmanagedCode);
}
// we try to provide as much details as possible to help debugging
private static void LinkDemandSecurityException (int securityViolation, IntPtr methodHandle)
{
RuntimeMethodHandle runtimeHandle = new RuntimeMethodHandle (methodHandle);
MethodInfo method = (MethodInfo)(MethodBase.GetMethodFromHandle (runtimeHandle));
Assembly a = method.DeclaringType.Assembly;
string message = null;
AssemblyName an = null;
PermissionSet granted = null;
PermissionSet refused = null;
object demanded = null;
IPermission failed = null;
if (a != null) {
an = a.UnprotectedGetName ();
granted = a.GrantedPermissionSet;
refused = a.DeniedPermissionSet;
}
switch (securityViolation) {
case 1: // MONO_JIT_LINKDEMAND_PERMISSION
message = Locale.GetText ("Permissions refused to call this method.");
break;
case 2: // MONO_JIT_LINKDEMAND_APTC
message = Locale.GetText ("Partially trusted callers aren't allowed to call into this assembly.");
demanded = (object) DefaultPolicies.FullTrust; // immutable
break;
case 4: // MONO_JIT_LINKDEMAND_ECMA
message = Locale.GetText ("Calling internal calls is restricted to ECMA signed assemblies.");
break;
case 8: // MONO_JIT_LINKDEMAND_PINVOKE
message = Locale.GetText ("Calling unmanaged code isn't allowed from this assembly.");
demanded = (object) _unmanagedCode;
failed = _unmanagedCode;
break;
default:
message = Locale.GetText ("JIT time LinkDemand failed.");
break;
}
throw new SecurityException (message, an, granted, refused, method, SecurityAction.LinkDemand, demanded, failed, null);
}
private static void InheritanceDemandSecurityException (int securityViolation, Assembly a, Type t, MethodInfo method)
{
string message = null;
AssemblyName an = null;
PermissionSet granted = null;
PermissionSet refused = null;
if (a != null) {
an = a.UnprotectedGetName ();
granted = a.GrantedPermissionSet;
refused = a.DeniedPermissionSet;
}
switch (securityViolation) {
case 1: // MONO_METADATA_INHERITANCEDEMAND_CLASS
message = String.Format (Locale.GetText ("Class inheritance refused for {0}."), t);
break;
case 2: // MONO_METADATA_INHERITANCEDEMAND_CLASS
message = Locale.GetText ("Method override refused.");
break;
default:
message = Locale.GetText ("Load time InheritDemand failed.");
break;
}
throw new SecurityException (message, an, granted, refused, method, SecurityAction.InheritanceDemand, null, null, null);
}
// called by the runtime when CoreCLR is enabled
private static void ThrowException (Exception ex)
@@ -709,58 +473,6 @@ namespace System.Security {
throw ex;
}
// internal - get called by the class loader
// Called when
// - class inheritance
// - method overrides
private unsafe static bool InheritanceDemand (AppDomain ad, Assembly a, RuntimeDeclSecurityActions *actions)
{
try {
PermissionSet ps = null;
bool result = true;
if (actions->cas.size > 0) {
ps = Decode (actions->cas.blob, actions->cas.size);
result = (SecurityManager.CheckPermissionSet (a, ps, false) == null);
if (result) {
// also check appdomain
result = (SecurityManager.CheckPermissionSet (ad, ps) == null);
}
}
if (actions->noncas.size > 0) {
ps = Decode (actions->noncas.blob, actions->noncas.size);
result = (SecurityManager.CheckPermissionSet (a, ps, true) == null);
if (result) {
// also check appdomain
result = (SecurityManager.CheckPermissionSet (ad, ps) == null);
}
}
return result;
}
catch (SecurityException) {
return false;
}
}
// internal - get called at JIT time
private static void DemandUnmanaged ()
{
UnmanagedCode.Demand ();
}
// internal - get called by JIT generated code
private static void InternalDemand (IntPtr permissions, int length)
{
PermissionSet ps = Decode (permissions, length);
ps.Demand ();
}
private static void InternalDemandChoice (IntPtr permissions, int length)
{
throw new SecurityException ("SecurityAction.DemandChoice was removed from 2.0");
}
#pragma warning restore 169
public static PermissionSet GetStandardSandbox (Evidence evidence)

View File

@@ -197,16 +197,6 @@ namespace System.Security {
throw new NotSupportedException ();
}
internal static void ReflectedLinkDemandInvoke (MethodBase mb)
{
throw new NotSupportedException ();
}
internal static bool ReflectedLinkDemandQuery (MethodBase mb)
{
throw new NotSupportedException ();
}
public static PermissionSet GetStandardSandbox (Evidence evidence)
{
if (evidence == null)

View File

@@ -1,39 +0,0 @@
//
// System.Security.SecurityRuleSet.cs
//
// Author:
// Marek Safar (marek.safar@gmail.com)
//
// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Security {
public enum SecurityRuleSet : byte
{
None = 0,
Level1 = 1,
Level2 = 2
}
}

View File

@@ -1,45 +0,0 @@
//
// System.Security.SecurityRulesAttribute.cs
//
// Author:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Security {
[AttributeUsage (AttributeTargets.Assembly, AllowMultiple=false)]
public sealed class SecurityRulesAttribute : Attribute
{
public SecurityRulesAttribute (SecurityRuleSet ruleSet)
{
RuleSet = ruleSet;
}
public SecurityRuleSet RuleSet { get; private set; }
public bool SkipVerificationInFullTrust { get; set; }
}
}

View File

@@ -1,41 +0,0 @@
//
// System.Security.SecuritySafeCriticalAttribute implementation
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005,2007,2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Security {
[MonoTODO ("Only supported by the runtime when CoreCLR is enabled")]
[AttributeUsage (AttributeTargets.Delegate | AttributeTargets.Interface | AttributeTargets.Field | AttributeTargets.Method |
AttributeTargets.Constructor | AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Class, AllowMultiple=false, Inherited=false)]
public sealed class SecuritySafeCriticalAttribute : Attribute {
public SecuritySafeCriticalAttribute ()
{
}
}
}

View File

@@ -1,39 +0,0 @@
//
// System.Security.SecurityTransparentAttribute implementation
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005, 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Security {
[MonoTODO ("Only supported by the runtime when CoreCLR is enabled")]
[AttributeUsage (AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed class SecurityTransparentAttribute : Attribute {
public SecurityTransparentAttribute ()
{
}
}
}

View File

@@ -1,44 +0,0 @@
//
// System.Security.SecurityTreatAsSafeAttribute implementation
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Security {
[AttributeUsage (AttributeTargets.Delegate | AttributeTargets.Interface | AttributeTargets.Field |
AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Enum | AttributeTargets.Struct |
AttributeTargets.Class | AttributeTargets.Assembly,
AllowMultiple=false, Inherited=false)]
[Obsolete ("Use the SecuritySafeCriticalAttribute instead")]
[MonoTODO ("Not supported by the runtime")]
public sealed class SecurityTreatAsSafeAttribute : Attribute {
public SecurityTreatAsSafeAttribute ()
: base ()
{
}
}
}

View File

@@ -1,40 +0,0 @@
//
// System.Security.SuppressUnmanagedCodeSecurityAttribute.cs
//
// Author:
// Nick Drochak(ndrochak@gol.com)
//
// (C) Nick Drochak
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Security {
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Method |
AttributeTargets.Interface | AttributeTargets.Delegate,
AllowMultiple=true, Inherited=false)]
[ComVisible (true)]
public sealed class SuppressUnmanagedCodeSecurityAttribute : Attribute {
}
}

View File

@@ -1,38 +0,0 @@
//
// System.Security.UnverifiableCodeAttribute.cs
//
// Author:
// Nick Drochak(ndrochak@gol.com)
//
// (C) Nick Drochak
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Security {
[ComVisible (true)]
[AttributeUsage (AttributeTargets.Module, AllowMultiple=true, Inherited=false)]
public sealed class UnverifiableCodeAttribute : Attribute {
}
}