chef 0.10.10 → 10.12.0.rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. data/README.rdoc +6 -0
  2. data/distro/common/html/chef-client.8.html +4 -3
  3. data/distro/common/html/chef-expander.8.html +3 -3
  4. data/distro/common/html/chef-expanderctl.8.html +3 -3
  5. data/distro/common/html/chef-server-webui.8.html +3 -3
  6. data/distro/common/html/chef-server.8.html +3 -3
  7. data/distro/common/html/chef-solo.8.html +3 -3
  8. data/distro/common/html/chef-solr.8.html +3 -3
  9. data/distro/common/html/knife-bootstrap.1.html +3 -3
  10. data/distro/common/html/knife-client.1.html +3 -3
  11. data/distro/common/html/knife-configure.1.html +3 -3
  12. data/distro/common/html/knife-cookbook-site.1.html +3 -3
  13. data/distro/common/html/knife-cookbook.1.html +3 -3
  14. data/distro/common/html/knife-data-bag.1.html +3 -3
  15. data/distro/common/html/knife-environment.1.html +3 -3
  16. data/distro/common/html/knife-exec.1.html +3 -3
  17. data/distro/common/html/knife-index.1.html +3 -3
  18. data/distro/common/html/knife-node.1.html +3 -3
  19. data/distro/common/html/knife-role.1.html +3 -3
  20. data/distro/common/html/knife-search.1.html +3 -3
  21. data/distro/common/html/knife-ssh.1.html +3 -3
  22. data/distro/common/html/knife-status.1.html +3 -3
  23. data/distro/common/html/knife-tag.1.html +3 -3
  24. data/distro/common/html/knife.1.html +3 -3
  25. data/distro/common/html/shef.1.html +3 -3
  26. data/distro/common/man/man1/knife-bootstrap.1 +1 -1
  27. data/distro/common/man/man1/knife-client.1 +1 -1
  28. data/distro/common/man/man1/knife-configure.1 +1 -1
  29. data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
  30. data/distro/common/man/man1/knife-cookbook.1 +1 -1
  31. data/distro/common/man/man1/knife-data-bag.1 +1 -1
  32. data/distro/common/man/man1/knife-environment.1 +1 -1
  33. data/distro/common/man/man1/knife-exec.1 +1 -1
  34. data/distro/common/man/man1/knife-index.1 +1 -1
  35. data/distro/common/man/man1/knife-node.1 +1 -1
  36. data/distro/common/man/man1/knife-role.1 +1 -1
  37. data/distro/common/man/man1/knife-search.1 +1 -1
  38. data/distro/common/man/man1/knife-ssh.1 +1 -1
  39. data/distro/common/man/man1/knife-status.1 +1 -1
  40. data/distro/common/man/man1/knife-tag.1 +1 -1
  41. data/distro/common/man/man1/knife.1 +1 -1
  42. data/distro/common/man/man1/shef.1 +1 -1
  43. data/distro/common/man/man8/chef-client.8 +5 -1
  44. data/distro/common/man/man8/chef-expander.8 +1 -1
  45. data/distro/common/man/man8/chef-expanderctl.8 +1 -1
  46. data/distro/common/man/man8/chef-server-webui.8 +1 -1
  47. data/distro/common/man/man8/chef-server.8 +1 -1
  48. data/distro/common/man/man8/chef-solo.8 +1 -1
  49. data/distro/common/man/man8/chef-solr.8 +1 -1
  50. data/distro/common/markdown/man8/chef-client.mkd +2 -0
  51. data/lib/chef/application/client.rb +1 -1
  52. data/lib/chef/application/solo.rb +1 -1
  53. data/lib/chef/application/windows_service.rb +1 -1
  54. data/lib/chef/config.rb +1 -1
  55. data/lib/chef/exceptions.rb +3 -0
  56. data/lib/chef/file_access_control/unix.rb +21 -6
  57. data/lib/chef/file_access_control/windows.rb +7 -7
  58. data/lib/chef/knife/ssh.rb +4 -2
  59. data/lib/chef/mixin/enforce_ownership_and_permissions.rb +1 -1
  60. data/lib/chef/provider/link.rb +49 -45
  61. data/lib/chef/provider/mdadm.rb +4 -1
  62. data/lib/chef/provider/package/rubygems.rb +2 -1
  63. data/lib/chef/provider/remote_file.rb +17 -1
  64. data/lib/chef/reserved_names.rb +9 -0
  65. data/lib/chef/resource/link.rb +1 -17
  66. data/lib/chef/resource/mdadm.rb +1 -1
  67. data/lib/chef/resource_platform_map.rb +1 -3
  68. data/lib/chef/rest.rb +48 -17
  69. data/lib/chef/version.rb +1 -1
  70. data/lib/chef/win32/api.rb +16 -1
  71. data/lib/chef/win32/api/error.rb +9 -9
  72. data/lib/chef/win32/api/file.rb +263 -17
  73. data/lib/chef/win32/api/memory.rb +12 -12
  74. data/lib/chef/win32/api/process.rb +5 -5
  75. data/lib/chef/win32/api/psapi.rb +3 -3
  76. data/lib/chef/win32/api/security.rb +41 -41
  77. data/lib/chef/win32/api/system.rb +8 -8
  78. data/lib/chef/win32/api/unicode.rb +6 -6
  79. data/lib/chef/win32/error.rb +4 -4
  80. data/lib/chef/win32/file.rb +65 -15
  81. data/lib/chef/win32/file/info.rb +7 -7
  82. data/lib/chef/win32/handle.rb +3 -3
  83. data/lib/chef/win32/memory.rb +8 -8
  84. data/lib/chef/win32/process.rb +8 -8
  85. data/lib/chef/win32/security.rb +49 -49
  86. data/lib/chef/win32/security/ace.rb +11 -11
  87. data/lib/chef/win32/security/acl.rb +10 -10
  88. data/lib/chef/win32/security/securable_object.rb +13 -13
  89. data/lib/chef/win32/security/security_descriptor.rb +12 -12
  90. data/lib/chef/win32/security/sid.rb +8 -8
  91. data/lib/chef/win32/security/token.rb +8 -8
  92. data/lib/chef/win32/unicode.rb +5 -5
  93. data/lib/chef/win32/version.rb +4 -4
  94. metadata +374 -370
