From bc092af855cdf75d1811e21091973973c474bd55 Mon Sep 17 00:00:00 2001 From: David Maloney Date: Tue, 22 Apr 2014 11:05:12 -0500 Subject: [PATCH] Fix credential docs expanded return types for the Credential object to be more accurate --- .../framework/login_scanner/credential.rb | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/metasploit/framework/login_scanner/credential.rb b/lib/metasploit/framework/login_scanner/credential.rb index 658a44e721..86e379b634 100644 --- a/lib/metasploit/framework/login_scanner/credential.rb +++ b/lib/metasploit/framework/login_scanner/credential.rb @@ -11,29 +11,33 @@ module Metasploit # @return [Boolean] Whether BOTH a public and private are required attr_accessor :paired # @!attribute private - # @return [String] The private credential component (e.g username) + # The private credential component (e.g. username) + # + # @return [String] if {#paired} is `true` or {#private} is `nil` + # @return [String, nil] if {#paired} is `false` or {#private} is not `nil`. attr_accessor :private - # @!attribute password - # @return [String] The public credential component (e.g password) + # @!attribute public + # The public credential component (e.g. password) + # + # @return [String] if {#paired} is `true` or {#public} is `nil` + # @return [String, nil] if {#paired} is `false` or {#public} is not `nil`. attr_accessor :public # @!attribute realm - # @return [String] The realm credential component (e.g domain name) + # @return [String,nil] The realm credential component (e.g domain name) attr_accessor :realm validates :paired, inclusion: { in: [true, false] } - # If we have no private we MUST have a public - validates :public, - presence: true, - if: "private.nil? or paired" - # If we have no public we MUST have a private (e.g. SNMP Community String) validates :private, exclusion: { in: [nil] }, if: "public.nil? or paired" - + # If we have no private we MUST have a public + validates :public, + presence: true, + if: "private.nil? or paired" # @param attributes [Hash{Symbol => String,nil}] def initialize(attributes={})