Land #7900, missed userpass_file on CredentialCollection.empty?

bug/bundler_fix
wchen-r7 2017-02-01 17:06:48 -06:00
commit 6522c0df2e
No known key found for this signature in database
GPG Key ID: 2384DB4EF06F730B
2 changed files with 11 additions and 2 deletions

View File

@ -207,8 +207,8 @@ class Metasploit::Framework::CredentialCollection
# Returns true when #each will have no results to iterate # Returns true when #each will have no results to iterate
def empty? def empty?
hasUser = username.present? || user_file.present? || !additional_publics.empty? hasUser = username.present? || user_file.present? || userpass_file.present? || !additional_publics.empty?
hasPass = password.present? || pass_file.present? || !additional_privates.empty? || blank_passwords hasPass = password.present? || pass_file.present? || userpass_file.present? ||!additional_privates.empty? || blank_passwords
prepended_creds.empty? && !hasUser || (hasUser && !hasPass) prepended_creds.empty? && !hasUser || (hasUser && !hasPass)
end end

View File

@ -141,6 +141,15 @@ RSpec.describe Metasploit::Framework::CredentialCollection do
end end
describe "#empty?" do describe "#empty?" do
context "when only :userpass_file is set" do
let(:username) { nil }
let(:password) { nil }
let(:userpass_file) { "test_file" }
specify do
expect(collection.empty?).to eq false
end
end
context "when :username is set" do context "when :username is set" do
context "and :password is set" do context "and :password is set" do
specify do specify do