精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
This part assumes you already know what your Access Control list contains (refer back to part 1 for advice on choosing a good DACL). Please note, that each security descriptor has a tightly-coupled relationship with the object it is securing. The reason is that each ACE bears an ACCESS_MASK member, an object dependent value.本部分假定您已经知道访问控制列表包含的内容(有关选择良好DACL的建议,请参阅第1部分)。请注意,每个安全描述符与其要保护的对象都具有紧密耦合的关系。原因是每个ACE都有一个ACCESS_MASK成员,一个对象相关值。
Here is the example ACL we will build from. This is a typical DACL for a file under the user profile:这是我们将构建的示例ACL。这是用户配置文件下文件的典型DACL:
Allow LocalSystem: Full Control (FILE_ALL_ACCESS), and propagate to all children.
Allow Admins: Full Control (FILE_ALL_ACCESS), and propagate to all children.
Allow CurrentUser: Read Write & Execute (FILE_GENERIC_READ |
FILE_GENERIC_EXECUTE | FILE_GENERIC_WRITE), and propagate to all children.
Figure 20a: Build this example DACL.
In SDDL that is:
"(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;GRGX;;;<CurrentUserSid>)"
Figure 20b: The example DACL in SDDL
It is interesting to note that this is the only method of the three that can make unordered DACLs, and NULL DACLs.有趣的是,这是三种可以制作无序DACL和NULLDACL的唯一方法。
... pDacl.AddAllowedAce(ATL::Sids::LocalSystem(), FILE_ALL_ACCESS, CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE); pDacl.AddAllowedAce(ATL::Sids::Admins(), FILE_ALL_ACCESS, CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE); pDacl.AddAllowedAce(ATL::CSid(CurrentUser), FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_WRITE, CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE); ATL::AtlSetDacl(FileName, SE_FILE_OBJECT, pDacl); ...
Figure 20c: Creating the access control list to apply to a file.