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.
Also fixed:
CommonAcl's merging now filters out AceFlags.InheritedFlags when !IsContainer.
For matching AccessMask, CommonAcl will now correctly merge ContainerInherit and ObjectInherit.
GenericAcl's SyncRoot is now virtual as per spec.
SecurityIdentifier.CompareTo throws ArgumentNullException, not NullReferenceException, on null parameter.
Miscellaneous unit tests:
Verify that RawAcl throws for negative capacity.
and SystemAcl need work, but CommonAcl can be manipulated using RawAcls nicely
now and will test canonicity, merge ACEs, remove meaningless ACEs, sort explicit
deny/allow ACEs by SecurityIdentifier... all the nice things CommonAcl is supposed
to do.
Anyway, this patch... Off the top of my head...
Fixed CommonAce and ObjectAce deserialization/roundtripping with opaque data.
Fixed ObjectAce having the wrong BinaryLength depending on ObjectAceFlags.
GenericAce had two protected static SDDL methods which should be internal.
Added some unit tests for the above. One of the tests compares the binary
output with a blob I produced using the *same unit test* on MS.NET (with a
File.WriteAllText creating the byte array to paste in, naturally), and
happily, it produces identical binary output. Very nice.
I determined the behavior of CompareTo by first writing unit tests for
CommonAcl (instantiated as DiscretionaryAcl but using RawAcl instead of
DiscretionaryAcl methods to do the manipulation to keep DiscretionaryAcl
out of the loop). I developed and ran these unit tests on MS.NET using
MonoDevelop...
Anyway, CompareTo appears to compare authority, then the *number* of
subauthorities, and lastly the subauthorities. I'd be curious if there
is more detail, but so far this seems to cover it. It's definitely
*not* just a comparison of the string.
This patch also modifies CommonAcl to take advantage of this new sorting,
so now it should sort groups of explicit ACEs (access deny, access allow)
in canonical ACLs correctly.
With that down, I've got two unit tests that still fail on Mono.
* Only translates between SecurityIdentifier and NTAccount for
well-known accounts.
* NTAccount changed to not upper-case values to match behaviour
observed in Microsoft's .NET (see also unit tests)
* Add unit tests for both classes
* IdentityReference.cs, SecurityIdentifier.cs, NTAccount.cs: Do
not recurse infinitely as reported by Jesse Jones, the problem was
the comparison to null.
svn path=/trunk/mcs/; revision=82912
* GenericIdentity.cs: Rename fields to match MS for serialization
(indirecly required to fix GenericPrincipal serialization). Also
renamed ctor parameters to match fx.
* GenericPrincipal.cs: Rename fields to match MS for serialization.
Fix bug #79030.
svn path=/trunk/mcs/; revision=63476
* IdentityNotMappedException.cs: New (2.0). Identity exception.
* IdentityReference.cs: New (2.0). Abstract base class to collect /
translate identities.
* IdentityReferenceCollection.cs: New. (2.0) Collection of
IdentityReference (e.g. groups).
* NTAccount.cs: New (2.0). Domain/User (string based)
IdentityReference.
* SecurityIdentifier.cs: New (2.0). SID (binary based)
IdentityReference.
* TokenAccessLevels.cs: New (2.0). Type of identity token.
* TokenImpersonationLevel.cs: Fixed name in header.
* WellKnownSidType.cs: New (2.0). Enum of all well known SID.
* WindowsIdentity.cs: Implement IDisposable for 2.0. Add Identity
Reference support for User, Owner and a collection for groups.
* WindowsImpersonationContext.cs: Implement IDisposable for 2.0.
* WindowsPrincipal.cs: Added IsInRole(SecurityIdentifier) for 2.0.
svn path=/trunk/mcs/; revision=46132
Fix line endings of System/Decimal.cs (only actual "change" in text, to force recompile of mscorlib to reflect changes in decimal constant handling in the compiler)
svn path=/trunk/mcs/; revision=44558
* WindowsIdentity.cs: Added security permissions for ControlPrincipal
when creating new instances of WindowsIdentity.
svn path=/trunk/mcs/; revision=39460
* WindowsIdentity.cs: Implemented for both Windows and Linux. Fix bug
#52532. Class is only missing serialization bits.
* WindowsImpersonationContext.cs: Implemented for both Windows and
Linux. Fix bug #52532.
* WindowsPrincipal.cs: Implemented for both Windows and Linux. Fix
bug #52532.
svn path=/trunk/mcs/; revision=25395
* PrincipalPolicy.cs: Added missing [Serializable] to enum.
* WindowsAccountType.cs: Added missing [Serializable] to enum.
* WindowsBuiltInRole.cs: Added missing [Serializable] to enum.
* WindowsIdentity.cs: Updated to match the unit tests.
* WindowsPrincipal.cs: Return false for a null role.
svn path=/trunk/mcs/; revision=21544
* WindowsIdentity.cs: Added ISerializable (for 1.1+) and default
implementation for constructors/properties.
* WindowsImpersonationContext.cs: Added MonoTODO on class and
NotImplementedException in constructor.
* WindowsPrincipal.cs: New. Basic implementation (mostly a stub).
svn path=/trunk/mcs/; revision=21498
* ChangeLog: Sorry it seems that I couldn't find the right combinaison
just to commit the change to changelog (probably due to convertion to
windows).
* GenericPrincipal.cs: Fixed issues found during unit testing.
svn path=/trunk/mcs/; revision=15836
* unix.args: added a couple of new files in System.Security.Principal.
* System.Security.Principal/WindowsIdentity.cs:
* System.Security.Principal/WindowsImpersonationContext.cs: stubbed.
svn path=/trunk/mcs/; revision=7072