473,598 Members | 3,271 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ACE order in ACL

Even when I add (or think I do!) a new ACL in the correct order
according to http://support.microsoft.com/default...b;en-us;269159
I still get errors when trying to view the security permissions on
newley created child objects on XP. I've been twekaing the constants
all day with mixed results, but not once have I not got the "The
permissions on xxx are incorrectly ordered..." message, what am I
doing wrong??? Here's my code (what for line breaks)...

Module StartUp
Const defaultAccessMa sk As ActiveDs.ADS_RI GHTS_ENUM =
ActiveDs.ADS_RI GHTS_ENUM.ADS_R IGHT_GENERIC_RE AD +
ActiveDs.ADS_RI GHTS_ENUM.ADS_R IGHT_GENERIC_WR ITE +
ActiveDs.ADS_RI GHTS_ENUM.ADS_R IGHT_GENERIC_EX ECUTE +
ActiveDs.ADS_RI GHTS_ENUM.ADS_R IGHT_DELETE
Const defaultAceFlags As ActiveDs.ADS_AC EFLAG_ENUM =
ActiveDs.ADS_AC EFLAG_ENUM.ADS_ ACEFLAG_INHERIT _ACE
Const defaultAceType As ActiveDs.ADS_AC ETYPE_ENUM =
ActiveDs.ADS_AC ETYPE_ENUM.ADS_ ACETYPE_ACCESS_ ALLOWED

Sub Main()
Call PermissionFolde r("C:\Program Files\test",
"somedomain\use r1234", defaultAccessMa sk, defaultAceFlags ,
defaultAceType)
Call ListACEs("C:\Pr ogram Files\test")
End Sub

Sub PermissionFolde r(ByVal folderPath As String, ByVal trustee As
String, ByVal accessMask As ActiveDs.ADS_RI GHTS_ENUM, ByVal aceFlags
As ActiveDs.ADS_AC EFLAG_ENUM, ByVal aceType As
ActiveDs.ADS_AC ETYPE_ENUM)
Dim adsSecurity As New ActiveDs.ADsSec urityUtilityCla ss
Dim adsDescriptor As ActiveDs.Securi tyDescriptor
Dim folderACL As ActiveDs.Access ControlList
Dim newACE As New ActiveDs.Access ControlEntry

adsDescriptor = adsSecurity.Get SecurityDescrip tor(folderPath,
ActiveDs.ADS_PA THTYPE_ENUM.ADS _PATH_FILE,
ActiveDs.ADS_SD _FORMAT_ENUM.AD S_SD_FORMAT_IID )
folderACL = adsDescriptor.D iscretionaryAcl ()

newACE.Trustee = trustee
newACE.AccessMa sk = accessMask
newACE.AceFlags = aceFlags
newACE.AceType = aceType

folderACL.AddAc e(newACE)
adsDescriptor.D iscretionaryAcl = OrderACL(folder ACL)
adsSecurity.Set SecurityDescrip tor(folderPath,
ActiveDs.ADS_PA THTYPE_ENUM.ADS _PATH_FILE, adsDescriptor,
ActiveDs.ADS_SD _FORMAT_ENUM.AD S_SD_FORMAT_IID )
End Sub

Function OrderACL(ByVal dacl As ActiveDs.Access ControlList) As
ActiveDs.Access ControlList
Dim impDenyDACL As New ActiveDs.Access ControlList
Dim impDenyObjectDA CL As New ActiveDs.Access ControlList
Dim impAllowDACL As New ActiveDs.Access ControlList
Dim impAllowObjectD ACL As New ActiveDs.Access ControlList
Dim inheritedDACL As New ActiveDs.Access ControlList
Dim ace As ActiveDs.Access ControlEntry
Dim returnDACL As New ActiveDs.Access ControlList

For Each ace In dacl

If ace.AceFlags =
ActiveDs.ADS_AC EFLAG_ENUM.ADS_ ACEFLAG_INHERIT ED_ACE Then
inheritedDACL.A ddAce(ace)
Else

Select Case ace.AceType
Case
ActiveDs.ADS_AC ETYPE_ENUM.ADS_ ACETYPE_ACCESS_ ALLOWED
impAllowDACL.Ad dAce(ace)
Case
ActiveDs.ADS_AC ETYPE_ENUM.ADS_ ACETYPE_ACCESS_ DENIED
impDenyDACL.Add Ace(ace)
Case
ActiveDs.ADS_AC ETYPE_ENUM.ADS_ ACETYPE_ACCESS_ ALLOWED_OBJECT
impAllowObjectD ACL.AddAce(ace)
Case
ActiveDs.ADS_AC ETYPE_ENUM.ADS_ ACETYPE_ACCESS_ DENIED_OBJECT
impDenyObjectDA CL.AddAce(ace)
End Select

