Fixes #2848, uses the half-guessing method of figuring out the "right" protocol.

git-svn-id: file:///home/svn/framework3/trunk@10562 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Tod Beardsley 2010-10-06 04:18:01 +00:00
parent bf2b4d199c
commit 7041102df7
1 changed files with 13 additions and 4 deletions

View File

@ -825,10 +825,19 @@ class DBManager
vuln = host.vulns.find_or_initialize_by_name(name, :include => :refs)
end
if opts[:port] and opts[:proto]
vuln.service = host.services.find_or_create_by_port_and_proto(opts[:port], opts[:proto])
elsif opts[:port]
vuln.service = host.services.find_or_create_by_port_and_proto(opts[:port], "tcp")
if opts[:port]
proto = nil
case opts[:proto].to_s.downcase # Catch incorrect usages, as in report_note
when 'tcp','udp'
proto = opts[:proto]
when 'dns','snmp','dhcp'
proto = 'udp'
sname = opts[:proto]
else
proto = 'tcp'
sname = opts[:proto]
end
vuln.service = host.services.find_or_create_by_port_and_proto(opts[:port], proto)
end
if rids