Hi,
use the Translate method to convert the IdentityReference to a SecurityIdentifier
or NTAccount object.
haven't tried it - but this should get you closer.
// List DACLs in order
Console.WriteLine("\nDACLs:");
foreach (FileSystemAccessRule rule in security.GetAccessRules(true,
true, typeof(NTAccount)))
{
Console.WriteLine("{0} {1} access to {2}",
rule.AccessControlType == AccessControlType.Allow ?
"grant: " : "deny: ",
rule.FileSystemRights,
rule.IdentityReference.ToString());
SecurityIdentifier sid = (SecurityIdentifier)rule.IdentityReference.Translate(typeof(SecurityIdentifier));
Console.WriteLine(sid.Value);
}
---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com
> Hi Dominick,
>
[quoted text clipped - 97 lines]
>>>>>>> Best regards,
>>>>>>> Bart Vries
Bart Vries - 09 Jan 2006 14:29 GMT
Hi Dominick,
I also got this far, but now I got a sid and I still don't know if the
system account sid is part of the group returned by the
rule.IdentityReference. This is because the file can have, for example,
defined full control rights for the everyone group. Sorry if I wasn't clear
before. I need to find out if the system account is part of that group so I
know if the system account has rights to write the file.
Thanks in advance,
Bart Vries
> Hi,
>
[quoted text clipped - 122 lines]
> >>>>>>> Best regards,
> >>>>>>> Bart Vries
Dominick Baier [DevelopMentor] - 09 Jan 2006 14:44 GMT
hi,
to be honest - that's not how the SYSTEM account is supposed to be used.
---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com
> Hi Dominick,
>
[quoted text clipped - 151 lines]
>>>>>>>>> Best regards,
>>>>>>>>> Bart Vries
Bart Vries - 10 Jan 2006 17:50 GMT
Hi Dominick,
To problem is that msi installer does certain actions on the server side.
These actions execute as the system account. We have over 10k customers. Some
customers seem to remove system account rights on some dirs and files which
cause the msi installer to rollback. They call our support department. I want
to build a tool to check if the system account has rights on the appropriate
files. So it is not an issue of how the system account should be used. MS
installer forces me to use the system account. I think the problem is that
the .net security api's are not rich enough (yet) to do this check.
I'll try to use the AuthzAccessCheck function to do the check instead.
Best regards,
Bart Vries
> hi,
>
[quoted text clipped - 159 lines]
> >>>>>>>>> Best regards,
> >>>>>>>>> Bart Vries