35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/chef/chef_fs/file_system/repository/nodes_dir.rb', line 35
def create_child(child_name, file_contents = nil)
child = super
File.chmod(0600, child.file_path)
if ChefUtils.windows?
read_mask = Chef::ReservedNames::Win32::API::Security::GENERIC_READ
write_mask = Chef::ReservedNames::Win32::API::Security::GENERIC_WRITE
administrators = Chef::ReservedNames::Win32::Security::SID.Administrators
owner = Chef::ReservedNames::Win32::Security::SID.default_security_object_owner
dacl = Chef::ReservedNames::Win32::Security::ACL.create([
Chef::ReservedNames::Win32::Security::ACE.access_allowed(owner, read_mask),
Chef::ReservedNames::Win32::Security::ACE.access_allowed(owner, write_mask),
Chef::ReservedNames::Win32::Security::ACE.access_allowed(administrators, read_mask),
Chef::ReservedNames::Win32::Security::ACE.access_allowed(administrators, write_mask),
])
so = Chef::ReservedNames::Win32::Security::SecurableObject.new(child.file_path)
so.owner = owner
so.set_dacl(dacl, false)
end
child
end
|