End If

Next

For Each ace In impDenyDACL
returnDACL.AddA ce(ace)
Next

For Each ace In impDenyObjectDA CL
returnDACL.AddA ce(ace)
Next

For Each ace In impAllowDACL
returnDACL.AddA ce(ace)
Next

For Each ace In impAllowObjectD ACL
returnDACL.AddA ce(ace)
Next

For Each ace In inheritedDACL
returnDACL.AddA ce(ace)
Next

returnDACL.AclR evision = dacl.AclRevisio n

Return returnDACL
End Function

Sub ListACEs(ByVal folderPath As String)
Dim securityObj As New ActiveDs.ADsSec urityUtilityCla ss
Dim descriptorObj As ActiveDs.Securi tyDescriptor
Dim aclObj As ActiveDs.Access ControlList
Dim aceObj As ActiveDs.Access ControlEntry
Dim aceOutput As String

descriptorObj = securityObj.Get SecurityDescrip tor(folderPath,
ActiveDs.ADS_PA THTYPE_ENUM.ADS _PATH_FILE,
ActiveDs.ADS_SD _FORMAT_ENUM.AD S_SD_FORMAT_IID )
aclObj = descriptorObj.D iscretionaryAcl ()

For Each aceObj In aclObj
aceOutput = aceOutput & aceObj.Trustee & vbTab &
aceObj.AccessMa sk & vbTab & aceObj.AceFlags & vbTab & aceObj.AceType &
vbTab & aceObj.Inherite dObjectType & vbCrLf
Next

MessageBox.Show (aceOutput)
End Sub
End Module
Jul 21 '05 #1
0 2467

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3649
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc. And i have things to offer, and to request. And a lot of ideas, but who needs them.... here's an example (from type_struct.py):
9
2725
by: Steven T. Hatton | last post by:
The following works: template <typename T> struct ID3M{ static const T ID; }; template <typename T> const T ID3M<T>::ID = {{1,0,0},{0,1,0},{0,0,1}};
15
4306
by: | last post by:
The data file is a simple Unicode file with lines of text. BCP apparently doesn't guarantee this ordering, and neither does the import tool. I want to be able to load the data either sequentially or add line numbering to large Unicode file (1 million lines). I don't want to deal with another programming language if possible and I wonder if there's a trick in SQL Server to get this accomplished. Thanks for any help. Mark Leary
27
11145
by: Abdullah Kauchali | last post by:
Hi folks, Can one rely on the order of keys inserted into an associative Javascript array? For example: var o = new Object(); o = "Adam"; o = "Eve";
8
6803
by: kaosyeti | last post by:
i have a (hopefully) small problem. i have created a system where a user enters customer information into a table through a form. this table has no primary key. there are 9 fields on the form to be filled in, one of which is a date field. right now, i've been using this db myself and have entered only 10 days of sample data to check my calculations but i realized that there may be times when i need to add a record that was missed that...
104
10837
by: Beowulf | last post by:
I have the view below and if I use vwRouteReference as the rowsource for a combo box in an MS Access form or run "SELECT * FROM vwRouteReference" in SQL Query Analyzer, the rows don't come through sorted by Numb. Everything I've read on the web suggests that including the TOP directive should enable ORDERY BY in views. Does someone have an idea why the sorting is not working correctly for this particular view? thanks. CREATE VIEW...
13
4428
by: bevanward | last post by:
Hi All I am finding unexpected results when inserted into a newly created table that has a field of datatype int identity (1,1). Basically the order I sort on when inserting into the table is not reflected in the order of the values from the identity field. Have I been wrong in assuming that it should reflect the order from the sort?
3
3977
by: Hartmut Dippon | last post by:
Hi all, I hope somebody can help me with following problem: I have an application where I can drag&drop files/dirs from within explorer onto my form. If multiple files/dirs are selected I can see that the order I get in my drop event is not always the same as displayed in the explorer window. Further more the order changes depending on how many files/dirs are
54
3903
by: Rasjid | last post by:
Hello, I have just joined and this is my first post. I have never been able to resolve the issue of order of evaluation in C/C++ and the related issue of precedence of operators, use of parentheses. 1) "The order of evaluation of subexpressions is determined by the precedence and grouping of operators."
25
2825
by: DanicaDear | last post by:
Hello again Bytes...I missed you! First, background: In a hotstick lab, we ship orders every two years. We ship a new order and the customer uses the new box to return the previous year's order. For example, in November 2007 we shipped an order. November 2009 those sticks expire, and we ship a new order (because customers can't be without sticks) and when they receive the new 2009 order they ship back the old 2007 order. A box number...
0
7991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7902
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8395
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8398
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8050
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5850
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5438
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3939
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1504
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.