summaryrefslogtreecommitdiff
path: root/lib/chef/provider/user/dscl.rb
diff options
context:
space:
mode:
authorPat Cox <pcox@fb.com>2015-01-12 21:19:57 -0800
committerPat Cox <pcox@fb.com>2015-01-12 21:22:52 -0800
commit544f219e560448b2c4c697cfe23ceaecaeabfaba (patch)
treee0beb283e26cd7c02ad1edcf415821cc26be6b36 /lib/chef/provider/user/dscl.rb
parentdea3c2b530444f702f6987671681aa1f981ee5f2 (diff)
downloadchef-544f219e560448b2c4c697cfe23ceaecaeabfaba.tar.gz
add code comment, add unit test for case when no salt is found
Diffstat (limited to 'lib/chef/provider/user/dscl.rb')
-rw-r--r--lib/chef/provider/user/dscl.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb
index 4be7150145..4ad541c2ac 100644
--- a/lib/chef/provider/user/dscl.rb
+++ b/lib/chef/provider/user/dscl.rb
@@ -504,7 +504,11 @@ user password using shadow hash.")
# password to be updated.
return true if salted_sha512?(@current_resource.password)
+ # Some system users don't have salts; this can happen if the system is
+ # upgraded and the user hasn't logged in yet. In this case, we will force
+ # the password to be updated.
return true if @current_resource.salt.nil?
+
if salted_sha512_pbkdf2?(@new_resource.password)
diverged?(:password) || diverged?(:salt) || diverged?(:iterations)
else