diff options
author | Tim Smith <tsmith@chef.io> | 2018-02-28 14:51:20 -0800 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-03-02 14:57:31 -0800 |
commit | 8f8e43e410d558b03850fc81d8ed11286d8ea1dd (patch) | |
tree | 9d161a877d3c7ca95059164787b9e9d0e16c4937 /lib/chef/win32 | |
parent | 6f2c11cb9c7ded1137ce2138573d3d0d41e4c551 (diff) | |
download | chef-8f8e43e410d558b03850fc81d8ed11286d8ea1dd.tar.gz |
Remove support for Windows 20032k3
Windows 2003 is fully end of life at this point and hasn't been supported by Chef for quite a while. EXTENDED support for Windows 2003 ended July 14, 2015. We avoid a good number of WMI queries by removing this support entirely.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/win32')
-rw-r--r-- | lib/chef/win32/eventlog.rb | 2 | ||||
-rw-r--r-- | lib/chef/win32/security.rb | 40 | ||||
-rw-r--r-- | lib/chef/win32/security/sid.rb | 3 | ||||
-rw-r--r-- | lib/chef/win32/version.rb | 17 |
4 files changed, 21 insertions, 41 deletions
diff --git a/lib/chef/win32/eventlog.rb b/lib/chef/win32/eventlog.rb index eae0ae4abf..418d72e65e 100644 --- a/lib/chef/win32/eventlog.rb +++ b/lib/chef/win32/eventlog.rb @@ -16,7 +16,7 @@ # limitations under the License. # -if Chef::Platform.windows? && (not Chef::Platform.windows_server_2003?) +if Chef::Platform.windows? if !defined? Chef::Win32EventLogLoaded if defined? Windows::Constants [:INFINITE, :WAIT_FAILED, :FORMAT_MESSAGE_IGNORE_INSERTS, :ERROR_INSUFFICIENT_BUFFER].each do |c| diff --git a/lib/chef/win32/security.rb b/lib/chef/win32/security.rb index 63b626b1d7..821d81ef81 100644 --- a/lib/chef/win32/security.rb +++ b/lib/chef/win32/security.rb @@ -643,32 +643,26 @@ class Chef # Checks if the caller has the admin privileges in their # security token def self.has_admin_privileges? - if Chef::Platform.windows_server_2003? - # Admin privileges do not exist on Windows Server 2003 - - true - else - # a regular user doesn't have privileges to call Chef::ReservedNames::Win32::Security.OpenProcessToken - # hence we return false if the open_current_process_token fails with `Access is denied.` error message. - begin - process_token = open_current_process_token(TOKEN_READ) - rescue Exception => run_error - return false if run_error.message =~ /Access is denied/ - Chef::ReservedNames::Win32::Error.raise! - end + # a regular user doesn't have privileges to call Chef::ReservedNames::Win32::Security.OpenProcessToken + # hence we return false if the open_current_process_token fails with `Access is denied.` error message. + begin + process_token = open_current_process_token(TOKEN_READ) + rescue Exception => run_error + return false if run_error.message =~ /Access is denied/ + Chef::ReservedNames::Win32::Error.raise! + end - # display token elevation details - token_elevation_type = get_token_information_elevation_type(process_token) - Chef::Log.debug("Token Elevation Type: #{token_elevation_type}") + # display token elevation details + token_elevation_type = get_token_information_elevation_type(process_token) + Chef::Log.debug("Token Elevation Type: #{token_elevation_type}") - elevation_result = FFI::Buffer.new(:ulong) - elevation_result_size = FFI::MemoryPointer.new(:uint32) - success = GetTokenInformation(process_token.handle.handle, :TokenElevation, elevation_result, 4, elevation_result_size) + elevation_result = FFI::Buffer.new(:ulong) + elevation_result_size = FFI::MemoryPointer.new(:uint32) + success = GetTokenInformation(process_token.handle.handle, :TokenElevation, elevation_result, 4, elevation_result_size) - # Assume process is not elevated if the call fails. - # Process is elevated if the result is different than 0. - success && (elevation_result.read_ulong != 0) - end + # Assume process is not elevated if the call fails. + # Process is elevated if the result is different than 0. + success && (elevation_result.read_ulong != 0) end def self.logon_user(username, domain, password, logon_type, logon_provider) diff --git a/lib/chef/win32/security/sid.rb b/lib/chef/win32/security/sid.rb index c77616853c..b551cbd2e3 100644 --- a/lib/chef/win32/security/sid.rb +++ b/lib/chef/win32/security/sid.rb @@ -248,8 +248,7 @@ class Chef # See https://technet.microsoft.com/en-us/library/cc961992.aspx # In practice, this is SID.Administrators if the current_user is an admin (even if not - # running elevated), and is current_user otherwise. On win2k3, it technically can be - # current_user in all cases if a certain group policy is set. + # running elevated), and is current_user otherwise. def self.default_security_object_owner token = Chef::ReservedNames::Win32::Security.open_current_process_token Chef::ReservedNames::Win32::Security.get_token_information_owner(token) diff --git a/lib/chef/win32/version.rb b/lib/chef/win32/version.rb index f8228d40b3..944cb207f5 100644 --- a/lib/chef/win32/version.rb +++ b/lib/chef/win32/version.rb @@ -76,15 +76,8 @@ class Chef @sp_minor_version = ver_info[:w_service_pack_minor] # Obtain sku information for the purpose of identifying - # datacenter, cluster, and core skus, the latter 2 only - # exist in releases after Windows Server 2003 - if ! Chef::Platform.windows_server_2003? - @sku = get_product_info(@major_version, @minor_version, @sp_major_version, @sp_minor_version) - else - # The get_product_info API is not supported on Win2k3, - # use an alternative to identify datacenter skus - @sku = get_datacenter_product_info_windows_server_2003(ver_info) - end + # datacenter, cluster, and core skus + @sku = get_product_info(@major_version, @minor_version, @sp_major_version, @sp_minor_version) end marketing_names = Array.new @@ -153,12 +146,6 @@ class Chef out.get_uint(0) end - def get_datacenter_product_info_windows_server_2003(ver_info) - # The intent is not to get the actual sku, just identify - # Windows Server 2003 datacenter - sku = (ver_info[:w_suite_mask] & VER_SUITE_DATACENTER) ? PRODUCT_DATACENTER_SERVER : 0 - end - end end end |