Author: spouliot
Date: 2005-03-24 09:24:38 -0500 (Thu, 24 Mar 2005)
New Revision: 42215
Modified:
trunk/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog
trunk/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs
trunk/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs
Log:
2005-03-24 Sebastien Pouliot <[EMAIL PROTECTED]>
* IsolatedStorageFile.cs: Added an assert for unrestricted file access
to the class. This is "ok" as the user cannot control the base path
for isolated storage but will be updated to be more "precise" when
imperative assert are supported in the runtime.
* IsolatedStorageFileStream.cs: Changed constructors so the assert
for unrestricted file access is limited to constructors (not the whole
class). Added LinkDemand for UnmanagedCode to get Handle and
SafeFileHandle (2.0) properties.
Modified: trunk/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog 2005-03-24
14:23:30 UTC (rev 42214)
+++ trunk/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog 2005-03-24
14:24:38 UTC (rev 42215)
@@ -1,3 +1,14 @@
+2005-03-24 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * IsolatedStorageFile.cs: Added an assert for unrestricted file access
+ to the class. This is "ok" as the user cannot control the base path
+ for isolated storage but will be updated to be more "precise" when
+ imperative assert are supported in the runtime.
+ * IsolatedStorageFileStream.cs: Changed constructors so the assert
+ for unrestricted file access is limited to constructors (not the whole
+ class). Added LinkDemand for UnmanagedCode to get Handle and
+ SafeFileHandle (2.0) properties.
+
2005-03-17 Sebastien Pouliot <[EMAIL PROTECTED]>
* IsolatedStorageScope.cs: Add missing BOOTSTRAP_NET_2_0 to new enum
Modified:
trunk/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs
===================================================================
--- trunk/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs
2005-03-24 14:23:30 UTC (rev 42214)
+++ trunk/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs
2005-03-24 14:24:38 UTC (rev 42215)
@@ -43,6 +43,10 @@
// This is a terribly named class. It doesn't actually represent a
file as
// much as a directory
+
+
+ // FIXME: Further limit the assertion when imperative Assert is
implemented
+ [FileIOPermission (SecurityAction.Assert, Unrestricted = true)]
public sealed class IsolatedStorageFile : IsolatedStorage, IDisposable {
public static IEnumerator GetEnumerator (IsolatedStorageScope
scope)
Modified:
trunk/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs
===================================================================
---
trunk/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs
2005-03-24 14:23:30 UTC (rev 42214)
+++
trunk/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs
2005-03-24 14:24:38 UTC (rev 42215)
@@ -54,7 +54,7 @@
// i.e. the result would always be
mscorlib.dll. So we need to do
// a small stack walk to find who's calling the
constructor
- StackFrame sf = new StackFrame (2); // skip
self and constructor
+ StackFrame sf = new StackFrame (3); // skip
self and constructor
isf = IsolatedStorageFile.GetStore
(IsolatedStorageScope.User | IsolatedStorageScope.Domain |
IsolatedStorageScope.Assembly,
IsolatedStorageFile.GetDomainIdentityFromEvidence
(AppDomain.CurrentDomain.Evidence),
IsolatedStorageFile.GetAssemblyIdentityFromEvidence (sf.GetMethod
().ReflectedType.Assembly.Evidence));
@@ -81,42 +81,44 @@
}
public IsolatedStorageFileStream (string path, FileMode mode)
- : base (CreateIsolatedPath (null, path), mode, (mode ==
FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite), FileShare.Read,
DefaultBufferSize, false, true)
+ : this (path, mode, (mode == FileMode.Append ?
FileAccess.Write : FileAccess.ReadWrite), FileShare.Read, DefaultBufferSize,
null)
{
}
public IsolatedStorageFileStream (string path, FileMode mode,
FileAccess access)
- : base (CreateIsolatedPath (null, path), mode, access,
access == FileAccess.Write ? FileShare.None : FileShare.Read,
DefaultBufferSize, false, true)
+ : this (path, mode, access, access == FileAccess.Write
? FileShare.None : FileShare.Read, DefaultBufferSize, null)
{
}
public IsolatedStorageFileStream (string path, FileMode mode,
FileAccess access, FileShare share)
- : base (CreateIsolatedPath (null, path), mode, access,
share, DefaultBufferSize, false, true)
+ : this (path, mode, access, share, DefaultBufferSize,
null)
{
}
public IsolatedStorageFileStream (string path, FileMode mode,
FileAccess access, FileShare share, int bufferSize)
- : base (CreateIsolatedPath (null, path), mode, access,
share, bufferSize, false, true)
+ : this (path, mode, access, share, bufferSize, null)
{
}
+ // FIXME: Further limit the assertion when imperative Assert is
implemented
+ [FileIOPermission (SecurityAction.Assert, Unrestricted = true)]
public IsolatedStorageFileStream (string path, FileMode mode,
FileAccess access, FileShare share, int bufferSize, IsolatedStorageFile isf)
: base (CreateIsolatedPath (isf, path), mode, access,
share, bufferSize, false, true)
{
}
public IsolatedStorageFileStream (string path, FileMode mode,
FileAccess access, FileShare share, IsolatedStorageFile isf)
- : base (CreateIsolatedPath (isf, path), mode, access,
share, DefaultBufferSize, false, true)
+ : this (path, mode, access, share, DefaultBufferSize,
isf)
{
}
public IsolatedStorageFileStream (string path, FileMode mode,
FileAccess access, IsolatedStorageFile isf)
- : base (CreateIsolatedPath (isf, path), mode, access,
access == FileAccess.Write ? FileShare.None : FileShare.Read,
DefaultBufferSize, false, true)
+ : this (path, mode, access, access == FileAccess.Write
? FileShare.None : FileShare.Read, DefaultBufferSize, isf)
{
}
public IsolatedStorageFileStream (string path, FileMode mode,
IsolatedStorageFile isf)
- : base (CreateIsolatedPath (isf, path), mode, (mode ==
FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite), FileShare.Read,
DefaultBufferSize, false, true)
+ : this (path, mode, (mode == FileMode.Append ?
FileAccess.Write : FileAccess.ReadWrite), FileShare.Read, DefaultBufferSize,
isf)
{
}
@@ -134,6 +136,7 @@
#if NET_2_0
public override SafeFileHandle SafeFileHandle {
+ [SecurityPermission (SecurityAction.LinkDemand,
UnmanagedCode = true)]
get {
throw new IsolatedStorageException (
Locale.GetText ("Information is
restricted"));
@@ -143,6 +146,7 @@
[Obsolete ("Use SafeFileHandle - once available")]
#endif
public override IntPtr Handle {
+ [SecurityPermission (SecurityAction.LinkDemand,
UnmanagedCode = true)]
get {
throw new IsolatedStorageException (
Locale.GetText ("Information is
restricted"));
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches