Commit Graph
130 Commits
Author SHA1 Message Date
Marek Safar be2e73c7e8 Correctly reset buffer for nested asynchronous file stream writes. Fixes #12777 2013-07-05 18:47:22 +02:00
Marek Safar b013a778a2 Remove double verification checks 2013-04-24 10:29:46 +02:00
Rodrigo Kumpera 1b92a4148c Since MOBILE implies NET_4_* now, take this into account and simplify our ifdefs. 2013-02-11 18:42:18 -05:00
Rodrigo Kumpera b96d05dac3 Kill the MOONLIGHT define in corlib. 2013-02-11 16:03:28 -05:00
James Bellinger 9322e0d16b ACLs now work on Windows. Tests all the way up to DirectorySecurityTest and FileSecurityTest.
NativeObjectSecurity is implemented.
I've done it in such a way that, for OSes that do not have a unified API for all ACLs,
overrides can be done in subclasses such as FileSystemSecurity without trouble.

ObjectSecurity, CommonObjectSecurity, and DirectoryObjectSecurity all implemented.
MutexSecurity, PipeSecurity, etc. all just add type specialization and nothing else. Implemented all of these as well.

Access and Audit rules now correctly use NTAccount in their string overloads (see unit tests).
The constructors all provide correct AccessMasks now. In other words, these classes are all now un-broken/no longer stubs.

More unit tests for CommonSecurityDescriptor and fixes to pass them.
A few had checks that were redundant (implemented by (Authorization|Audit|Access)Rule) as well. These have been removed.
The Allow Everyone Full Access default for null DiscretionaryAcls in CommonSecurityDescriptor is, I think,
properly implemented. This required some changes to GenericSecurityDescriptor as well, but now Mono matches
MS.NET on GetSddl/GetBinaryForm for null DiscretionaryAcl including roundtrip.

What's still missing:
(1) CommonAcl's RemoveAccess/RemoveAudit. RemoveAll and RemoveSpecific work so it's not a big issue.
(2) CommonAcl merging will not yet try to merge a CommonAce together with an ObjectAce.
(3) The various *Security constructors. Get/SetAccessControl work on files and directories.
However, you still have to create and then set. I am not too familiar with Mono runtime internal
calls, but to someone who is: If the SECURITY_ATTRIBUTES parameter to Create*'s lpSecurityDescriptor
pointed to the output of GenericSecurityDescriptor's GetBinaryForm, that would be a complete
implementation.
2012-07-07 18:45:06 -04:00
Rolf Bjarne Kvinge ff344b1c44 FileStream: use 4k as the default buffer size
This way it is not treated as a large object by the GC (which is slower
than normal objects). It also matches MS' default buffer size.
2012-01-04 21:17:36 +01:00
Dan Shechter d8b7dfbffb Matched FileStream behaviour with MS.NET 2011-11-05 20:57:32 +02:00
Marek Safar 7b51bb0cb1 Implement stream async methods 2011-09-28 08:09:33 +01:00
Miguel de Icaza 2852ed0b59 Update copyrights 2011-09-13 18:26:13 -04:00
Sebastien Pouliot 8d641b33e7 Throwing IsolatedStorageException is a Moonlight-behavior and should not have been exposed to other 2.1 profiles 2011-09-09 13:18:37 -04:00
Rodrigo Kumpera d72794cced Reorder fields to improve object layout since the runtime can't do it for corlib types. 2011-05-23 01:13:09 -03:00
Marek Safar 72a7dcbc53 Improve FileStream block reading performance little bit 2011-01-26 08:59:11 +00:00
Geoff Norton 16d4fd790b Further .NET 4.0 ification of the mobile profile 2011-01-25 20:10:54 -05:00
Sebastien Pouliot 0e648f53f6 Move assignation earlier to ensure value is available for parameter checks
* FileStream.cs: Move anonymous assignation earlier so the value is
available when validation are made (and calls other methods)
2010-11-04 15:13:55 -04:00
Alex Fort f056dfcbd9 Don't use a buffer size of 1 for zero-length buffers
Using a size of 1 for zero length buffers causes (on linux) the last character to be eaten by the buffer until the next flush.
2010-10-30 08:49:58 +08:00
Alex Fort 1605e82860 [Fix] Don't enforce a minimum size for zero-length buffers, fixing #645193
InitBuffer was forcing the length of any buffer smaller than 8 to be 8, but for zero-size buffers, this isn't correct.
2010-10-30 08:49:57 +08:00
Jb Evain 2f05148ec7 Add FileStream.Flush(bool) to the moonlight profile 2010-09-10 08:20:48 +02:00
Rolf Bjarne Kvinge 1302ff5653 2010-06-18 Rolf Bjarne Kvinge <[email protected]>
* FileStream.cs: Include a required ctor in NET_2_1 so that it compiles.

svn path=/trunk/mcs/; revision=159112
2010-06-17 23:47:06 +00:00
Miguel de Icaza 923d1f3bfc Fix for 607585
svn path=/trunk/mcs/; revision=159041
2010-06-16 23:28:09 +00:00
Marek Habersack 7312d09305 2010-05-20 Marek Habersack <[email protected]>
* FileStream.cs: when running on Windows and a path with Unix
	directory separator chars is passed (including an UNC share), get
	the canonical form of the path before attempting to retrieve its
	directory name. Fixes bug #607502

	* Path.cs: typo fix

svn path=/trunk/mcs/; revision=157650
2010-05-20 21:54:22 +00:00
Sebastien Pouliot e6fd69e444 2010-04-16 Sebastien Pouliot <[email protected]>
* Directory.cs: Ensure elevated trust when calling on 
	Moonlight.
	* DirectoryInfo.cs: Ensure elevated trust when calling a .ctor 
	on Moonlight.
	* File.cs: Ensure elevated trust when calling a .ctor on 
	Moonlight.
	* FileInfo.cs: Ensure elevated trust when calling a .ctor on 
	Moonlight.
	* FileStream.cs: Ensure elevated trust when calling a .ctor on 
	Moonlight. Name property returns "[Unknown]" unless a Moonlight
	application is executed with elevated trust.
	* Path.cs: Ensure elevated trust when calling a GetTempPath,
	GetTempFileName or GetFullPath on Moonlight. Add a shared 
	internal method to validate paths to reduce code duplication.


svn path=/trunk/mcs/; revision=155643
2010-04-16 17:29:07 +00:00
Jb Evain 05a5b21fa0 use MOONLIGHT symbol
svn path=/trunk/mcs/; revision=153656
2010-03-16 12:10:19 +00:00
Gonzalo Paniagua Javier 21350653cc 2010-02-15 Gonzalo Paniagua Javier <[email protected]>
* StreamWriter.cs:
	* FileStream.cs: if flushing fails when disposing the stream, make
	sure it is closed before throwing the exception. Fixes bug #579146.


svn path=/trunk/mcs/; revision=151761
2010-02-16 01:39:56 +00:00
Marek Safar 6bec77af06 2009-11-24 Marek Safar <[email protected]>
* StreamReader.cs, FileStream.cs: Use recycle buffer to avoid
	repeated underlying buffer initialization (saves hefty 10MB
	during corlib compilation).
	
	* Path.cs (InsecureGetFullPath): Avoid CanonicalizePath in common
	path.


svn path=/trunk/mcs/; revision=146841
2009-11-24 16:30:55 +00:00
Miguel de Icaza fe09fc6f64 More 4.0 work
svn path=/trunk/mcs/; revision=145674
2009-11-08 18:32:52 +00:00
Miguel de Icaza 736cccc052 Fix build
svn path=/trunk/mcs/; revision=145650
2009-11-07 18:32:57 +00:00
Miguel de Icaza e9eafddcd6 2009-11-07 Miguel de Icaza <[email protected]>
* UnmanagedMemoryStream.cs: Move the CLS attribute to the methods
	that are unsafe.

	* Path.cs (Combine):e Fix implementation to follow docs (we need
	to reset the path if any of the combined paths is rooted), and add a
	couple of overloads;

	* FileStream.cs (Flush/flushToDisk): Implement.

	* Stream.cs (CopyTo): Implement.



svn path=/trunk/mcs/; revision=145640
2009-11-07 07:09:10 +00:00
Miguel de Icaza 71b0cb003e 2009-11-03 Miguel de Icaza <[email protected]>
* FileStream.cs: Check the return value of MonoIO.Write and handle
	short-writes as those can happen when a FileStream is used on top
	of a pipe on Unix.

	Fixes bug: #531613, this should be backported to 2-4 and 2-6 after
	some testing.

svn path=/trunk/mcs/; revision=145271
2009-11-03 05:34:06 +00:00
Sebastien Pouliot 962a415e42 2009-10-29 Sebastien Pouliot <[email protected]>
* FileStream.cs: Reduce code duplication by merging FillBuffer 
	with FillBufferToStream


