diff options
author | Stuart Preston <stuart@chef.io> | 2018-07-18 11:52:58 +0100 |
---|---|---|
committer | Stuart Preston <stuart@chef.io> | 2018-07-18 11:52:58 +0100 |
commit | 43c44c6584c069a4be58c43a071fd1ffb45745f5 (patch) | |
tree | df339a5068f816f4ec579c0d865c069fc6f8ad07 | |
parent | 9a2b93d63a0084d738137579e64604d425940938 (diff) | |
download | chef-sp/7412.tar.gz |
FFI.LastError.error always returns 0 if used in the prior exceptionsp/7412
Signed-off-by: Stuart Preston <stuart@chef.io>
-rw-r--r-- | lib/chef/util/windows/net_user.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/util/windows/net_user.rb b/lib/chef/util/windows/net_user.rb index 25a413861b..5d0dbf7a53 100644 --- a/lib/chef/util/windows/net_user.rb +++ b/lib/chef/util/windows/net_user.rb @@ -98,13 +98,13 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT) true rescue Chef::Exceptions::Win32APIError => e - # we're only interested in the password failures - if FFI::LastError.error == Win32APIError::ERROR_LOGON_FAILURE + Chef::Log.trace(e) + # we're only interested in the incorrect password failures + if e.to_s =~ /System Error Code: 1326/ return false end # all other exceptions will assume we cannot logon for a different reason Chef::Log.trace("Unable to login with the specified credentials. Assuming the credentials are valid.") - Chef::Log.trace(e) true end |