Deal with services a little more intelligently if they're not already there when you report a note.

git-svn-id: file:///home/svn/framework3/trunk@10463 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Tod Beardsley 2010-09-24 20:51:38 +00:00
parent 09cab24dbf
commit c00d56d560
1 changed files with 18 additions and 9 deletions

View File

@ -517,15 +517,24 @@ class DBManager
report_host({:workspace => wspace, :host => opts[:host]})
addr = opts[:host]
end
end
# Do the same for a service
if (opts[:proto] and opts[:port])
report_service(
:workspace => wspace,
:host => opts[:host],
:proto => opts[:proto],
:port => opts[:port]
)
# Do the same for a service if that's also included.
if (opts[:port])
proto = nil
case opts[:proto].to_s.downcase # Catch incorrect usages
when 'tcp','udp'
proto = opts[:proto]
when 'dns','snmp','dhcp'
proto = 'udp'
else
proto = 'tcp'
end
report_service(
:workspace => wspace,
:host => opts[:host],
:port => opts[:port],
:proto => proto
)
end
end
# Update Modes can be :unique, :unique_data, :insert
mode = opts[:update] || :unique