lib/chef/provider/user/dscl.rb
#
# We need a special check function for password since we support both
# plain text and shadow hash data.
#
# Checks if password needs update based on platform version and the
# type of the password specified.
#
We need a special check function for password since we support both
plain text and shadow hash data.

Checks if password needs update based on platform version and the
type of the password specified.
We need a special check function for password since we support both plain text and shadow hash data . Checks if password needs update based on platform version and the type of the password specified .
def diverged_password?
          return false if @new_resource.password.nil?
          if mac_osx_version_10_7?
            if salted_sha512?(@new_resource.password)
              diverged?(:password)
            else
              !salted_sha512_password_match?
            end
          else
            return true if salted_sha512?(@current_resource.password)
            return true if @current_resource.salt.nil?
            if salted_sha512_pbkdf2?(@new_resource.password)
              diverged?(:password) || diverged?(:salt) || diverged?(:iterations)
            else
              !salted_sha512_pbkdf2_password_match?
            end
          end
        end
def diverged_password? return false if @new_resource . password . nil? if mac_osx_version_10_7? if salted_sha512? ( @new_resource . password ) diverged? ( :password ) else ! salted_sha512_password_match? end else return true if salted_sha512? ( @current_resource . password ) return true if @current_resource . salt . nil? if salted_sha512_pbkdf2? ( @new_resource . password ) diverged? ( :password ) || diverged? ( :salt ) || diverged? ( :iterations ) else ! salted_sha512_pbkdf2_password_match? end end end
We need a special check function for password since we support both
plain text and shadow hash data.
We need a special check function for password since we support both plain text and shadow hash data .
# Dscl provider supports both plain text passwords and shadow hashes. # When a system is upgraded to a version 10.7+ shadow hashes of the users # will be updated when the user logs in. So it's possible that we will have # SALTED-SHA512 password in the current_resource. In that case we will force # password to be updated. # 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.