[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Security/Permissions E
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Security/Permissions EnvironmentPermissionAttribute.cs,NONE,1.1 FileIOPermissionAttribute.cs,NONE,1.1 ReflectionPermissionAttribute.cs,NONE,1.1 ReflectionPermissionFlag.cs,NONE,1.1 CodeAccessSecurityAttribute.cs,1.3,1.4 SecurityAttribute.cs,1.1,1.2 SecurityPermission.cs,1.2,1.3SecurityPermissionAttribute.cs,1.3,1.4 |
Date: |
Sun, 30 Mar 2003 06:58:47 -0500 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Permissions
In directory subversions:/tmp/cvs-serv19206/runtime/System/Security/Permissions
Modified Files:
CodeAccessSecurityAttribute.cs SecurityAttribute.cs
SecurityPermission.cs SecurityPermissionAttribute.cs
Added Files:
EnvironmentPermissionAttribute.cs FileIOPermissionAttribute.cs
ReflectionPermissionAttribute.cs ReflectionPermissionFlag.cs
Log Message:
Add missing classes and definitions under "System.Security".
--- NEW FILE ---
/*
* EnvironmentPermissionAttribute.cs - Implementation of the
*
"System.Security.Permissions.EnvironmentPermissionAttribute" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Security.Permissions
{
using System;
using System.Security;
[AttributeUsage(AttributeTargets.Assembly |
AttributeTargets.Class |
AttributeTargets.Struct |
AttributeTargets.Constructor |
AttributeTargets.Method,
AllowMultiple=true, Inherited=false)]
public sealed class EnvironmentPermissionAttribute
: CodeAccessSecurityAttribute
{
// Internal state.
private String read;
private String write;
// Constructors.
public EnvironmentPermissionAttribute(SecurityAction action)
: base(action)
{
// Nothing to do here.
}
// Get or set the read permission value.
public String Read
{
get
{
return read;
}
set
{
read = value;
}
}
// Get or set the write permission value.
public String Write
{
get
{
return write;
}
set
{
write = value;
}
}
// Set both the read and write permission values.
public String All
{
set
{
read = value;
write = value;
}
}
// Create a permission object that corresponds to this attribute.
[TODO]
public override IPermission CreatePermission()
{
// TODO
return null;
}
}; // class EnvironmentPermissionAttribute
}; // namespace System.Security.Permissions
--- NEW FILE ---
/*
* FileIOPermissionAttribute.cs - Implementation of the
* "System.Security.Permissions.FileIOPermissionAttribute"
class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Security.Permissions
{
using System;
using System.Security;
[AttributeUsage(AttributeTargets.Assembly |
AttributeTargets.Class |
AttributeTargets.Struct |
AttributeTargets.Constructor |
AttributeTargets.Method,
AllowMultiple=true, Inherited=false)]
public sealed class FileIOPermissionAttribute : CodeAccessSecurityAttribute
{
// Internal state.
private String read;
private String write;
private String append;
private String pathDiscovery;
// Constructors.
public FileIOPermissionAttribute(SecurityAction action)
: base(action)
{
// Nothing to do here.
}
// Get or set the read permission value.
public String Read
{
get
{
return read;
}
set
{
read = value;
}
}
// Get or set the write permission value.
public String Write
{
get
{
return write;
}
set
{
write = value;
}
}
// Get or set the append permission value.
public String Append
{
get
{
return append;
}
set
{
append = value;
}
}
// Get or set the path discovery permission value.
public String PathDiscovery
{
get
{
return pathDiscovery;
}
set
{
pathDiscovery = value;
}
}
// Set both the read and write permission values.
public String All
{
set
{
read = value;
write = value;
append = value;
pathDiscovery = value;
}
}
// Create a permission object that corresponds to this attribute.
[TODO]
public override IPermission CreatePermission()
{
// TODO
return null;
}
}; // class FileIOPermissionAttribute
}; // namespace System.Security.Permissions
--- NEW FILE ---
/*
* ReflectionPermissionAttribute.cs - Implementation of the
*
"System.Security.Permissions.ReflectionPermissionAttribute" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Security.Permissions
{
using System;
using System.Security;
[AttributeUsage(AttributeTargets.Assembly |
AttributeTargets.Class |
AttributeTargets.Struct |
AttributeTargets.Constructor |
AttributeTargets.Method,
AllowMultiple=true, Inherited=false)]
public sealed class ReflectionPermissionAttribute : CodeAccessSecurityAttribute
{
// Internal state.
private ReflectionPermissionFlag flags;
// Constructors.
public ReflectionPermissionAttribute(SecurityAction action)
: base(action)
{
// Nothing to do here.
}
// Get or set the reflection permission flags.
public ReflectionPermissionFlag Flags
{
get
{
return flags;
}
set
{
flags = value;
}
}
#if !ECMA_COMPAT
// Get or set specific flags.
public bool MemberAccess
{
get
{
return ((flags &
ReflectionPermissionFlag.MemberAccess)
!= 0);
}
set
{
if(value)
{
flags |=
ReflectionPermissionFlag.MemberAccess;
}
else
{
flags &=
~ReflectionPermissionFlag.MemberAccess;
}
}
}
public bool ReflectionEmit
{
get
{
return ((flags &
ReflectionPermissionFlag.ReflectionEmit)
!= 0);
}
set
{
if(value)
{
flags |=
ReflectionPermissionFlag.ReflectionEmit;
}
else
{
flags &=
~ReflectionPermissionFlag.ReflectionEmit;
}
}
}
public bool TypeInformation
{
get
{
return ((flags &
ReflectionPermissionFlag.TypeInformation)
!= 0);
}
set
{
if(value)
{
flags |=
ReflectionPermissionFlag.TypeInformation;
}
else
{
flags &=
~ReflectionPermissionFlag.TypeInformation;
}
}
}
#endif // !ECMA_COMPAT
// Create a permission object that corresponds to this attribute.
[TODO]
public override IPermission CreatePermission()
{
// TODO
return null;
}
}; // class ReflectionPermissionAttribute
}; // namespace System.Security.Permissions
--- NEW FILE ---
/*
* ReflectionPermissionFlag.cs - Implementation of the
* "System.Security.Permissions.ReflectionPermissionFlag"
class.
*
* Copyright (C) 2001 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Security.Permissions
{
[Flags]
public enum ReflectionPermissionFlag
{
NoFlags = 0x0000,
TypeInformation = 0x0001,
MemberAccess = 0x0002,
#if !ECMA_COMPAT
ReflectionEmit = 0x0004,
AllFlags = 0x0007
#endif
}; // enum ReflectionPermissionFlag
}; // namespace System.Security.Permissions
Index: CodeAccessSecurityAttribute.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Permissions/CodeAccessSecurityAttribute.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** CodeAccessSecurityAttribute.cs 18 Dec 2001 10:27:04 -0000 1.3
--- CodeAccessSecurityAttribute.cs 30 Mar 2003 11:58:44 -0000 1.4
***************
*** 34,39 ****
public abstract class CodeAccessSecurityAttribute : SecurityAttribute
{
! // Constructors.
! #if ECMA_COMPAT
protected CodeAccessSecurityAttribute()
: base()
--- 34,40 ----
public abstract class CodeAccessSecurityAttribute : SecurityAttribute
{
! // Constructors. The first is specified by ECMA, but isn't present
! // in any other implementation. It is probably a bug in the ECMA
! // specification, but it is relatively harmless to include it.
protected CodeAccessSecurityAttribute()
: base()
***************
*** 41,45 ****
// Nothing to do here.
}
- #endif // ECMA_COMPAT
public CodeAccessSecurityAttribute(SecurityAction action)
: base(action)
--- 42,45 ----
Index: SecurityAttribute.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Permissions/SecurityAttribute.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** SecurityAttribute.cs 18 Dec 2001 10:27:04 -0000 1.1
--- SecurityAttribute.cs 30 Mar 2003 11:58:44 -0000 1.2
***************
*** 38,43 ****
private bool unrestricted;
! // Constructors.
! #if ECMA_COMPAT
protected SecurityAttribute()
{
--- 38,44 ----
private bool unrestricted;
! // Constructors. The first is specified by ECMA, but isn't present
! // in any other implementation. It is probably a bug in the ECMA
! // specification, but it is relatively harmless to include it.
protected SecurityAttribute()
{
***************
*** 45,49 ****
unrestricted = false;
}
- #endif // ECMA_COMPAT
public SecurityAttribute(SecurityAction action)
{
--- 46,49 ----
Index: SecurityPermission.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Permissions/SecurityPermission.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** SecurityPermission.cs 20 Dec 2001 10:11:39 -0000 1.2
--- SecurityPermission.cs 30 Mar 2003 11:58:44 -0000 1.3
***************
*** 108,128 ****
}
}
- [TODO]
public override IPermission Intersect(IPermission target)
{
! // TODO
! return null;
}
- [TODO]
public override bool IsSubsetOf(IPermission target)
{
! // TODO
! return false;
}
- [TODO]
public override IPermission Union(IPermission target)
{
! // TODO
! return null;
}
--- 108,206 ----
}
}
public override IPermission Intersect(IPermission target)
{
! SecurityPermissionFlag newFlags;
! if(target == null)
! {
! return target;
! }
! else if(!(target is SecurityPermission))
! {
! throw new
ArgumentException(_("Arg_PermissionMismatch"));
! }
! else
if(((SecurityPermission)target).IsUnrestricted())
! {
! if(IsUnrestricted())
! {
! return Copy();
! }
! else
! {
! newFlags = flags;
! }
! }
! else if(IsUnrestricted())
! {
! newFlags =
((SecurityPermission)target).flags;
! }
! else
! {
! newFlags =
((SecurityPermission)target).flags & flags;
! }
! if(newFlags == 0)
! {
! return null;
! }
! else
! {
! return new SecurityPermission(newFlags);
! }
}
public override bool IsSubsetOf(IPermission target)
{
! if(target == null)
! {
! return (flags ==
SecurityPermissionFlag.NoFlags);
! }
! else if(!(target is SecurityPermission))
! {
! throw new
ArgumentException(_("Arg_PermissionMismatch"));
! }
! else
if(((SecurityPermission)target).IsUnrestricted())
! {
! return true;
! }
! else if(IsUnrestricted())
! {
! return false;
! }
! else
! {
! return ((flags &
~(((SecurityPermission)target).flags))
! == 0);
! }
}
public override IPermission Union(IPermission target)
{
! if(target == null)
! {
! return Copy();
! }
! else if(!(target is SecurityPermission))
! {
! throw new
ArgumentException(_("Arg_PermissionMismatch"));
! }
! else if(IsUnrestricted() ||
!
((SecurityPermission)target).IsUnrestricted())
! {
! return new SecurityPermission
! (PermissionState.Unrestricted);
! }
! else
! {
! return new SecurityPermission
! (flags |
((SecurityPermission)target).flags);
! }
! }
!
! // Determine if this object has unrestricted permissions.
! #if ECMA_COMPAT
! internal
! #else
! public
! #endif
! bool IsUnrestricted()
! {
! return (state == PermissionState.Unrestricted);
}
Index: SecurityPermissionAttribute.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Permissions/SecurityPermissionAttribute.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** SecurityPermissionAttribute.cs 6 Feb 2002 04:28:56 -0000 1.3
--- SecurityPermissionAttribute.cs 30 Mar 2003 11:58:44 -0000 1.4
***************
*** 23,31 ****
{
! // Note: this class is sometimes left out of the build because it
// confuses the Microsoft C# compiler when building with "/nostdlib".
- //#if __CSCC__
-
[AttributeUsage(AttributeTargets.Assembly |
AttributeTargets.Class |
--- 23,29 ----
{
! // Note: this class sometimes inherits from "Attribute" because otherwise it
// confuses the Microsoft C# compiler when building with "/nostdlib".
[AttributeUsage(AttributeTargets.Assembly |
AttributeTargets.Class |
***************
*** 34,38 ****
AttributeTargets.Method,
AllowMultiple=true, Inherited=false)]
! public sealed class SecurityPermissionAttribute : Attribute //:
CodeAccessSecurityAttribute
{
// Internal state.
--- 32,40 ----
AttributeTargets.Method,
AllowMultiple=true, Inherited=false)]
! #if __CSCC__
! public sealed class SecurityPermissionAttribute : CodeAccessSecurityAttribute
! #else
! public sealed class SecurityPermissionAttribute : Attribute
! #endif
{
// Internal state.
***************
*** 46,50 ****
}
! #if false
// Create a permission object that corresponds to this attribute.
public override IPermission CreatePermission()
--- 48,52 ----
}
! #if __CSCC__
// Create a permission object that corresponds to this attribute.
public override IPermission CreatePermission()
***************
*** 89,93 ****
}
! #if false && !ECMA_COMPAT
// Non-ECMA properties.
--- 91,95 ----
}
! #if __CSCC__ && !ECMA_COMPAT
// Non-ECMA properties.
***************
*** 326,331 ****
}; // class SecurityPermissionAttribute
-
- //#endif // __CSCC__
}; // namespace System.Security.Permissions
--- 328,331 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Security/Permissions EnvironmentPermissionAttribute.cs,NONE,1.1 FileIOPermissionAttribute.cs,NONE,1.1 ReflectionPermissionAttribute.cs,NONE,1.1 ReflectionPermissionFlag.cs,NONE,1.1 CodeAccessSecurityAttribute.cs,1.3,1.4 SecurityAttribute.cs,1.1,1.2 SecurityPermission.cs,1.2,1.3SecurityPermissionAttribute.cs,1.3,1.4,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.771,1.772
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Security AllowPartiallyTrustedCallersAttribute.cs,NONE,1.1 IEvidenceFactory.cs,NONE,1.1 ISecurityEncodable.cs,NONE,1.1 ISecurityPolicyEncodable.cs,NONE,1.1 IStackWalk.cs,NONE,1.1 NamedPermissionSet.cs,NONE,1.1 PolicyLevelType.cs,NONE,1.1 SecurityManager.cs,NONE,1.1 SecurityZone.cs,NONE,1.1 XmlSyntaxException.cs,NONE,1.1 CodeAccessPermission.cs,1.2,1.3 IPermission.cs,1.1,1.2 PermissionSet.cs,1.2,1.3SecurityElement.cs,1.2,1.3 SuppressUnmanagedCodeSecurityAttribute.cs,1.1,1.2 UnverifiableCodeAttribute.cs,1.2,1.3
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.771,1.772
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Security AllowPartiallyTrustedCallersAttribute.cs,NONE,1.1 IEvidenceFactory.cs,NONE,1.1 ISecurityEncodable.cs,NONE,1.1 ISecurityPolicyEncodable.cs,NONE,1.1 IStackWalk.cs,NONE,1.1 NamedPermissionSet.cs,NONE,1.1 PolicyLevelType.cs,NONE,1.1 SecurityManager.cs,NONE,1.1 SecurityZone.cs,NONE,1.1 XmlSyntaxException.cs,NONE,1.1 CodeAccessPermission.cs,1.2,1.3 IPermission.cs,1.1,1.2 PermissionSet.cs,1.2,1.3SecurityElement.cs,1.2,1.3 SuppressUnmanagedCodeSecurityAttribute.cs,1.1,1.2 UnverifiableCodeAttribute.cs,1.2,1.3
- Index(es):