Fix and extend behavior of HookLoadFile

This commit fixes and extends the behavior of HookLoadFile. Before this
change, HookLoadFile appended ".bro" to each path that was @loaded, even
if the path specified directory names. Furthermore it only gave the path
of the file as it was specified in the Bro script without revealing the
final path of the file that it was going to load.

This patch changes this behavior - in addition to giving the unmodified
path given in the @load command, the hook now returns the resolved path
of the file or directory it is going to load (if found). The hook is
furthermore raises for @load-sigs and @load-plugin; a enum specifies the
kind of load that is happening.
This commit is contained in:
Johanna Amann 2017-11-16 12:04:11 -08:00
parent bde4404b5e
commit 91dcefe104
8 changed files with 978 additions and 643 deletions

View file

@ -345,7 +345,7 @@ void Plugin::RequestBroObjDtor(BroObj* obj)
plugin_mgr->RequestBroObjDtor(obj, this);
}
int Plugin::HookLoadFile(const std::string& file, const std::string& ext)
int Plugin::HookLoadFile(const LoadType type, const std::string& file, const std::string& resolved)
{
return -1;
}