@@ -19,17 +19,17 @@
19
19
  require 'chef/win32/file'
20
20
 
21
21
  class Chef
22
- module Win32
22
+ module ReservedNames::Win32
23
23
  class File
24
24
 
25
- # Objects of class Chef::Win32::File::Stat encapsulate common status
26
- # information for Chef::Win32::File objects. The information
27
- # is recorded at the moment the Chef::Win32::File::Stat object is
25
+ # Objects of class Chef::ReservedNames::Win32::File::Stat encapsulate common status
26
+ # information for Chef::ReservedNames::Win32::File objects. The information
27
+ # is recorded at the moment the Chef::ReservedNames::Win32::File::Stat object is
28
28
  # created; changes made to the file after that point will not be reflected.
29
29
  class Info
30
30
 
31
- include Chef::Win32::API::File
32
- include Chef::Win32::API
31
+ include Chef::ReservedNames::Win32::API::File
32
+ include Chef::ReservedNames::Win32::API
33
33
 
34
34
  # http://msdn.microsoft.com/en-us/library/windows/desktop/aa363788(v=vs.85).aspx
35
35
  def initialize(file_name)
@@ -85,7 +85,7 @@ class Chef
85
85
  end
86
86
  ##############################
87
87
 
88
- # given a +Chef::Win32::API::File::FILETIME+ structure convert into a
88
+ # given a +Chef::ReservedNames::Win32::API::File::FILETIME+ structure convert into a
89
89
  # Ruby +Time+ object.
90
90
  #
91
91
  def parse_time(file_time_struct)
@@ -22,9 +22,9 @@ require 'chef/win32/api/system'
22
22
  require 'chef/win32/error'
23
23
 
24
24
  class Chef
25
- module Win32
25
+ module ReservedNames::Win32
26
26
  class Handle
27
- extend Chef::Win32::API::Process
27
+ extend Chef::ReservedNames::Win32::API::Process
28
28
 
29
29
  def initialize(handle)
30
30
  @handle = handle
@@ -39,7 +39,7 @@ class Chef
39
39
 
40
40
  def self.close_handle(handle)
41
41
  unless CloseHandle(handle)
