summaryrefslogtreecommitdiff
path: root/lib/chef/provider/user/dscl.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-01-12 09:56:40 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-01-12 09:56:40 -0800
commit6610ebd39d19c3b8776d69a56a39c3b496b8b29f (patch)
treea5c282b16f71e3f8be0f3ed99310c82cc41ecd6d /lib/chef/provider/user/dscl.rb
parent812101f11a6c33e49f401ad72598ca6ffb38adc4 (diff)
downloadchef-6610ebd39d19c3b8776d69a56a39c3b496b8b29f.tar.gz
really fix copslcg/really-fix-cops
Diffstat (limited to 'lib/chef/provider/user/dscl.rb')
-rw-r--r--lib/chef/provider/user/dscl.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb
index 1faf2438ac..5b506daf81 100644
--- a/lib/chef/provider/user/dscl.rb
+++ b/lib/chef/provider/user/dscl.rb
@@ -363,7 +363,7 @@ user password using shadow hash.")
# Shadow info is saved as binary plist. Convert the info to binary plist.
shadow_info_binary = StringIO.new
command = Mixlib::ShellOut.new("plutil -convert binary1 -o - -",
- :input => shadow_info.to_plist, :live_stream => shadow_info_binary)
+ :input => shadow_info.to_plist, :live_stream => shadow_info_binary)
command.run_command
if user_info.nil?
@@ -391,13 +391,13 @@ user password using shadow hash.")
if mac_osx_version_10_7?
hash_value = if salted_sha512?(new_resource.password)
- new_resource.password
- else
- # Create a random 4 byte salt
- salt = OpenSSL::Random.random_bytes(4)
- encoded_password = OpenSSL::Digest::SHA512.hexdigest(salt + new_resource.password)
- hash_value = salt.unpack('H*').first + encoded_password
- end
+ new_resource.password
+ else
+ # Create a random 4 byte salt
+ salt = OpenSSL::Random.random_bytes(4)
+ encoded_password = OpenSSL::Digest::SHA512.hexdigest(salt + new_resource.password)
+ hash_value = salt.unpack('H*').first + encoded_password
+ end
shadow_info["SALTED-SHA512"] = StringIO.new
shadow_info["SALTED-SHA512"].string = convert_to_binary(hash_value)