+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.
+
2004-07-14 Sebastien Pouliot <sebastien@ximian.com>
* HostProtectionException.cs: New class in Fx 2.0.
// Authors:
// Miguel de Icaza (miguel@ximian.com)
// Nick Drochak, ndrochak@gol.com
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) Ximian, Inc. http://www.ximian.com
// Copyright (C) 2001 Nick Drochak, All Rights Reserved
// Portions (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
[Serializable]
public abstract class CodeAccessPermission : IPermission, ISecurityEncodable, IStackWalk {
- protected CodeAccessPermission () {}
+ protected CodeAccessPermission ()
+ {
+ }
// LAMESPEC: Documented as virtual
- [MonoTODO("SecurityStackFrame not ready")]
+ [MonoTODO]
public void Assert ()
{
- // throw a SecurityException if Assertion is denied
+ // Not everyone can assert freely so we must check for
+ // System.Security.Permissions.SecurityPermissionFlag.Assertion
new SecurityPermission (SecurityPermissionFlag.Assertion).Demand ();
-// SecurityStackFrame.Current.Assert = this;
+
+ // TODO: Only one Assert can be active in a stack frame
+ // throw new SecurityException (Locale.GetText (
+ // "Only one Assert can be active in a stack frame"));
+ }
+
+#if NET_2_0
+ public
+#else
+ internal
+#endif
+ virtual bool CheckAssert (CodeAccessPermission asserted)
+ {
+ if (asserted == null)
+ return false;
+ if (asserted.GetType() != this.GetType ())
+ return false;
+ return IsSubsetOf (asserted);
+ }
+
+#if NET_2_0
+ public
+#else
+ internal
+#endif
+ virtual bool CheckDemand (CodeAccessPermission target)
+ {
+ if (target == null)
+ return false;
+ if (target.GetType () != this.GetType ())
+ return false;
+ return IsSubsetOf (target);
+ }
+
+#if NET_2_0
+ public
+#else
+ internal
+#endif
+ virtual bool CheckDeny (CodeAccessPermission denied)
+ {
+ if (denied == null)
+ return true;
+ if (denied.GetType () != this.GetType ())
+ return true;
+ return (Intersect (denied) == null);
+ }
+
+#if NET_2_0
+ public
+#else
+ internal
+#endif
+ virtual bool CheckPermitOnly (CodeAccessPermission target)
+ {
+ if (target == null)
+ return false;
+ if (target.GetType () != this.GetType ())
+ return false;
+ return IsSubsetOf (target);
}
public abstract IPermission Copy ();
// LAMESPEC: Documented as virtual
- [MonoTODO("MS contralize demands, but I think we should branch back into indivual permission classes.")]
+ [MonoTODO ("MS centralize demands for IBuiltInPermission, but I think we should branch back into indivual permission classes.")]
public void Demand ()
{
IBuiltInPermission perm = (this as IBuiltInPermission);
if (perm == null)
return; // not sure about this :(
+ bool result = false;
+
// TODO : Loop the stack
+ // TODO : Loop all permission on the current frame
+ result = CheckDemand (this);
switch (perm.GetTokenIndex ()) {
case 0: // EnvironmentPermission
// TODO
string message = String.Format (Locale.GetText ("Unknown IBuiltInPermission #{0}"), perm.GetTokenIndex ());
throw new SecurityException (message);
}
+
+ if (!result) {
+ throw new SecurityException (Locale.GetText (
+ "Demand failed."));
+ }
}
// LAMESPEC: Documented as virtual
- [MonoTODO("SecurityStackFrame not ready")]
+ [MonoTODO]
public void Deny ()
{
-// SecurityStackFrame.Current.Deny = this;
}
+#if NET_2_0
+ public override bool Equals (object obj)
+ {
+ if (obj == null)
+ return false;
+ if (obj.GetType () != this.GetType ())
+ return false;
+ // TODO: compare
+ return true;
+ }
+#endif
+
public abstract void FromXml (SecurityElement elem);
+#if NET_2_0
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+#endif
+
public abstract IPermission Intersect (IPermission target);
public abstract bool IsSubsetOf (IPermission target);
}
// LAMESPEC: Documented as virtual
- [MonoTODO("SecurityStackFrame not ready")]
+ [MonoTODO]
public void PermitOnly ()
{
-// SecurityStackFrame.Current.PermitOnly = this;
}
- [MonoTODO("SecurityStackFrame not ready")]
+ [MonoTODO]
public static void RevertAll ()
{
-// SecurityStackFrame.Current.RevertAll ();
}
- [MonoTODO("SecurityStackFrame not ready")]
- public static void RevertAssert ()
+ [MonoTODO]
+ public static void RevertAssert ()
{
-// SecurityStackFrame.Current.RevertAssert ();
}
- [MonoTODO("SecurityStackFrame not ready")]
+ [MonoTODO]
public static void RevertDeny ()
{
-// SecurityStackFrame.Current.RevertDeny ();
}
- [MonoTODO("SecurityStackFrame not ready")]
- public static void RevertPermitOnly ()
+ [MonoTODO]
+ public static void RevertPermitOnly ()
{
-// SecurityStackFrame.Current.RevertPermitOnly ();
}
// snippet moved from FileIOPermission (nickd) to be reused in all derived classes
//
// Authors:
// Dan Lewis (dihlewis@yahoo.co.uk)
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002
// Portions (C) 2003, 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
[Serializable]
public sealed class NamedPermissionSet : PermissionSet {
+ private string name;
+ private string description;
+
// for PolicyLevel (to avoid validation duplication)
- internal NamedPermissionSet () : base () {}
+ internal NamedPermissionSet () : base ()
+ {
+ }
- public NamedPermissionSet (string name, PermissionSet set) : base (set)
+ public NamedPermissionSet (string name, PermissionSet set)
+ : base (set)
{
Name = name;
}
- public NamedPermissionSet (string name, PermissionState state) : base (state)
+ public NamedPermissionSet (string name, PermissionState state)
+ : base (state)
{
Name = name;
}
- public NamedPermissionSet (NamedPermissionSet set) : this (set.name, set) {}
+ public NamedPermissionSet (NamedPermissionSet set)
+ : this (set.name, set)
+ {
+ }
- public NamedPermissionSet (string name) : this (name, PermissionState.None) {}
+ public NamedPermissionSet (string name)
+ : this (name, PermissionState.None)
+ {
+ }
// properties
return se;
}
- // private
+#if NET_2_0
+ public override bool Equals (object obj)
+ {
+ if (obj == null)
+ return false;
+ NamedPermissionSet nps = (obj as NamedPermissionSet);
+ if (nps == null)
+ return false;
- private string name;
- private string description;
+ return ((name == nps.Name) && (description == nps.Description) && base.Equals (obj));
+ }
+
+ public override int GetHashCode ()
+ {
+ int hashcode = base.GetHashCode () ^ name.GetHashCode ();
+ if (description != null)
+ hashcode ^= description.GetHashCode ();
+ return hashcode;
+ }
+#endif
}
}
//
// Authors:
// Nick Drochak(ndrochak@gol.com)
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) Nick Drochak
// Portions (C) 2003, 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
private PermissionState state;
private ArrayList list;
+ private int _hashcode;
// constructors
{
}
+ internal void Clear ()
+ {
+ list.Clear ();
+ }
+
public virtual PermissionSet Copy ()
{
return new PermissionSet (this);
void IDeserializationCallback.OnDeserialization (object sender)
{
}
+
+#if NET_2_0
+ public override bool Equals (object obj)
+ {
+ if (obj == null)
+ return false;
+ PermissionSet ps = (obj as PermissionSet);
+ if (ps == null)
+ return false;
+ if (list.Count != ps.Count)
+ return false;
+
+ for (int i=0; i < list.Count; i++) {
+ bool found = false;
+ for (int j=0; i < ps.list.Count; j++) {
+ if (list [i].Equals (ps.list [j])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ return false;
+ }
+ return true;
+ }
+
+ public override int GetHashCode ()
+ {
+ if (_hashcode == 0) {
+ _hashcode = state.GetHashCode ();
+ foreach (IPermission p in list) {
+ _hashcode ^= p.GetHashCode ();
+ }
+ }
+ return _hashcode;
+ }
+
+ [MonoTODO ("what's it doing here?")]
+ static public void RevertAssert ()
+ {
+ }
+#endif
}
}
// System.Security.SecurityElement.cs
//
// Authors:
-// Miguel de Icaza (miguel@ximian.com)
-// Lawrence Pit (loz@cable.a2000.nl)
-// Sebastien Pouliot <spouliot@videotron.ca>
+// Miguel de Icaza (miguel@ximian.com)
+// Lawrence Pit (loz@cable.a2000.nl)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) Ximian, Inc. http://www.ximian.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
using System.Collections;
using System.Text;
+using Mono.Xml;
+
namespace System.Security
{
[Serializable]
this.Tag = tag;
this.Text = text;
}
+
+ // deep copy
+ internal SecurityElement (SecurityElement se)
+ {
+ this.Tag = se.Tag;
+ this.Text = se.Text;
+
+ if (se.attributes != null) {
+ foreach (SecurityAttribute sa in se.attributes) {
+ this.AddAttribute (sa.Name, sa.Value);
+ }
+ }
+ if (se.children != null) {
+ foreach (SecurityElement child in se.children) {
+ this.AddChild (new SecurityElement (child));
+ }
+ }
+ }
public Hashtable Attributes {
get {
return ((sa == null) ? null : sa.Value);
}
+#if NET_2_0
+ public SecurityElement Copy ()
+ {
+ return new SecurityElement (this);
+ }
+#endif
+
public bool Equal (SecurityElement other)
{
if (other == null)
return sb.ToString ();
}
+#if NET_2_0
+ static public SecurityElement FromString (string xml)
+ {
+ SecurityParser sp = new SecurityParser ();
+ sp.LoadXml (xml);
+ return sp.ToXml ();
+ }
+#endif
+
public static bool IsValidAttributeName (string name)
{
return name != null && name.IndexOfAny (invalid_attr_name_chars) == -1;
//
// 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
// 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."))
{
_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)
{
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: ");
//
// Authors:
// Nick Drochak(ndrochak@gol.com)
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) Nick Drochak
// Portions (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
_lockObject = new object ();
}
- private SecurityManager () {}
+ private SecurityManager ()
+ {
+ }
// properties
public static bool CheckExecutionRights {
get { return checkExecutionRights; }
- set {
+ set {
// throw a SecurityException if we don't have ControlPolicy permission
new SecurityPermission (SecurityPermissionFlag.ControlPolicy).Demand ();
checkExecutionRights = value;
public static bool SecurityEnabled {
get { return securityEnabled; }
- set {
+ set {
// throw a SecurityException if we don't have ControlPolicy permission
new SecurityPermission (SecurityPermissionFlag.ControlPolicy).Demand ();
securityEnabled = value;
// methods
+#if NET_2_0
+ [MonoTODO]
+// [StrongNameIdentityPermission (LinkDemand, PublicKey = "0x00000000000000000400000000000000")]
+ public static void GetZoneAndOrigin (out ArrayList zone, out ArrayList origin)
+ {
+ zone = null;
+ origin = null;
+ }
+#endif
+
[MonoTODO("Incomplete")]
public static bool IsGranted (IPermission perm)
{
return null;
}
+#if NET_2_0
+ [MonoTODO ()]
+ public static PermissionSet ResolvePolicy (Evidence[] evidences)
+ {
+ return null;
+ }
+#endif
+
[MonoTODO()]
public static PermissionSet ResolvePolicy (Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, out PermissionSet denied)
{
[MonoTODO ("Incomplete")]
internal static void InitializePolicyHierarchy ()
{
+ string machinePolicyPath = "";
+ string userPolicyPath = "";
+
ArrayList al = new ArrayList ();
// minimum: Machine, Enterprise and User
// FIXME: Incomplete
- al.Add (new PolicyLevel ("Enterprise"));
- al.Add (new PolicyLevel ("Machine"));
- al.Add (new PolicyLevel ("User"));
+ al.Add (new PolicyLevel ("Enterprise", Path.Combine (machinePolicyPath, "enterprisesec.config")));
+ al.Add (new PolicyLevel ("Machine", Path.Combine (machinePolicyPath, "security.config")));
+ al.Add (new PolicyLevel ("User", Path.Combine (userPolicyPath, "security.config")));
_hierarchy = ArrayList.Synchronized (al);
}
}
-//\r
-// System.Security.VerificationException.cs\r
-//\r
-// Author:\r
-// Nick Drochak(ndrochak@gol.com)\r
-//\r
-// (C) Nick Drochak\r
-//\r
-
-//
-// 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.
+// System.Security.VerificationException.cs
//
-
+// Author:
+// Nick Drochak(ndrochak@gol.com)
//
+// (C) Nick Drochak
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-\r
-using System.Runtime.Serialization;\r
-using System.Globalization;\r
-\r
-namespace System.Security {\r
- [Serializable]\r
- public class VerificationException : SystemException {\r
- \r
- // Constructors\r
- public VerificationException(){}\r
- public VerificationException(string message) \r
- : base (message){}\r
- protected VerificationException(SerializationInfo info, StreamingContext context) \r
- : base (info, context) {}\r
- public VerificationException(string message, Exception inner) \r
- : base (message, inner) {}\r
- }\r
-}\r
+
+using System.Globalization;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+
+namespace System.Security {
+
+ [Serializable]
+#if NET_2_0
+ public class VerificationException : SystemException, _Exception {
+#else
+ public class VerificationException : SystemException {
+#endif
+
+ // Constructors
+ public VerificationException ()
+ {
+ }
+
+ public VerificationException (string message)
+ : base (message)
+ {
+ }
+
+ protected VerificationException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public VerificationException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
-//\r
-// System.Security.XmlSyntaxException.cs\r
-//\r
-// Author:\r
-// Nick Drochak(ndrochak@gol.com)\r
-//\r
-// (C) Nick Drochak\r
-//\r
-
-//
-// 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.
+// System.Security.XmlSyntaxException.cs
//
-
+// Author:
+// Nick Drochak(ndrochak@gol.com)
//
+// (C) Nick Drochak
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-\r
-using System.Globalization;\r
+
+using System.Globalization;
+using System.Runtime.InteropServices;
using System.Runtime.Serialization;
-\r
-namespace System.Security {\r
- [Serializable]\r
- public sealed class XmlSyntaxException : SystemException {\r
- \r
- // Constructors\r
- public XmlSyntaxException(){}\r
- public XmlSyntaxException(int lineNumber)\r
- : base (Locale.GetText("Invalid syntax on line ") + lineNumber.ToString() + "."){}\r
- public XmlSyntaxException(int lineNumber, string message)\r
- : base (Locale.GetText("Invalid syntax on line ") + lineNumber.ToString() + " - " + message ){}\r
- public XmlSyntaxException(string message) \r
- : base (message){}\r
- public XmlSyntaxException(string message, Exception inner) \r
- : base (message, inner) {}\r
- internal XmlSyntaxException(SerializationInfo info, StreamingContext context)
- : base(info, context) {}
- }\r
-}\r
+
+namespace System.Security {
+
+ [Serializable]
+#if NET_2_0
+ public sealed class XmlSyntaxException : SystemException, _Exception {
+#else
+ public sealed class XmlSyntaxException : SystemException {
+#endif
+ // Constructors
+ public XmlSyntaxException ()
+ {
+ }
+
+ public XmlSyntaxException (int lineNumber)
+ : base (String.Format (Locale.GetText ("Invalid syntax on line {0}."), lineNumber))
+ {
+ }
+
+ public XmlSyntaxException (int lineNumber, string message)
+ : base (String.Format (Locale.GetText ("Invalid syntax on line {0} - {1}."), lineNumber, message))
+ {
+ }
+
+ public XmlSyntaxException (string message)
+ : base (message)
+ {
+ }
+
+ public XmlSyntaxException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ internal XmlSyntaxException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}