42
- Chef::Win32::Error.raise!
42
+ Chef::ReservedNames::Win32::Error.raise!
43
43
  end
44
44
  end
45
45
 
@@ -20,10 +20,10 @@ require 'chef/win32/error'
20
20
  require 'chef/win32/api/memory'
21
21
 
22
22
  class Chef
23
- module Win32
23
+ module ReservedNames::Win32
24
24
  class Memory
25
- include Chef::Win32::API::Memory
26
- extend Chef::Win32::API::Memory
25
+ include Chef::ReservedNames::Win32::API::Memory
26
+ extend Chef::ReservedNames::Win32::API::Memory
27
27
 
28
28
  # local_alloc(length[, flags]) [BLOCK]
29
29
  # Allocates memory using LocalAlloc
@@ -32,7 +32,7 @@ class Chef
32
32
  def self.local_alloc(length, flags = LPTR, &block)
33
33
  result = LocalAlloc(flags, length)
34
34
  if result.null?
35
- Chef::Win32::Error.raise!
35
+ Chef::ReservedNames::Win32::Error.raise!
36
36
  end
37
37
  # If a block is passed, handle freeing the memory at the end
38
38
  if block != nil
@@ -58,7 +58,7 @@ class Chef
58
58
  def self.local_flags(pointer)
59
59
  result = LocalFlags(pointer)
60
60
  if result == LMEM_INVALID_HANDLE
61
- Chef::Win32::Error.raise!
61
+ Chef::ReservedNames::Win32::Error.raise!
62
62
  end
63
63
  [ result & ~LMEM_LOCKCOUNT, result & LMEM_LOCKCOUNT ]
64
64
  end
@@ -68,7 +68,7 @@ class Chef
68
68
  def self.local_free(pointer)
69
69
  result = LocalFree(pointer)
70
70
  if !result.null?
71
- Chef::Win32::Error.raise!
71
+ Chef::ReservedNames::Win32::Error.raise!
72
72
  end
73
73
  end
74
74
 
@@ -77,7 +77,7 @@ class Chef
77
77
  def self.local_realloc(pointer, size, flags = LMEM_MOVEABLE | LMEM_ZEROINIT)
78
78
  result = LocalReAlloc(pointer, size, flags)
79
79
  if result.null?
80
- Chef::Win32::Error.raise!
80
+ Chef::ReservedNames::Win32::Error.raise!
81
81
  end
82
82
  result
83
83
  end
@@ -87,7 +87,7 @@ class Chef
87
87
  def self.local_size(pointer)
88
88
  result = LocalSize(pointer)
89
89
  if result == 0
90
- Chef::Win32::Error.raise!
90
+ Chef::ReservedNames::Win32::Error.raise!
91
91
  end
92
92
  result
93
93
  end
@@ -23,12 +23,12 @@ require 'chef/win32/handle'
23
23
  require 'ffi'
24
24
 
25
25
  class Chef
26
- module Win32
26
+ module ReservedNames::Win32
27
27
  class Process
28
- include Chef::Win32::API::Process
29
- extend Chef::Win32::API::Process
30
- include Chef::Win32::API::PSAPI
31
- extend Chef::Win32::API::PSAPI
28
+ include Chef::ReservedNames::Win32::API::Process
29
+ extend Chef::ReservedNames::Win32::API::Process
30
+ include Chef::ReservedNames::Win32::API::PSAPI
31
+ extend Chef::ReservedNames::Win32::API::PSAPI
32
32
 
33
33
  def initialize(handle)
34
34
  @handle = handle
@@ -55,7 +55,7 @@ class Chef
55
55
  def self.get_process_handle_count(handle)
56
56
  handle_count = FFI::MemoryPointer.new :uint32
57
57
  unless GetProcessHandleCount(handle.handle, handle_count)
58
- Chef::Win32::Error.raise!
58
+ Chef::ReservedNames::Win32::Error.raise!
59
59
  end
60
60
  handle_count.read_uint32
61
61
  end
@@ -64,7 +64,7 @@ class Chef
64
64
  # Must have PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION rights
65
65
  result = GetProcessId(handle.handle)
66
66
  if result == 0
67
- Chef::Win32::Error.raise!
67
+ Chef::ReservedNames::Win32::Error.raise!
68
68
  end