svn path=/trunk/mcs/; revision=145008
2009-10-29 12:09:47 +00:00
Sebastien Pouliot 01721e7fa2 2009-10-28 Sebastien Pouliot <[email protected]>
* FileStream.cs: Move code to deal with 'anonymous' filenames
	into two methods (returning the path, fullpath or only the 
	filename). Default Moonlight to anonymous (not only for isolated
	storage) unless the coreclr is disable (e.g. smcs)


svn path=/trunk/mcs/; revision=144945
2009-10-28 13:42:05 +00:00
Miguel de Icaza 0204abe803 Drop more obsolete defines
svn path=/trunk/mcs/; revision=144304
2009-10-17 01:35:27 +00:00
Sebastien Pouliot 2203a2bb29 2009-09-18 Sebastien Pouliot <[email protected]>
* Directory.cs: Avoid imperative CAS checks and remove 
	AccessControl types for NET_2_1
	* DirectoryInfo.cs: Remove AccessControl types for NET_2_1
	* File.cs: Remove AccessControl types for NET_2_1
	* FileInfo.cs: Remove AccessControl types for NET_2_1
	* FileStream.cs: Remove AccessControl types for NET_2_1
	* Path.cs: Avoid imperative CAS checks for NET_2_1


svn path=/trunk/mcs/; revision=142197
2009-09-18 15:57:32 +00:00
Marek Habersack fe15b22c9e Revert r130049
svn path=/trunk/mcs/; revision=130110
2009-03-24 08:48:23 +00:00
Marek Habersack 82bbdb387b 2009-03-23 Marek Habersack <[email protected]>
* ConsoleTest.cs: added a bunch of tests for the standard input,
	output and error stream properties.

2009-03-23  Marek Habersack  <[email protected]>

	* FileStreamTest.cs: added a bunch of tests for SafeFileHandle
	constructors

2009-03-23  Marek Habersack  <[email protected]>

	* Console.cs: OpenStandard{Input,Output,Error} no longer use
	FileStream on 2.0+. The reason is that SafeFileHandle used in the
	stream doesn't allow handles with values <= 0, and on Unix stdin
	is 0 which would break the Console class. Instead of FileStream,
	introduced a simple internal specialized stream which is used in
	this scenario.

2009-03-23  Marek Habersack  <[email protected]>

	* FileStream.cs: implemented full support for SafeFileHandle in
	2.0. The obsolete constructors taking an IntPtr now wrap it in a
	SafeFileHandle.

2009-03-23  Marek Habersack  <[email protected]>

	* SafeHandle.cs: added an internal property, OwnsHandle, used by
	FileStream.

svn path=/trunk/mcs/; revision=130049
2009-03-23 12:57:04 +00:00
Marek Habersack 12b3308fec 2009-03-22 Marek Habersack <[email protected]>
* FileStream.cs: implemented the SafeFileHandle property.

svn path=/trunk/mcs/; revision=130002
2009-03-22 18:27:08 +00:00
Miguel de Icaza 81b4c6c9dd 2008-12-20 Miguel de Icaza <[email protected]>
* FileStream.cs: Found while debugging webcompare, we should add
	Obsoletes to the FileStream constructors that take IntPtrs.

svn path=/trunk/mcs/; revision=121916
2008-12-20 07:13:13 +00:00
Sebastien Pouliot 1a5608d94e 2008-08-22 Sebastien Pouliot <[email protected]>
* FileStream.cs, MonoIO.cs: For Silverlight 2.0 (NET_2_1) we always
	throw IsolatedStorageException instead of FileNotFoundException and
	DirectoryNotFoundException.


svn path=/trunk/mcs/; revision=111391
2008-08-22 17:40:17 +00:00
Sebastien Pouliot 3b3c977ed0 2008-08-21 Sebastien Pouliot <[email protected]>
* FileStream.cs: Adjust exception being thrown for Silverlight 2.0.
	* FileSystemInfo.cs: In Silverlight 2 this type does not inherit from 
	MarshalByRefObject nor does it implement ISerializable.
	* Stream.cs: In Silverlight 2 this type does not inherit from 
	MarshalByRefObject.
	* TextReader.cs: In Silverlight 2 this type does not inherit from 
	MarshalByRefObject.
	* TextWriter.cs: In Silverlight 2 this type does not inherit from 
	MarshalByRefObject.
	* UnmanagedMemoryStream.cs: For Silverlight 2 add CLSCompliant(false)
	to the PositionPointer property.


