diff --git a/lib/rex/socket.rb b/lib/rex/socket.rb index ced0adb..8e83637 100644 --- a/lib/rex/socket.rb +++ b/lib/rex/socket.rb @@ -133,7 +133,7 @@ def self.support_ipv6? # def self.is_name?(name) return false if name.length > 253 - name =~ MATCH_DNS_NAME ? (name =~ /\s/).nil? : false + name.delete_suffix('.') =~ MATCH_DNS_NAME ? (name =~ /\s/).nil? : false end # diff --git a/spec/rex/socket_spec.rb b/spec/rex/socket_spec.rb index 30d5c39..1bd619a 100644 --- a/spec/rex/socket_spec.rb +++ b/spec/rex/socket_spec.rb @@ -350,9 +350,18 @@ end context 'with a fully qualified domain name' do - let(:try) { "www.metasploit.com" } - it "should return true" do - expect(name).to eq true + context 'and a trailing dot' do + let(:try) { "www.metasploit.com." } + it "should return true" do + expect(name).to eq true + end + end + + context 'and no trailing dot' do + let(:try) { "www.metasploit.com" } + it "should return true" do + expect(name).to eq true + end end end