69
69
  result
70
70
  end
@@ -74,7 +74,7 @@ class Chef
74
74
  def self.get_process_memory_info(handle)
75
75
  memory_info = PROCESS_MEMORY_COUNTERS.new
76
76
  unless GetProcessMemoryInfo(handle.handle, memory_info, memory_info.size)
77
- Chef::Win32::Error.raise!
77
+ Chef::ReservedNames::Win32::Error.raise!
78
78
  end
79
79
  memory_info
80
80
  end
@@ -24,20 +24,20 @@ require 'chef/win32/unicode'
24
24
  require 'chef/win32/security/token'
25
25
 
26
26
  class Chef
27
- module Win32
27
+ module ReservedNames::Win32
28
28
  class Security
29
- include Chef::Win32::API::Error
30
- extend Chef::Win32::API::Error
31
- include Chef::Win32::API::Security
32
- extend Chef::Win32::API::Security
33
- extend Chef::Win32::API::Macros
29
+ include Chef::ReservedNames::Win32::API::Error
30
+ extend Chef::ReservedNames::Win32::API::Error
31
+ include Chef::ReservedNames::Win32::API::Security
32
+ extend Chef::ReservedNames::Win32::API::Security
33
+ extend Chef::ReservedNames::Win32::API::Macros
34
34
 
35
35
  def self.add_ace(acl, ace, insert_position = MAXDWORD, revision = ACL_REVISION)
36
36
  acl = acl.pointer if acl.respond_to?(:pointer)
37
37
  ace = ace.pointer if ace.respond_to?(:pointer)
38
38
  ace_size = ACE_HEADER.new(ace)[:AceSize]
39
39
  unless AddAce(acl, revision, insert_position, ace, ace_size)
40
- Chef::Win32::Error.raise!
40
+ Chef::ReservedNames::Win32::Error.raise!
41
41
  end
42
42
  end
43
43
 
@@ -45,7 +45,7 @@ class Chef
45
45
  acl = acl.pointer if acl.respond_to?(:pointer)
46
46
  sid = sid.pointer if sid.respond_to?(:pointer)
47
47
  unless AddAccessAllowedAce(acl, revision, access_mask, sid)
48
- Chef::Win32::Error.raise!
48
+ Chef::ReservedNames::Win32::Error.raise!
49
49
  end
50
50
  end
51
51
 
@@ -53,7 +53,7 @@ class Chef
53
53
  acl = acl.pointer if acl.respond_to?(:pointer)
54
54
  sid = sid.pointer if sid.respond_to?(:pointer)
55
55
  unless AddAccessAllowedAceEx(acl, revision, flags, access_mask, sid)
56
- Chef::Win32::Error.raise!
56
+ Chef::ReservedNames::Win32::Error.raise!
57
57
  end
58
58
  end
59
59
 
@@ -61,7 +61,7 @@ class Chef
61
61
  acl = acl.pointer if acl.respond_to?(:pointer)
62
62
  sid = sid.pointer if sid.respond_to?(:pointer)
63
63
  unless AddAccessDeniedAce(acl, revision, access_mask, sid)
64
- Chef::Win32::Error.raise!
64
+ Chef::ReservedNames::Win32::Error.raise!
65
65
  end
66
66
  end
67
67
 
@@ -69,7 +69,7 @@ class Chef
69
69
  acl = acl.pointer if acl.respond_to?(:pointer)
70
70
  sid = sid.pointer if sid.respond_to?(:pointer)
71
71
  unless AddAccessDeniedAceEx(acl, revision, flags, access_mask, sid)
72
- Chef::Win32::Error.raise!
72
+ Chef::ReservedNames::Win32::Error.raise!
73
73
  end
74
74
  end
75
75
 
@@ -78,7 +78,7 @@ class Chef
78
78
  old_privileges_size = FFI::Buffer.new(:long).write_long(privileges.size_with_privileges)
79
79
  old_privileges = TOKEN_PRIVILEGES.new(FFI::Buffer.new(old_privileges_size.read_long))
80
80
  unless AdjustTokenPrivileges(token.handle, false, privileges, privileges.size_with_privileges, old_privileges, old_privileges_size)
81
- Chef::Win32::Error.raise!
81
+ Chef::ReservedNames::Win32::Error.raise!
82
82
  end
