1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-12 11:52:01 +01:00

Allow Net::DNS::RR::Types to handle all valid types

This commit is contained in:
Jon Hart 2014-11-03 10:12:37 -08:00
parent ece84c0e30
commit 8398bae64f

View File

@ -167,8 +167,11 @@ module Net # :nodoc:
# *PRIVATE* method
def new_from_string(type)
case type
when /^TYPE\\d+/
# TODO!!!
when /^TYPE(?<type_num>\d+)$/
type_num = type_num.to_i
raise TypeArgumentError, "Invalid type #{type_num}" if type_num > 0xFFFF
@str = type
@num = type_num
else
# String with name of type
if Types.has_key? type
@ -183,6 +186,7 @@ module Net # :nodoc:
# Contructor for numeric data type
# *PRIVATE* method
def new_from_num(type)
raise TypeArgumentError, "Invalid type #{type}" if type < 0 || type > 0xFFFF
if Types.invert.has_key? type
@num = type
@str = Types.invert[type]