Ruby 1.9 compatibility changes

git-svn-id: file:///home/svn/framework3/trunk@6591 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2009-05-29 13:46:12 +00:00
parent 6a76e5d0a2
commit 9fabd18c24
5 changed files with 21 additions and 27 deletions

View File

@ -179,4 +179,4 @@ protected
end
end
end

View File

@ -257,37 +257,35 @@ protected
#
# Adds a module with a the supplied name.
#
def add_module(module_class, name, modinfo = nil)
# Duplicate the module class so that we can operate on a
# framework-specific copy of it.
dup = module_class.dup
def add_module(mod, name, modinfo = nil)
# Set the module's name so that it can be referenced when
# instances are created.
dup.framework = framework
dup.refname = name
dup.file_path = ((modinfo and modinfo['files']) ? modinfo['files'][0] : nil)
dup.orig_cls = module_class
mod.framework = framework
mod.refname = name
mod.file_path = ((modinfo and modinfo['files']) ? modinfo['files'][0] : nil)
mod.orig_cls = mod
if (get_hash_val(name) and get_hash_val(name) != SymbolicModule)
mod_ambiguous[name] = true
wlog("The module #{dup.refname} is ambiguous with #{self[name].refname}.")
wlog("The module #{mod.refname} is ambiguous with #{self[name].refname}.")
else
self[name] = dup
self[name] = mod
end
# Check to see if we should update info
noup = true if (modinfo and modinfo['noup'])
# Add this module to the module cache for this type
framework.modules.cache_module(dup) if (noup != true)
framework.modules.cache_module(mod) if (noup != true)
# Invalidate the sorted array
invalidate_sorted_cache
# Return the duplicated instance for use
dup
# Return the modlicated instance for use
mod
end
#

View File

@ -29,7 +29,7 @@ if (RUBY_VERSION =~ /^1\.9\./)
# Force binary encoding
Encoding.default_external = Encoding.default_internal = "binary"
# Encoding.default_external = Encoding.default_internal = "binary"
end

View File

@ -1,7 +1,3 @@
if VERSION < "1.8.5"
$stderr.puts "[*] WARNING: Ruby not at a minimum version of 1.8.5"
end
require 'bindata'
# This version requirement is a bit of a lie; we need svn version

View File

@ -191,13 +191,13 @@ module PacketFu
when 11; "CC:#{value.unpack("N")}" # Connection Count. RFC 1644 is hi-larious, btw.
when 12; "CC.NEW:#{value.unpack("N")}" # Connection Count New.
when 13; "CC.EHCO:#{value.unpack("N")}" # Conn. Count Echo.
when 14: "ALT.CRC:#{value.unpack("C")}" # Alt Checksum request
when 15: "ALT.DATA:#{value.unpack("H*")}" # Alt checksum data. I'm too dumb for this.
when 16: "Skeeter:#{value.unpack("H*")}" # Skeeter crypto.
when 17: "Bubba:#{value.unpack("H*")}" # Bubba crypto.
when 18: "TCO:#{value.unpack("C")}" # Trailer Checksum Option. Nobody knows what this is.
when 19: "MD5:#{value.unpack("H*")}" # MD5 Signature Option. Hash-signed TCP? Outrageous!
when 27: qsr_opt = "QSR:" # Quick-Start Request. Experimental in Jan 2007.
when 14; "ALT.CRC:#{value.unpack("C")}" # Alt Checksum request
when 15; "ALT.DATA:#{value.unpack("H*")}" # Alt checksum data. I'm too dumb for this.
when 16; "Skeeter:#{value.unpack("H*")}" # Skeeter crypto.
when 17; "Bubba:#{value.unpack("H*")}" # Bubba crypto.
when 18; "TCO:#{value.unpack("C")}" # Trailer Checksum Option. Nobody knows what this is.
when 19; "MD5:#{value.unpack("H*")}" # MD5 Signature Option. Hash-signed TCP? Outrageous!
when 27; qsr_opt = "QSR:" # Quick-Start Request. Experimental in Jan 2007.
qsr_val = []
qsr_val << (value[0,1].unpack("C")[0] >> 4)
qsr_val << (value[0,1].unpack("C")[0] & 0x0f)
@ -209,4 +209,4 @@ module PacketFu
end
end
end
end
end