83
83
 
84
84
  old_privileges
@@ -89,12 +89,12 @@ class Chef
89
89
  result = FFI::MemoryPointer.new :pointer
90
90
  # TODO: use the W version
91
91
  unless ConvertSidToStringSidA(sid, result)
92
- Chef::Win32::Error.raise!
92
+ Chef::ReservedNames::Win32::Error.raise!
93
93
  end
94
94
 
95
95
  result_string = result.read_pointer.read_string
96
96
 
97
- Chef::Win32::Memory.local_free(result.read_pointer)
97
+ Chef::ReservedNames::Win32::Memory.local_free(result.read_pointer)
98
98
 
99
99
  result_string
100
100
  end
@@ -102,7 +102,7 @@ class Chef
102
102
  def self.convert_string_sid_to_sid(string_sid)
103
103
  result = FFI::MemoryPointer.new :pointer
104
104
  unless ConvertStringSidToSidW(string_sid.to_wstring, result)
105
- Chef::Win32::Error.raise!
105
+ Chef::ReservedNames::Win32::Error.raise!
106
106
  end
107
107
 
108
108
  result_pointer = result.read_pointer
@@ -117,7 +117,7 @@ class Chef
117
117
  def self.delete_ace(acl, index)
118
118
  acl = acl.pointer if acl.respond_to?(:pointer)
119
119
  unless DeleteAce(acl, index)
120
- Chef::Win32::Error.raise!
120
+ Chef::ReservedNames::Win32::Error.raise!
121
121
  end
122
122
  end
123
123
 
@@ -130,7 +130,7 @@ class Chef
130
130
  def self.free_sid(sid)
131
131
  sid = sid.pointer if sid.respond_to?(:pointer)
132
132
  unless FreeSid(sid).null?
133
- Chef::Win32::Error.raise!
133
+ Chef::ReservedNames::Win32::Error.raise!
134
134
  end
135
135
  end
136
136
 
@@ -138,7 +138,7 @@ class Chef
138
138
  acl = acl.pointer if acl.respond_to?(:pointer)
139
139
  ace = FFI::Buffer.new :pointer
140
140
  unless GetAce(acl, index, ace)
141
- Chef::Win32::Error.raise!
141
+ Chef::ReservedNames::Win32::Error.raise!
142
142
  end
143
143
  ACE.new(ace.read_pointer, acl)
144
144
  end
@@ -152,7 +152,7 @@ class Chef
152
152
  security_descriptor = FFI::MemoryPointer.new :pointer
153
153
  hr = GetNamedSecurityInfoW(path.to_wstring, type, info, nil, nil, nil, nil, security_descriptor)
154
154
  if hr != ERROR_SUCCESS
155
- Chef::Win32::Error.raise!("get_named_security_info(#{path}, #{type}, #{info})")
155
+ Chef::ReservedNames::Win32::Error.raise!("get_named_security_info(#{path}, #{type}, #{info})")
156
156
  end
157
157
 
158
158
  result_pointer = security_descriptor.read_pointer
@@ -169,7 +169,7 @@ class Chef
169
169
  result = FFI::Buffer.new :ushort
170
170
  version = FFI::Buffer.new :uint32
171
171
  unless GetSecurityDescriptorControl(security_descriptor, result, version)
172
- Chef::Win32::Error.raise!
172
+ Chef::ReservedNames::Win32::Error.raise!
173
173
  end
174
174
  [ result.read_ushort, version.read_uint32 ]
175
175
  end
@@ -180,7 +180,7 @@ class Chef
180
180
  defaulted = FFI::Buffer.new :bool
181
181
  acl = FFI::Buffer.new :pointer
182
182
  unless GetSecurityDescriptorDacl(security_descriptor, present, acl, defaulted)
183
- Chef::Win32::Error.raise!
183
+ Chef::ReservedNames::Win32::Error.raise!
184
184
  end
185
185
  acl = acl.read_pointer
186
186
  [ present.read_char != 0, acl.null? ? nil : ACL.new(acl, security_descriptor), defaulted.read_char != 0 ]
@@ -191,7 +191,7 @@ class Chef
191
191
  result = FFI::Buffer.new :pointer
