Method: Chef::Util::Windows::NetUser#validate_credentials
- Defined in:
- lib/chef/util/windows/net_user.rb
#validate_credentials(passwd) ⇒ Object
XXX for an extra painful alternative, see: support.microsoft.com/kb/180548
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/chef/util/windows/net_user.rb', line 96 def validate_credentials(passwd) token = Security.logon_user(@username, nil, passwd, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT) true rescue Chef::Exceptions::Win32APIError => e Chef::Log.trace(e) # we're only interested in the incorrect password failures if /System Error Code: 1326/.match?(e.to_s) 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.") true end |