Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2004-07-14 16:06:25 +0400
committerSebastien Pouliot <sebastien@ximian.com>2004-07-14 16:06:25 +0400
commit488ecc889f19750742ba6aa42d286899c26706f5 (patch)
tree324b03551b4c0e15e446e985277b609df42ccab5 /mcs/class/corlib/System.Security/SecurityException.cs
parent748a1ef357321b3f9153f06efb03d0a1091816ea (diff)
2004-07-14 Sebastien Pouliot <sebastien@ximian.com>
* CodeAccessPermission.cs: Added CheckAssert, CheckDemand, CheckDeny, CheckPermitOnly, Equals and GetHashCode to NET_2_0 profile. Actualized TODOs. Removed duplicate license. * NamedPermissionSet.cs: Added Equals/GetHashCode to NET_2_0 profile. Removed duplicate license. * PermissionSet.cs: Added Equals/GetHashCode to NET_2_0 profile. Removed duplicate license. * SecurityElement.cs: Added Copy and FromString methods to NET_2_0 profile. Removed duplicate license. * SecurityException.cs: Added new constructors and properties to NET_2_0 profile. Removed duplicate license. * SecurityManager.cs: Added GetZoneAndOrigin and ResolvePolicy to NET_2_0 profile. Removed duplicate license. * VerificationException.cs: Implements _Exception for NET_2_0 profile. Removed duplicate license. * XmlSyntaxException.cs: Implements _Exception for NET_2_0 profile. Removed duplicate license. svn path=/trunk/mcs/; revision=31128
Diffstat (limited to 'mcs/class/corlib/System.Security/SecurityException.cs')
-rw-r--r--mcs/class/corlib/System.Security/SecurityException.cs157
1 files changed, 122 insertions, 35 deletions
diff --git a/mcs/class/corlib/System.Security/SecurityException.cs b/mcs/class/corlib/System.Security/SecurityException.cs
index be1f5c2b476..b389066d1a4 100644
--- a/mcs/class/corlib/System.Security/SecurityException.cs
+++ b/mcs/class/corlib/System.Security/SecurityException.cs
@@ -3,36 +3,10 @@
//
// Authors:
// Nick Drochak(ndrochak@gol.com)
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) Nick Drochak
// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
-//
-
-//
-// Copyright (C) 2004 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.
-//
-
-//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
@@ -55,41 +29,126 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-using System.Runtime.Serialization;
using System.Globalization;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+using System.Security.Permissions;
+using System.Security.Policy;
using System.Text;
namespace System.Security {
[Serializable]
+#if NET_2_0
+ public class SecurityException : SystemException, _Exception {
+#else
public class SecurityException : SystemException {
-
+#endif
// Fields
string permissionState;
Type permissionType;
private string _granted;
private string _refused;
+#if NET_2_0
+ private SecurityAction _action;
+ private object _demanded;
+ private object _denyset;
+ private object _permitset;
+ private AssemblyName _assembly;
+ private IPermission _firstperm;
+ private IPermission _permfailed;
+ private MethodInfo _method;
+ private string _url;
+ private SecurityZone _zone;
+#endif
// Properties
- public string PermissionState
- {
+
+#if NET_2_0
+ public SecurityAction Action {
+ get { return _action; }
+ set { _action = value; }
+ }
+
+ public object Demanded {
+ get { return _demanded; }
+ set { _demanded = value; }
+ }
+
+ public object DenySetInstance {
+ get { return _denyset; }
+ set { _denyset = value; }
+ }
+
+ public AssemblyName FailedAssemblyInfo {
+ get { return _assembly; }
+ set { _assembly = value; }
+ }
+
+ public IPermission FirstPermissionThatFailed {
+ get { return _firstperm; }
+ set { _firstperm = value; }
+ }
+
+ public MethodInfo Method {
+ get { return _method; }
+ set { _method = value; }
+ }
+
+ [Obsolete]
+ public IPermission PermissionThatFailed {
+ get { return _permfailed; }
+ set { _permfailed = value; }
+ }
+
+ public object PermitOnlySetInstance {
+ get { return _permitset; }
+ set { _permitset = value; }
+ }
+
+ public string Url {
+ get { return _url; }
+ set { _url = value; }
+ }
+
+ public SecurityZone Zone {
+ get { return _zone; }
+ set { _zone = value; }
+ }
+#endif
+
+ public string PermissionState {
get { return permissionState; }
+#if NET_2_0
+ set { permissionState = value; }
+#endif
}
- public Type PermissionType
- {
+ public Type PermissionType {
get { return permissionType; }
+#if NET_2_0
+ set { permissionType = value; }
+#endif
}
-#if ! NET_1_0
+
+#if NET_1_1
public string GrantedSet {
get { return _granted; }
+#if NET_2_0
+ set { _granted = value; }
+#endif
}
public string RefusedSet {
get { return _refused; }
+#if NET_2_0
+ set { _refused = value; }
+#endif
}
#endif
// Constructors
+
public SecurityException ()
: base (Locale.GetText ("A security error has been detected."))
{
@@ -138,6 +197,34 @@ namespace System.Security {
_refused = refused.ToString ();
}
+#if NET_2_0
+ public SecurityException (string message, object deny, object permitOnly, MethodInfo method,
+ object demanded, IPermission permThatFailed)
+ : base (message)
+ {
+ _denyset = deny;
+ _permitset = permitOnly;
+ _method = method;
+ _demanded = demanded;
+ _permfailed = permThatFailed;
+ }
+
+ public SecurityException (string message, AssemblyName assemblyName, PermissionSet grant,
+ PermissionSet refused, MethodInfo method, SecurityAction action, object demanded,
+ IPermission permThatFailed, Evidence evidence)
+ : base (message)
+ {
+ _assembly = assemblyName;
+ _granted = grant.ToString ();
+ _refused = refused.ToString ();
+ _method = method;
+ _action = action;
+ _demanded = demanded;
+ _permfailed = permThatFailed;
+ // FIXME ? evidence ?
+ }
+#endif
+
// Methods
public override void GetObjectData (SerializationInfo info, StreamingContext context)
{
@@ -158,7 +245,7 @@ namespace System.Security {
sb.Append ("Type: ");
sb.Append (permissionType.ToString ());
}
-#if ! NET_1_0
+#if NET_1_1
if (_granted != null) {
sb.Append (Environment.NewLine);
sb.Append ("Granted: ");