192
192
  defaulted = FFI::Buffer.new :long
193
193
  unless GetSecurityDescriptorGroup(security_descriptor, result, defaulted)
194
- Chef::Win32::Error.raise!
194
+ Chef::ReservedNames::Win32::Error.raise!
195
195
  end
196
196
 
197
197
  sid = SID.new(result.read_pointer, security_descriptor)
@@ -204,7 +204,7 @@ class Chef
204
204
  result = FFI::Buffer.new :pointer
205
205
  defaulted = FFI::Buffer.new :long
206
206
  unless GetSecurityDescriptorOwner(security_descriptor, result, defaulted)
207
- Chef::Win32::Error.raise!
207
+ Chef::ReservedNames::Win32::Error.raise!
208
208
  end
209
209
 
210
210
  sid = SID.new(result.read_pointer, security_descriptor)
@@ -218,7 +218,7 @@ class Chef
218
218
  defaulted = FFI::Buffer.new :bool
219
219
  acl = FFI::Buffer.new :pointer
220
220
  unless GetSecurityDescriptorSacl(security_descriptor, present, acl, defaulted)
221
- Chef::Win32::Error.raise!
221
+ Chef::ReservedNames::Win32::Error.raise!
222
222
  end
223
223
  acl = acl.read_pointer
224
224
  [ present.read_char != 0, acl.null? ? nil : ACL.new(acl, security_descriptor), defaulted.read_char != 0 ]
@@ -227,7 +227,7 @@ class Chef
227
227
  def self.initialize_acl(acl_size)
228
228
  acl = FFI::MemoryPointer.new acl_size
229
229
  unless InitializeAcl(acl, acl_size, ACL_REVISION)
230
- Chef::Win32::Error.raise!
230
+ Chef::ReservedNames::Win32::Error.raise!
231
231
  end
232
232
  ACL.new(acl)
233
233
  end
@@ -235,7 +235,7 @@ class Chef
235
235
  def self.initialize_security_descriptor(revision = SECURITY_DESCRIPTOR_REVISION)
236
236
  security_descriptor = FFI::MemoryPointer.new SECURITY_DESCRIPTOR_MIN_LENGTH
237
237
  unless InitializeSecurityDescriptor(security_descriptor, revision)
238
- Chef::Win32::Error.raise!
238
+ Chef::ReservedNames::Win32::Error.raise!
239
239
  end
240
240
  SecurityDescriptor.new(security_descriptor)
241
241
  end
@@ -262,15 +262,15 @@ class Chef
262
262
  system_name = system_name.to_wstring if system_name
263
263
  if LookupAccountNameW(system_name, name.to_wstring, nil, sid_size, nil, referenced_domain_name_size, nil)
264
264
  raise "Expected ERROR_INSUFFICIENT_BUFFER from LookupAccountName, and got no error!"
265
- elsif Chef::Win32::Error.get_last_error != ERROR_INSUFFICIENT_BUFFER
266
- Chef::Win32::Error.raise!
265
+ elsif Chef::ReservedNames::Win32::Error.get_last_error != ERROR_INSUFFICIENT_BUFFER
266
+ Chef::ReservedNames::Win32::Error.raise!
267
267
  end
268
268
 
269
269
  sid = FFI::MemoryPointer.new :char, sid_size.read_long
270
270
  referenced_domain_name = FFI::MemoryPointer.new :char, (referenced_domain_name_size.read_long*2)
271
271
  use = FFI::Buffer.new(:long).write_long(0)
272
272
  unless LookupAccountNameW(system_name, name.to_wstring, sid, sid_size, referenced_domain_name, referenced_domain_name_size, use)
273
- Chef::Win32::Error.raise!
273
+ Chef::ReservedNames::Win32::Error.raise!
274
274
  end
275
275
 
276
276
  [ referenced_domain_name.read_wstring(referenced_domain_name_size.read_long), SID.new(sid), use.read_long ]
@@ -284,15 +284,15 @@ class Chef
284
284
  system_name = system_name.to_wstring if system_name
285
285
  if LookupAccountSidW(system_name, sid, nil, name_size, nil, referenced_domain_name_size, nil)
286
286
  raise "Expected ERROR_INSUFFICIENT_BUFFER from LookupAccountSid, and got no error!"
