mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Fix invalid host add (#7762)
This commit is contained in:
parent
f7a78017be
commit
2539c1ef0a
1 changed files with 5 additions and 2 deletions
|
|
@ -232,7 +232,7 @@ local function isAlreadyPresent(item)
|
|||
|
||||
local hosts_details = vs_utils.retrieve_hosts_to_scan()
|
||||
for _,value in ipairs(hosts_details) do
|
||||
if (item.host == value.host ) then
|
||||
if (item.host == value.host and item.scan_type == value.scan_type ) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
|
@ -332,6 +332,7 @@ function vs_utils.save_host_to_scan(scan_type, host, scan_result, last_scan_time
|
|||
vs_utils.delete_host_to_scan_by_id(id)
|
||||
end
|
||||
|
||||
local result = 1 -- success
|
||||
if(not isAlreadyPresent(new_item)) then
|
||||
--saved_hosts[#saved_hosts+1] = new_item
|
||||
ntop.setHashCache(host_to_scan_key, host_hash_key, json.encode(new_item))
|
||||
|
|
@ -339,10 +340,12 @@ function vs_utils.save_host_to_scan(scan_type, host, scan_result, last_scan_time
|
|||
|
||||
-- edit case
|
||||
ntop.setHashCache(host_to_scan_key, host_hash_key, json.encode(new_item))
|
||||
else
|
||||
result = 2 --aleready_present
|
||||
end
|
||||
|
||||
--ntop.setCache(host_to_scan_key, json.encode(saved_hosts))
|
||||
return 1
|
||||
return result
|
||||
end
|
||||
|
||||
-- **********************************************************
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue