* origin/topic/awelzel/2483-builtin-plugin-includes:
zeek-setup: Load builtin-plugins/__preload__.zeek before initializing bifs
cmake: Introduce bro_PLUGIN_LINK_LIBS and add to link command.
cmake: Do not use include_directories() for included plugins
cmake: Bump submodule
The util-config.h file uses @DEFAULT_ZEEKPATH@ which includes the
builtin-plugins directory. Do the same change for the fuzzers so
that scripts from builtin plugins can be found.
Fixes#2540
* topic/timw/lgtm-fixes:
Add a missing deletion in ZAM code
Add a couple of mising assignment operators to match copy constructors
Fix a bunch of variable shadowing issues from LGTM
Prevent errors as follows with the bro-http2 plugin.
error in /mitrecnd_HTTP2.events.bif.zeek, line 95: identifier not defined: http2_stream_stat
error in /mitrecnd_HTTP2.events.bif.zeek, line 363: identifier not defined: http2_settings
internal error in /mitrecnd_HTTP2.events.bif.zeek, line 460: Failed to find type named: http2_settings_unrecognized_table
When using --include-plugins with plugins that depend other libraries
using zeek_plugin_link_library(), these libraries were stashed into
bro_SUBDIR_LIBS that is used in add_executable(). However, that does not
work for shared libraries.
Explicitly track library dependencies in bro_PLUGIN_LINK_LIBS now and
use target_link_libraries() with Zeek (there's a change in cmake to
make zeek_plugin_link_library() populate bro_PLUGIN_LINK_LIBS instead).
Currently, zeekdeps needs to come after bro_PLUGIN_LINK_LIBS due to how
spicy-plugin (and other external plugins) fiddle with zeekdeps in order
to stash dependencies into the PARENT_SCOPE.
bro_PLUGIN_LINK_LIBS will continue to work with static libraries.
The failure occurred when attempting to include bro-http2 [1].
Fixes#2483
[1] https://github.com/MITRECND/bro-http2
Script and BIF functions with a single any parameter are excluded from
type checking regarding arguments. This makes it possible to call a
ScriptFunc with more arguments than it actually has parameters and frame
space for, causing heap-buffer-overflows.
This change runtime checks expected parameters and provided arguments
and short-circuits execution as well as logging runtime expression errors.
Fixes#2446
Seemed easiest to do it via the traversal infrastructure as we do not
otherwise track enough context/scope when instantiating break or next
statements.
Might be worth moving this out of src/parse.y, but didn't exactly know
where. Or maybe we wait until there's more such trivial validations
popping up
Fixes#2440
spicy-plugin-1.4.0 changes behavior, so it is not backwards-compatible
with the spicy-plugin-1.3 series. This patch should not be backported to
LTS release branches.
Using positional and vararg arguments for BIFs, it's not possible to do
proper runtime type checking on them as discussed in #2425. The bifcl produced
code unconditionally attempts to convert the positional arguments to StringVals,
but nothing ever type checks them. Instead of improving the vararg support in
Zeek script and bifcl, align cat_sep() with fmt() in making it fully vararg
and do implement type checks by hand.
With this change, passing wrong types for the separator and default argument
isn't a fatal error anymore and the error messages are also more descriptive.
It's a bit of a crutch working around varargs limitations.
Fixes#2425
One more from @stevesmoot. The record_fields() BIF produced "enum" as
type_name for fields of type enum.
Extend container_type_name() to append the actual name of the enum.
This is changing the format and may break consumers, but those are
likely in a category that are happy to adapt. Not having the actual
enum name available wasn't very helpful.
We could alternatively render only the actual type_name without the
prefixed "enum", but that isn't how it's done for record types currently
and it would make it more difficult to decide which subsequent BIFs to
use for further introspection, like enum_names().