287
- elsif Chef::Win32::Error::get_last_error != ERROR_INSUFFICIENT_BUFFER
288
- Chef::Win32::Error.raise!
287
+ elsif Chef::ReservedNames::Win32::Error::get_last_error != ERROR_INSUFFICIENT_BUFFER
288
+ Chef::ReservedNames::Win32::Error.raise!
289
289
  end
290
290
 
291
291
  name = FFI::MemoryPointer.new :char, (name_size.read_long*2)
292
292
  referenced_domain_name = FFI::MemoryPointer.new :char, (referenced_domain_name_size.read_long*2)
293
293
  use = FFI::Buffer.new(:long).write_long(0)
294
294
  unless LookupAccountSidW(system_name, sid, name, name_size, referenced_domain_name, referenced_domain_name_size, use)
295
- Chef::Win32::Error.raise!
295
+ Chef::ReservedNames::Win32::Error.raise!
296
296
  end
297
297
 
298
298
  [ referenced_domain_name.read_wstring(referenced_domain_name_size.read_long), name.read_wstring(name_size.read_long), use.read_long ]
@@ -303,13 +303,13 @@ class Chef
303
303
  name_size = FFI::Buffer.new(:long).write_long(0)
304
304
  if LookupPrivilegeNameW(system_name, luid, nil, name_size)
305
305
  raise "Expected ERROR_INSUFFICIENT_BUFFER from LookupPrivilegeName, and got no error!"
306
- elsif Chef::Win32::Error.get_last_error != ERROR_INSUFFICIENT_BUFFER
307
- Chef::Win32::Error.raise!
306
+ elsif Chef::ReservedNames::Win32::Error.get_last_error != ERROR_INSUFFICIENT_BUFFER
307
+ Chef::ReservedNames::Win32::Error.raise!
308
308
  end
309
309
 
310
310
  name = FFI::MemoryPointer.new :char, (name_size.read_long*2)
311
311
  unless LookupPrivilegeNameW(system_name, luid, name, name_size)
312
- Chef::Win32::Error.raise!
312
+ Chef::ReservedNames::Win32::Error.raise!
313
313
  end
314
314
 
315
315
  name.read_wstring(name_size.read_long)
@@ -321,13 +321,13 @@ class Chef
321
321
  language_id = FFI::Buffer.new(:long)
322
322
  if LookupPrivilegeDisplayNameW(system_name, name.to_wstring, nil, display_name_size, language_id)
323
323
  raise "Expected ERROR_INSUFFICIENT_BUFFER from LookupPrivilegeDisplayName, and got no error!"
324
- elsif Chef::Win32::Error.get_last_error != ERROR_INSUFFICIENT_BUFFER
325
- Chef::Win32::Error.raise!
324
+ elsif Chef::ReservedNames::Win32::Error.get_last_error != ERROR_INSUFFICIENT_BUFFER
325
+ Chef::ReservedNames::Win32::Error.raise!
326
326
  end
327
327
 
328
328
  display_name = FFI::MemoryPointer.new :char, (display_name_size.read_long*2)
329
329
  unless LookupPrivilegeDisplayNameW(system_name, name.to_wstring, display_name, display_name_size, language_id)
330
- Chef::Win32::Error.raise!
330
+ Chef::ReservedNames::Win32::Error.raise!
331
331
  end
332
332
 
333
333
  [ display_name.read_wstring(display_name_size.read_long), language_id.read_long ]
@@ -353,8 +353,8 @@ class Chef
353
353
  group_size = FFI::Buffer.new(:long).write_long(0)
354
354
  if MakeAbsoluteSD(security_descriptor, nil, absolute_sd_size, nil, dacl_size, nil, sacl_size, nil, owner_size, nil, group_size)
355
355
  raise "Expected ERROR_INSUFFICIENT_BUFFER from MakeAbsoluteSD, and got no error!"
356
- elsif Chef::Win32::Error.get_last_error != ERROR_INSUFFICIENT_BUFFER
357
- Chef::Win32::Error.raise!
356
+ elsif Chef::ReservedNames::Win32::Error.get_last_error != ERROR_INSUFFICIENT_BUFFER
357
+ Chef::ReservedNames::Win32::Error.raise!
358
358
  end
359
359
 
360
360
  absolute_sd = FFI::MemoryPointer.new absolute_sd_size.read_long
@@ -363,7 +363,7 @@ class Chef
363
363
  dacl = FFI::MemoryPointer.new dacl_size.read_long
364
364
  sacl = FFI::MemoryPointer.new sacl_size.read_long
365
365
  unless MakeAbsoluteSD(security_descriptor, absolute_sd, absolute_sd_size, dacl, dacl_size, sacl, sacl_size, owner, owner_size, group, group_size)
366
- Chef::Win32::Error.raise!
366
+ Chef::ReservedNames::Win32::Error.raise!
367
367
  end
368
368
 
369
369
  [ SecurityDescriptor.new(absolute_sd), SID.new(owner), SID.new(group), ACL.new(dacl), ACL.new(sacl) ]
@@ -374,7 +374,7 @@ class Chef
374
374
  process = process.handle if process.respond_to?(:handle)
375
375
  token = FFI::Buffer.new(:ulong)
376
376
  unless OpenProcessToken(process, desired_access, token)
377
- Chef::Win32::Error.raise!
377
+ Chef::ReservedNames::Win32::Error.raise!
378
378
  end
379
379
  Token.new(Handle.new(token.read_ulong))
380
380
  end
@@ -388,7 +388,7 @@ class Chef
388
388
  def self.set_file_security(path, security_information, security_descriptor)
389
389
  security_descriptor = security_descriptor.pointer if security_descriptor.respond_to?(:pointer)
390
390
  unless SetFileSecurityW(path.to_wstring, security_information, security_descriptor)
391
- Chef::Win32::Error.raise!
391
+ Chef::ReservedNames::Win32::Error.raise!
392
392
  end
393
393
  end
394
394
 
@@ -417,7 +417,7 @@ class Chef
417
417
 
418
418
  hr = SetNamedSecurityInfoW(path.to_wstring, type, security_information, owner, group, dacl, sacl)
419
419
  if hr != ERROR_SUCCESS
420
- Chef::Win32::Error.raise!
420
+ Chef::ReservedNames::Win32::Error.raise!
421
421
  end
422
422
  end
423
423
 
@@ -433,7 +433,7 @@ class Chef
433
433
  present = !security_descriptor.null? if present == nil
434
434
 
435
435
  unless SetSecurityDescriptorDacl(security_descriptor, present, acl, defaulted)
436
- Chef::Win32::Error.raise!
436
+ Chef::ReservedNames::Win32::Error.raise!
437
437
  end
438
438
  end
439
439
 
@@ -442,7 +442,7 @@ class Chef
442
442
  sid = sid.pointer if sid.respond_to?(:pointer)
443
443
 
444
444
  unless SetSecurityDescriptorGroup(security_descriptor, sid, defaulted)
445
- Chef::Win32::Error.raise!
445
+ Chef::ReservedNames::Win32::Error.raise!
446
446
  end
447
447
  end
448
448
 
@@ -451,7 +451,7 @@ class Chef
451
451
  sid = sid.pointer if sid.respond_to?(:pointer)
452
452
 
453
453
  unless SetSecurityDescriptorOwner(security_descriptor, sid, defaulted)
454
- Chef::Win32::Error.raise!
454
+ Chef::ReservedNames::Win32::Error.raise!
455
455
  end
456
456
  end
457
457
 
@@ -461,13 +461,13 @@ class Chef
461
461
  present = !security_descriptor.null? if present == nil
462
462
 
463
463
  unless SetSecurityDescriptorSacl(security_descriptor, present, acl, defaulted)
464
- Chef::Win32::Error.raise!
464
+ Chef::ReservedNames::Win32::Error.raise!
465
465
  end
466
466
  end
467
467
 
468
468
  def self.with_privileges(*privilege_names)
469
469
  # Set privileges
470
- token = open_process_token(Chef::Win32::Process.get_current_process, TOKEN_READ | TOKEN_ADJUST_PRIVILEGES)
470
+ token = open_process_token(Chef::ReservedNames::Win32::Process.get_current_process, TOKEN_READ | TOKEN_ADJUST_PRIVILEGES)
471
471
  old_privileges = token.enable_privileges(*privilege_names)
472
472
 
473
473
  # Let the caller do their privileged stuff