svn path=/trunk/mcs/; revision=111271
2008-08-21 15:40:33 +00:00
Andreas N 3df89d4a6d 2008-06-30 Andreas Nahr <[email protected]>
* BinaryReader.cs: Fix parameter names
	* BinaryWriter.cs: Fix parameter names, fix exceptions
	* BufferedStream.cs: Fix parameter names
	* Directory.cs: Fix parameter names, fix exceptions, optimize == "" cases
	* DirectoryInfo.cs:
	* DirectoryNotFoundException.cs:
	* FileNotFoundException.cs:
	* FileStream.cs: Fix parameter names, fix exceptions
	* IOException.cs: Fix parameter names

svn path=/trunk/mcs/; revision=106943
2008-06-30 23:02:31 +00:00
Atsushi Eno a4039fa632 yuck, typo.
svn path=/trunk/mcs/; revision=90103
2007-11-21 19:15:15 +00:00
Atsushi Eno ac879a3ea0 2007-11-21 Atsushi Enomoto <[email protected]>
* FileStream.cs : Close() does not exist in 2.0 (Stream does).
	  Move GC.SuppressFinalize() to Dispose(true).


svn path=/trunk/mcs/; revision=90095
2007-11-21 17:27:29 +00:00
Marek Safar f8477b12e6 Warnings cleanup
svn path=/trunk/mcs/; revision=89670
2007-11-15 11:51:57 +00:00
Gert Driesen ce9892f0a0 * BinaryReader.cs: Fixed line endings.
* FileStream.cs: Rename name argument to path. Spaces to tabs.

svn path=/trunk/mcs/; revision=84797
2007-08-24 10:51:01 +00:00
Dick Porter 8b2b1773d3 2007-06-21 Dick Porter <[email protected]>
* FileStream.cs: Fix FileShare test, fixing better bug 79250.



svn path=/trunk/mcs/; revision=80493
2007-06-21 16:22:27 +00:00
Jonathan Chambers 98c320154e 2007-05-12 Jonathan Chambers <[email protected]>
* FileStream.cs: Implement SafeHandle constructors.


svn path=/trunk/mcs/; revision=77278
2007-05-12 15:03:37 +00:00
Dick Porter 5b79519900 2007-04-30 Dick Porter <[email protected]>
* Directory.cs: 
	* FileShare.cs: 
	* DirectoryNotFoundException.cs: 
	* SeekOrigin.cs: 
	* FileAttributes.cs: 
	* IOException.cs: 
	* MemoryStream.cs: 
	* FileMode.cs: 
	* BinaryWriter.cs: 
	* TextWriter.cs: 
	* File.cs: 
	* BinaryReader.cs: 
	* TextReader.cs: 
	* UnmanagedMemoryStream.cs: 
	* StringWriter.cs: 
	* FileAccess.cs: 
	* FileLoadException.cs: 
	* BufferedStream.cs: 
	* Stream.cs: 
	* FileInfo.cs: 
	* FileStream.cs:
	* StringReader.cs: 
	* StreamWriter.cs: 
	* EndOfStreamException.cs: 
	* DriveInfo.cs: 
	* StreamReader.cs: 
	* PathTooLongException.cs: 
	* DriveType.cs: 
	* FileNotFoundException.cs: 2.0 profile updates



svn path=/trunk/mcs/; revision=76495
2007-04-30 14:05:12 +00:00
Alp Toker 1f9ae123bc 2007-04-21 Alp Toker <[email protected]>
* FileStream.cs: Respect request for buffering in all cases.

	Gonzalo added code in r42667 that disables buffering even when it is
	requested, in the case that ftype != MonoFileType.Disk. This was
	killing performance for users who do Console.OpenStandardOutput(1024)
	but were ending up with a non-buffered FileStream.

	The new behaviour appears correct but we should watch for any
	regressions.


svn path=/trunk/mcs/; revision=76038
2007-04-21 08:18:30 +00:00
Gert Driesen 6dd8ccef86 * FileStream.cs: Always resolve to absolute paths for exceptions, when not
in anonymous mode.     
* FileStreamTest.cs: Added and improved tests to verify whether the
reported exceptions match that of MS.

svn path=/trunk/mcs/; revision=72048
2007-01-31 19:26:17 +00:00
Paolo Molaro c772628c52 Mon Dec 11 11:40:06 CET 2006 Paolo Molaro <[email protected]>
* FileStream.cs: correct exception message patch from
	Markus Mauhart <[email protected]>.


svn path=/trunk/mcs/; revision=69308
2006-12-11 10:42:05 +00:00
Dick Porter 291d9b1488 2006-10-11 Dick Porter <[email protected]>
* FileStream.cs: Cope with 2.0 FileShare.Delete values.  Patch by
        Peter Dettman <[email protected]> fixing bug 79250.



svn path=/trunk/mcs/; revision=66563
2006-10-11 17:33:14 +00:00