summaryrefslogtreecommitdiff
path: root/lib/chef/util
diff options
context:
space:
mode:
authornimisha <nimisha.sharad@msystechnologies.com>2018-01-24 13:23:02 +0530
committernimisha <nimisha.sharad@msystechnologies.com>2018-01-24 15:00:41 +0530
commitb07a4f4b8da44bf35d9dbe879e1cf4fd2f040644 (patch)
tree74b0f71c5cd33b28d461c87cf7fd2f5ca1870022 /lib/chef/util
parent7381679100ca96c63751cadff8b54722aefed5f4 (diff)
downloadchef-b07a4f4b8da44bf35d9dbe879e1cf4fd2f040644.tar.gz
Fixed review comments
Signed-off-by: nimisha <nimisha.sharad@msystechnologies.com>
Diffstat (limited to 'lib/chef/util')
-rw-r--r--lib/chef/util/windows/logon_session.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/chef/util/windows/logon_session.rb b/lib/chef/util/windows/logon_session.rb
index 912a603865..afe58ae4f9 100644
--- a/lib/chef/util/windows/logon_session.rb
+++ b/lib/chef/util/windows/logon_session.rb
@@ -48,11 +48,8 @@ class Chef
password = wstring(original_password)
domain = wstring(original_domain)
- if authentication == :remote
- status = Chef::ReservedNames::Win32::API::Security.LogonUserW(username, domain, password, Chef::ReservedNames::Win32::API::Security::LOGON32_LOGON_NEW_CREDENTIALS, Chef::ReservedNames::Win32::API::Security::LOGON32_PROVIDER_DEFAULT, token)
- elsif authentication == :local
- status = Chef::ReservedNames::Win32::API::Security.LogonUserW(username, domain, password, Chef::ReservedNames::Win32::API::Security::LOGON32_LOGON_NETWORK, Chef::ReservedNames::Win32::API::Security::LOGON32_PROVIDER_DEFAULT, token)
- end
+ logon_type = (authentication == :local) ? (Chef::ReservedNames::Win32::API::Security::LOGON32_LOGON_NETWORK) : (Chef::ReservedNames::Win32::API::Security::LOGON32_LOGON_NEW_CREDENTIALS)
+ status = Chef::ReservedNames::Win32::API::Security.LogonUserW(username, domain, password, logon_type, Chef::ReservedNames::Win32::API::Security::LOGON32_PROVIDER_DEFAULT, token)
if !status
last_error = FFI::LastError.error