diff options
author | Stuart Preston <stuart@chef.io> | 2018-07-04 03:48:43 +0100 |
---|---|---|
committer | Stuart Preston <stuart@chef.io> | 2018-07-04 03:48:43 +0100 |
commit | 9eea8ec3038a7a8add4cd0c8044649ea0296e688 (patch) | |
tree | 8e503317528d901f276e36a197dc177c25c2397f | |
parent | 059335c5cf232cdd5a14e7fd1cb2f2995e7cd15f (diff) | |
download | chef-9eea8ec3038a7a8add4cd0c8044649ea0296e688.tar.gz |
Assume anything that isn't a failed logon is a valid credential.
Signed-off-by: Stuart Preston <stuart@chef.io>
-rw-r--r-- | lib/chef/util/windows/net_user.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/chef/util/windows/net_user.rb b/lib/chef/util/windows/net_user.rb index 92e8b5cc69..fc8627a1f2 100644 --- a/lib/chef/util/windows/net_user.rb +++ b/lib/chef/util/windows/net_user.rb @@ -97,13 +97,12 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT) true rescue Chef::Exceptions::Win32APIError => e - if e.to_s.include? "System Error Code: 1327" - # Error 1327 indicates we are unable to logon to validate the credentials due - # to a policy restriction on the machine. Assume the credentials are valid. - Chef::Log.trace("Unable to login with the specified credentials due to an Account Restriction. Assuming the password is valid.") - return true + if e.to_s.include? "The user name or password is incorrect" + return false end - false + # all other exceptions will assume we cannot logon for a different reason (e.g. an Account Restriction) + Chef::Log.trace("Unable to login with the specified credentials. Assuming the credentials are valid.") + true end def get_info |