lib/jamf/api/classic/api_objects/distribution_point.rb in ruby-jss-2.1.0 vs lib/jamf/api/classic/api_objects/distribution_point.rb in ruby-jss-2.1.1
- old
+ new
@@ -257,12 +257,12 @@
# @return [String] the ssh password as a SHA256 digest
attr_reader :ssh_password_sha256
def initialize(**args)
- super
-
+ super
+
@ip_address = @init_data[:ip_address]
@local_path = @init_data[:local_path]
@enable_load_balancing = @init_data[:enable_load_balancing]
@failover_point = @init_data[:failover_point]
@is_master = @init_data[:is_master]
@@ -292,48 +292,32 @@
@http_url = @init_data[:http_url]
@failover_point_url = @init_data[:failover_point_url]
@port = @init_data[:ssh_password]
- # Note, as of Casper 9.3:
- # :management_password_md5=>"xxxxx"
- # and
- # :management_password_sha256=> "xxxxxxxxxx"
- # Are the read/write password
- #
- # An empty passwd is
- # MD5 = d41d8cd98f00b204e9800998ecf8427e
- # SHA256 = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
- #
- # Seemms the read-only pw isn't available in the API
-
# if we mount for fileservice, where's the mountpoint?
@mountpoint = DEFAULT_MOUNTPOINT_DIR + "#{DEFAULT_MOUNTPOINT_PREFIX}#{@id}"
end # init
- # Check the validity of a password.
+ # @deprecated The API no longer sends SHA256 hashed password data, and instead
+ # only has a string of asterisks, meaning we can no longer use it to validate
+ # passwords before attempting to use them. Instead, the processes that use
+ # them, e.g. mounting a Dist. Point, will fail on their own if the pw is not
+ # valid.
#
- # @param user[Symbol] one of :ro, :rw, :ssh, :http
+ # This method remains defined for backward-compatibility with any existing
+ # code that calls it. but it will always return true. It will be removed in
+ # a future version
#
- # @param pw[String] the password to check for the given user
+ # @param user[Symbol] ignored
#
- # @return [Boolean,Nil] was the password correct?
- # nil is returned if there is no password set in the JSS.
+ # @param pw[String] ignored
#
- def check_pw(user, pw)
- raise Jamf::InvalidDataError, 'The first parameter must be one of :ro, :rw, :ssh, :http' unless %i[ro rw ssh http].include? user
-
- sha256 = case user
- when :rw then @read_write_password_sha256
- when :ro then @read_only_password_sha256
- when :http then @http_password_sha256
- when :ssh then @ssh_password_sha256
- end # case
-
- return nil if sha256 == EMPTY_PW_256
-
- sha256 == Digest::SHA2.new(256).update(pw).to_s
+ # @return [TrueClass] Allow the process calling this to continue.
+ #
+ def check_pw(_user = nil, _pw = nil)
+ true
end
# Check to see if this dist point is reachable for downloads (read-only)
# via either http, if available, or filesharing.
#
@@ -348,11 +332,10 @@
# @return [FalseClass, Symbol] false if not reachable, otherwise :http or :mountable
#
def reachable_for_download?(pw = '', check_http = true)
return :http if check_http && http_reachable?(pw)
return :mountable if mounted?
- return false unless check_pw :ro, pw
begin
mount pw, :ro
:mountable
rescue
@@ -369,11 +352,10 @@
#
# @return [FalseClass, Symbol] false if not reachable, otherwise :mountable
#
def reachable_for_upload?(pw)
return :mountable if mounted?
- return false unless check_pw :rw, pw
begin
mount pw, :rw
:mountable
rescue
@@ -411,16 +393,10 @@
JSS.stdin line
else
pw
end
- pwok = check_pw(access, password)
- unless pwok
- msg = pwok.nil? ? "No #{access} password set in the JSS" : "Incorrect password for #{access} account"
- raise Jamf::InvalidDataError, msg
- end
-
username = access == :ro ? @read_only_username : @read_write_username
safe_pw = CGI.escape password.to_s
@mount_url = "#{@connection_type.downcase}://#{username}:#{safe_pw}@#{@ip_address}/#{@share_name}"
@@ -479,10 +455,10 @@
# Private Instance Methods
######################################
private
# can the dp be reached for http downloads?
- def http_reachable?(pw)
+ def http_reachable?(pw = nil)
return false unless http_downloads_enabled
url =
if @username_password_required
user_pass = "#{CGI.escape @http_username.to_s}:#{CGI.escape pw.to_s}@"