From d0b206fa36e4b88250eef9e1cbb5ed046b6bfe5b Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Mon, 27 Jan 2020 11:43:07 +0000 Subject: [PATCH 01/12] Remove APIs that were explicitly deprecated to be removed in 3.1. Special handling for bro_{init,done,script_loaded} events: if still used, they cause Zeek to abort at startup. --- aux/zeekctl | 2 +- scripts/base/utils/json.zeek | 2 - src/List.h | 26 +----- src/Val.cc | 29 +------ src/Val.h | 84 +------------------ src/analyzer/protocol/rfb/events.bif | 5 -- src/analyzer/protocol/rfb/rfb-analyzer.pac | 11 --- src/event.bif | 9 -- src/main.cc | 3 - src/parse.y | 14 ++-- src/strings.bif | 41 --------- src/zeek.bif | 20 ----- .../btest/Baseline/bifs.str_shell_escape/out | 4 - .../Baseline/coverage.bare-mode-errors/errors | 1 - .../coverage.init-default/missing_loads | 1 - testing/btest/Baseline/language.zeek_init/out | 12 +-- .../Baseline/language.zeek_script_loaded/out | 6 +- testing/btest/bifs/str_shell_escape.zeek | 15 ---- testing/btest/failed | 8 ++ testing/btest/language/zeek_init.zeek | 5 +- .../btest/language/zeek_script_loaded.zeek | 4 +- 21 files changed, 29 insertions(+), 273 deletions(-) delete mode 100644 scripts/base/utils/json.zeek delete mode 100644 testing/btest/Baseline/bifs.str_shell_escape/out delete mode 100644 testing/btest/bifs/str_shell_escape.zeek create mode 100644 testing/btest/failed diff --git a/aux/zeekctl b/aux/zeekctl index 6933b86e60..e166c066b6 160000 --- a/aux/zeekctl +++ b/aux/zeekctl @@ -1 +1 @@ -Subproject commit 6933b86e60f22f7a39ac1a8adbee4867902ce02e +Subproject commit e166c066b64b196a7dc5de285c68e0977344acc9 diff --git a/scripts/base/utils/json.zeek b/scripts/base/utils/json.zeek deleted file mode 100644 index a9662e74a2..0000000000 --- a/scripts/base/utils/json.zeek +++ /dev/null @@ -1,2 +0,0 @@ -## This file is deprecated in favor of to_json in zeek.bif -@deprecated="Remove in 3.1. to_json is now always available as a built-in function." diff --git a/src/List.h b/src/List.h index e0046bb55a..2b25dfb6f8 100644 --- a/src/List.h +++ b/src/List.h @@ -154,12 +154,6 @@ public: return max_entries; } - ZEEK_DEPRECATED("Remove in v3.1: Use std::sort instead") - void sort(list_cmp_func cmp_func) - { - qsort(entries, num_entries, sizeof(T), cmp_func); - } - int MemoryAllocation() const { return padded_sizeof(*this) + pad_size(max_entries * sizeof(T)); } @@ -174,7 +168,7 @@ public: ++num_entries; entries[0] = a; } - + void push_back(const T& a) { if ( num_entries == max_entries ) @@ -182,19 +176,13 @@ public: entries[num_entries++] = a; } - + void pop_front() { remove_nth(0); } void pop_back() { remove_nth(num_entries-1); } T& front() { return entries[0]; } T& back() { return entries[num_entries-1]; } - ZEEK_DEPRECATED("Remove in v3.1: Use push_front instead") - void insert(const T& a) // add at head of list - { - push_front(a); - } - // The append method is maintained for historical/compatibility reasons. // (It's commonly used in the event generation API) void append(const T& a) // add to end of list @@ -229,16 +217,6 @@ public: return old_ent; } - ZEEK_DEPRECATED("Remove in v3.1: Use back()/pop_back() instead") - T get() // return and remove ent at end of list - { - assert(num_entries > 0); - return entries[--num_entries]; - } - - ZEEK_DEPRECATED("Remove in v3.1: Use back() instead") - T& last() { return back(); } - // Return 0 if ent is not in the list, ent otherwise. bool is_member(const T& a) const { diff --git a/src/Val.cc b/src/Val.cc index fdaa719fab..2c690c590e 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -719,16 +719,6 @@ void IntervalVal::ValDescribe(ODesc* d) const } } -PortVal* PortManager::Get(uint32_t port_num) const - { - return val_mgr->GetPort(port_num); - } - -PortVal* PortManager::Get(uint32_t port_num, TransportProto port_type) const - { - return val_mgr->GetPort(port_num, port_type); - } - uint32_t PortVal::Mask(uint32_t port_num, TransportProto port_type) { // Note, for ICMP one-way connections: @@ -760,25 +750,8 @@ uint32_t PortVal::Mask(uint32_t port_num, TransportProto port_type) return port_num; } -PortVal::PortVal(uint32_t p, TransportProto port_type) : Val(TYPE_PORT) - { - auto port_num = PortVal::Mask(p, port_type); - val.uint_val = static_cast(port_num); - } - -PortVal::PortVal(uint32_t p, bool unused) : Val(TYPE_PORT) - { - val.uint_val = static_cast(p); - } - PortVal::PortVal(uint32_t p) : Val(TYPE_PORT) { - if ( p >= 65536 * NUM_PORT_SPACES ) - { - InternalWarning("bad port number"); - p = 0; - } - val.uint_val = static_cast(p); } @@ -3220,7 +3193,7 @@ ValManager::ValManager() auto port_type = (TransportProto)i; for ( auto j = 0u; j < arr.size(); ++j ) - arr[j] = new PortVal(PortVal::Mask(j, port_type), true); + arr[j] = new PortVal(PortVal::Mask(j, port_type)); } } diff --git a/src/Val.h b/src/Val.h index 50b3b7a20f..cda2dd43f8 100644 --- a/src/Val.h +++ b/src/Val.h @@ -85,56 +85,6 @@ typedef union { class Val : public BroObj { public: - ZEEK_DEPRECATED("Remove in v3.1: use val_mgr->GetBool, GetFalse/GetTrue, GetInt, or GetCount instead") - Val(bool b, TypeTag t) - { - val.int_val = b; - type = base_type(t); -#ifdef DEBUG - bound_id = 0; -#endif - } - - ZEEK_DEPRECATED("Remove in v3.1: use val_mgr->GetBool, GetFalse/GetTrue, GetInt, or GetCount instead") - Val(int32_t i, TypeTag t) - { - val.int_val = bro_int_t(i); - type = base_type(t); -#ifdef DEBUG - bound_id = 0; -#endif - } - - ZEEK_DEPRECATED("Remove in v3.1: use val_mgr->GetBool, GetFalse/GetTrue, GetInt, or GetCount instead") - Val(uint32_t u, TypeTag t) - { - val.uint_val = bro_uint_t(u); - type = base_type(t); -#ifdef DEBUG - bound_id = 0; -#endif - } - - ZEEK_DEPRECATED("Remove in v3.1: use val_mgr->GetBool, GetFalse/GetTrue, GetInt, or GetCount instead") - Val(int64_t i, TypeTag t) - { - val.int_val = i; - type = base_type(t); -#ifdef DEBUG - bound_id = 0; -#endif - } - - ZEEK_DEPRECATED("Remove in v3.1: use val_mgr->GetBool, GetFalse/GetTrue, GetInt, or GetCount instead") - Val(uint64_t u, TypeTag t) - { - val.uint_val = u; - type = base_type(t); -#ifdef DEBUG - bound_id = 0; -#endif - } - Val(double d, TypeTag t) { val.double_val = d; @@ -429,23 +379,6 @@ protected: }; -class PortManager { -public: - // Port number given in host order. - ZEEK_DEPRECATED("Remove in v3.1: use val_mgr->GetPort() instead") - PortVal* Get(uint32_t port_num, TransportProto port_type) const; - - // Host-order port number already masked with port space protocol mask. - ZEEK_DEPRECATED("Remove in v3.1: use val_mgr->GetPort() instead") - PortVal* Get(uint32_t port_num) const; - - // Returns a masked port number - ZEEK_DEPRECATED("Remove in v3.1: use PortVal::Mask() instead") - uint32_t Mask(uint32_t port_num, TransportProto port_type) const; -}; - -extern PortManager* port_mgr; - // Holds pre-allocated Val objects for those where it's more optimal to // re-use existing ones rather than allocate anew. class ValManager { @@ -521,14 +454,6 @@ protected: class PortVal : public Val { public: - // Port number given in host order. - ZEEK_DEPRECATED("Remove in v3.1: use val_mgr->GetPort() instead") - PortVal(uint32_t p, TransportProto port_type); - - // Host-order port number already masked with port space protocol mask. - ZEEK_DEPRECATED("Remove in v3.1: use val_mgr->GetPort() instead") - explicit PortVal(uint32_t p); - Val* SizeVal() const override { return val_mgr->GetInt(val.uint_val); } // Returns the port number in host order (not including the mask). @@ -559,7 +484,7 @@ protected: friend class Val; friend class ValManager; PortVal() {} - PortVal(uint32_t p, bool unused); + PortVal(uint32_t p); void ValDescribe(ODesc* d) const override; Val* DoClone(CloneState* state) override; @@ -1007,13 +932,6 @@ protected: class EnumVal : public Val { public: - - ZEEK_DEPRECATED("Remove in v3.1: use t->GetVal(i) instead") - EnumVal(int i, EnumType* t) : Val(t) - { - val.int_val = i; - } - Val* SizeVal() const override { return val_mgr->GetInt(val.int_val); } protected: diff --git a/src/analyzer/protocol/rfb/events.bif b/src/analyzer/protocol/rfb/events.bif index 44afb5b043..dd790d9a20 100644 --- a/src/analyzer/protocol/rfb/events.bif +++ b/src/analyzer/protocol/rfb/events.bif @@ -1,8 +1,3 @@ -## Generated for RFB event -## -## c: The connection record for the underlying transport-layer session/flow. -event rfb_event%(c: connection%) &deprecated="Remove in v3.1: This event never served a real purpose and will be removed. Please use the other rfb events instead."; - ## Generated for RFB event authentication mechanism selection ## ## c: The connection record for the underlying transport-layer session/flow. diff --git a/src/analyzer/protocol/rfb/rfb-analyzer.pac b/src/analyzer/protocol/rfb/rfb-analyzer.pac index ee0c4657bc..4568271453 100644 --- a/src/analyzer/protocol/rfb/rfb-analyzer.pac +++ b/src/analyzer/protocol/rfb/rfb-analyzer.pac @@ -1,11 +1,4 @@ refine flow RFB_Flow += { - function proc_rfb_message(msg: RFB_PDU): bool - %{ - if ( rfb_event ) - BifEvent::generate_rfb_event(connection()->bro_analyzer(), connection()->bro_analyzer()->Conn()); - return true; - %} - function proc_rfb_version(client: bool, major: bytestring, minor: bytestring) : bool %{ if (client) @@ -371,7 +364,3 @@ refine connection RFB_Conn += { return true; %} }; - -refine typeattr RFB_PDU += &let { - proc: bool = $context.flow.proc_rfb_message(this); -}; diff --git a/src/event.bif b/src/event.bif index 9fa5855359..d1ddf29d52 100644 --- a/src/event.bif +++ b/src/event.bif @@ -48,9 +48,6 @@ ## event zeek_init%(%); -## Deprecated synonym for :zeek:see:`zeek_init`. -event bro_init%(%) &deprecated="Remove in v3.1: use zeek_init"; - ## Generated at Zeek termination time. The event engine generates this event when ## Zeek is about to terminate, either due to having exhausted reading its input ## trace file(s), receiving a termination signal, or because Zeek was run without @@ -64,9 +61,6 @@ event bro_init%(%) &deprecated="Remove in v3.1: use zeek_init"; ## is not generated. event zeek_done%(%); -## Deprecated synonym for :zeek:see:`zeek_done`. -event bro_done%(%) &deprecated="Remove in v3.1: use zeek_done"; - ## Generated for every new connection. This event is raised with the first ## packet of a previously unknown connection. Zeek uses a flow-based definition ## of "connection" here that includes not only TCP sessions but also UDP and @@ -666,9 +660,6 @@ event reporter_error%(t: time, msg: string, location: string%) &error_handler; ## recursively for each ``@load``. event zeek_script_loaded%(path: string, level: count%); -## Deprecated synonym for :zeek:see:`zeek_script_loaded`. -event bro_script_loaded%(path: string, level: count%) &deprecated="Remove in v3.1: use zeek_script_loaded"; - ## Generated each time Zeek's script interpreter opens a file. This event is ## triggered only for files opened via :zeek:id:`open`, and in particular not for ## normal log files as created by log writers. diff --git a/src/main.cc b/src/main.cc index 45dbbec983..17211cd67c 100644 --- a/src/main.cc +++ b/src/main.cc @@ -84,7 +84,6 @@ int perftools_profile = 0; DNS_Mgr* dns_mgr; TimerMgr* timer_mgr; ValManager* val_mgr = 0; -PortManager* port_mgr = 0; logging::Manager* log_mgr = 0; threading::Manager* thread_mgr = 0; input::Manager* input_mgr = 0; @@ -364,7 +363,6 @@ void terminate_bro() delete reporter; delete plugin_mgr; delete val_mgr; - delete port_mgr; reporter = 0; } @@ -735,7 +733,6 @@ int main(int argc, char** argv) bro_start_time = current_time(true); val_mgr = new ValManager(); - port_mgr = new PortManager(); reporter = new Reporter(); thread_mgr = new threading::Manager(); plugin_mgr = new plugin::Manager(); diff --git a/src/parse.y b/src/parse.y index c409942cca..3f2e7fcc4b 100644 --- a/src/parse.y +++ b/src/parse.y @@ -1164,14 +1164,12 @@ func_hdr: } | TOK_EVENT event_id func_params opt_attr { - // Gracefully handle the deprecation of bro_init, bro_done, - // and bro_script_loaded - if ( streq("bro_init", $2->Name()) ) - $2 = global_scope()->Lookup("zeek_init"); - else if ( streq("bro_done", $2->Name()) ) - $2 = global_scope()->Lookup("zeek_done"); - else if ( streq("bro_script_loaded", $2->Name()) ) - $2 = global_scope()->Lookup("zeek_script_loaded"); + const char* name = $2->Name(); + if ( streq("bro_init", name) || streq("bro_done", name) || streq("bro_script_loaded", name) ) + { + auto base = std::string(name).substr(4); + reporter->Error(fmt("event %s() is no longer available, use zeek_%s() instead", name, base.c_str())); + } begin_func($2, current_module.c_str(), FUNC_FLAVOR_EVENT, 0, $3, $4); diff --git a/src/strings.bif b/src/strings.bif index 4f589bd078..ae1f8292d1 100644 --- a/src/strings.bif +++ b/src/strings.bif @@ -935,47 +935,6 @@ function safe_shell_quote%(source: string%): string return new StringVal(new BroString(1, dst, j)); %} -## Takes a string and escapes characters that would allow execution of -## commands at the shell level. Must be used before including strings in -## :zeek:id:`system` or similar calls. This function is deprecated, use -## :zeek:see:`safe_shell_quote` as a replacement. The difference is that -## :zeek:see:`safe_shell_quote` automatically returns a value that is -## wrapped in double-quotes, which is required to correctly and fully -## escape any characters that might be interpreted by the shell. -## -## source: The string to escape. -## -## Returns: A shell-escaped version of *source*. -## -## .. zeek:see:: system safe_shell_quote -function str_shell_escape%(source: string%): string &deprecated="Remove in v3.1: use safe_shell_quote" - %{ - unsigned j = 0; - const u_char* src = source->Bytes(); - unsigned n = source->Len(); - byte_vec dst = new u_char[n * 2 + 1]; - - for ( unsigned i = 0; i < n; ++i ) - { - switch ( src[i] ) { - case '`': case '"': case '\\': case '$': - - // case '|': case '&': case ';': case '(': case ')': case '<': - // case '>': case '\'': case '*': case '?': case '[': case ']': - // case '!': case '#': case '{': case '}': - dst[j++] = '\\'; - break; - default: - break; - } - - dst[j++] = src[i]; - } - - dst[j] = '\0'; - return new StringVal(new BroString(1, dst, j)); - %} - ## Finds all occurrences of a pattern in a string. ## ## str: The string to inspect. diff --git a/src/zeek.bif b/src/zeek.bif index 2f56ca52c0..c357c3ce5f 100644 --- a/src/zeek.bif +++ b/src/zeek.bif @@ -1820,15 +1820,6 @@ function getpid%(%) : count extern const char* zeek_version(); %%} -## Returns the Zeek version string. This function is deprecated, use -## :zeek:see:`zeek_version` instead. -## -## Returns: Zeek's version, e.g., 2.0-beta-47-debug. -function bro_version%(%): string &deprecated="Remove in v3.1: use zeek_version" - %{ - return new StringVal(zeek_version()); - %} - ## Returns the Zeek version string. ## ## Returns: Zeek's version, e.g., 2.0-beta-47-debug. @@ -2130,17 +2121,6 @@ function dump_rule_stats%(f: file%): bool return val_mgr->GetBool(1); %} -## Checks if Zeek is terminating. This function is deprecated, use -## :zeek:see:`zeek_is_terminating` instead. -## -## Returns: True if Zeek is in the process of shutting down. -## -## .. zeek:see:: terminate -function bro_is_terminating%(%): bool &deprecated="Remove in v3.1: use zeek_is_terminating" - %{ - return val_mgr->GetBool(terminating); - %} - ## Checks if Zeek is terminating. ## ## Returns: True if Zeek is in the process of shutting down. diff --git a/testing/btest/Baseline/bifs.str_shell_escape/out b/testing/btest/Baseline/bifs.str_shell_escape/out deleted file mode 100644 index 1845fefa37..0000000000 --- a/testing/btest/Baseline/bifs.str_shell_escape/out +++ /dev/null @@ -1,4 +0,0 @@ -24 -echo ${TEST} > "my file" -27 -echo \${TEST} > \"my file\" diff --git a/testing/btest/Baseline/coverage.bare-mode-errors/errors b/testing/btest/Baseline/coverage.bare-mode-errors/errors index c87b897c61..e69de29bb2 100644 --- a/testing/btest/Baseline/coverage.bare-mode-errors/errors +++ b/testing/btest/Baseline/coverage.bare-mode-errors/errors @@ -1 +0,0 @@ -warning in /Users/tim/Desktop/projects/zeek/testing/btest/../../scripts//base/utils/json.zeek, line 2: deprecated script loaded from command line arguments ="Remove in 3.1. to_json is now always available as a built-in function." diff --git a/testing/btest/Baseline/coverage.init-default/missing_loads b/testing/btest/Baseline/coverage.init-default/missing_loads index 87361a686a..893a603972 100644 --- a/testing/btest/Baseline/coverage.init-default/missing_loads +++ b/testing/btest/Baseline/coverage.init-default/missing_loads @@ -8,4 +8,3 @@ -./frameworks/openflow/cluster.zeek -./frameworks/packet-filter/cluster.zeek -./frameworks/sumstats/cluster.zeek --./utils/json.zeek diff --git a/testing/btest/Baseline/language.zeek_init/out b/testing/btest/Baseline/language.zeek_init/out index aa17ec8aa8..1a157c928a 100644 --- a/testing/btest/Baseline/language.zeek_init/out +++ b/testing/btest/Baseline/language.zeek_init/out @@ -1,8 +1,4 @@ -zeek_init at priority 10! -bro_init at priority 5! -zeek_init at priority 0! -bro_init at priority -10! -zeek_done at priority 10! -bro_done at priority 5! -zeek_done at priority 0! -bro_done at priority -10! +error in /home/robin/bro/master/testing/btest/.tmp/language.zeek_init/zeek_init.zeek, line 10: event bro_init() is no longer available, use zeek_init() instead +error in /home/robin/bro/master/testing/btest/.tmp/language.zeek_init/zeek_init.zeek, line 20: event bro_init() is no longer available, use zeek_init() instead +error in /home/robin/bro/master/testing/btest/.tmp/language.zeek_init/zeek_init.zeek, line 31: event bro_done() is no longer available, use zeek_done() instead +error in /home/robin/bro/master/testing/btest/.tmp/language.zeek_init/zeek_init.zeek, line 41: event bro_done() is no longer available, use zeek_done() instead diff --git a/testing/btest/Baseline/language.zeek_script_loaded/out b/testing/btest/Baseline/language.zeek_script_loaded/out index cddf509308..cc4b5291e3 100644 --- a/testing/btest/Baseline/language.zeek_script_loaded/out +++ b/testing/btest/Baseline/language.zeek_script_loaded/out @@ -1,4 +1,2 @@ -zeek_script_loaded priority 10 -bro_script_loaded priority 5 -zeek_script_loaded priority 0 -bro_script_loaded priority -10 +error in /home/robin/bro/master/testing/btest/.tmp/language.zeek_script_loaded/zeek_script_loaded.zeek, line 11: event bro_script_loaded() is no longer available, use zeek_script_loaded() instead +error in /home/robin/bro/master/testing/btest/.tmp/language.zeek_script_loaded/zeek_script_loaded.zeek, line 23: event bro_script_loaded() is no longer available, use zeek_script_loaded() instead diff --git a/testing/btest/bifs/str_shell_escape.zeek b/testing/btest/bifs/str_shell_escape.zeek deleted file mode 100644 index f3f08b0072..0000000000 --- a/testing/btest/bifs/str_shell_escape.zeek +++ /dev/null @@ -1,15 +0,0 @@ -# -# @TEST-EXEC: zeek -b %INPUT >out -# @TEST-EXEC: btest-diff out - -event zeek_init() - { - local a = "echo ${TEST} > \"my file\""; - - print |a|; - print a; - - local b = str_shell_escape(a); - print |b|; - print b; - } diff --git a/testing/btest/failed b/testing/btest/failed new file mode 100644 index 0000000000..a22b4ea1f0 --- /dev/null +++ b/testing/btest/failed @@ -0,0 +1,8 @@ +bifs.str_shell_escape +core.load-explicit-bro-suffix-fallback +coverage.init-default +language.zeek_init +language.zeek_script_loaded +plugins.legacy +coverage.sphinx-zeekygen-docs +coverage.bare-mode-errors diff --git a/testing/btest/language/zeek_init.zeek b/testing/btest/language/zeek_init.zeek index c1ca3ba65c..f8b63f8d51 100644 --- a/testing/btest/language/zeek_init.zeek +++ b/testing/btest/language/zeek_init.zeek @@ -1,6 +1,5 @@ -# @TEST-EXEC: zeek -b %INPUT >out -# @TEST-EXEC: btest-diff out - +# @TEST-EXEC-FAIL: zeek -b %INPUT >out 2>&1 +# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out event zeek_init() &priority=10 { diff --git a/testing/btest/language/zeek_script_loaded.zeek b/testing/btest/language/zeek_script_loaded.zeek index 9011790e93..f8c112a0b5 100644 --- a/testing/btest/language/zeek_script_loaded.zeek +++ b/testing/btest/language/zeek_script_loaded.zeek @@ -1,5 +1,5 @@ -# @TEST-EXEC: zeek -b %INPUT >out -# @TEST-EXEC: btest-diff out +# @TEST-EXEC-FAIL: zeek -b %INPUT >out 2>&1 +# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out event zeek_script_loaded(path: string, level: count) &priority=10 { From 0516f3f439decbe4c1b280cafa6001abddd4e3ac Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Mon, 27 Jan 2020 12:01:27 +0000 Subject: [PATCH 02/12] Change Bro wrapper script to now abort when old executable names are still used. --- zeek-wrapper.in | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/zeek-wrapper.in b/zeek-wrapper.in index 1372c573e7..249df3ad53 100755 --- a/zeek-wrapper.in +++ b/zeek-wrapper.in @@ -1,14 +1,13 @@ #! /usr/bin/env bash # -# Wrapper to continue supporting old names of executables. -# This will print a deprecation warning to stderr if (1) stdin/stdout/stderr -# are all connected to a tty, and (2) the environment variable ZEEK_IS_BRO -# is unset. +# Wrapper to continue reporting usage old names of executables. +# This will print an error warning to stderr if stdin/stdout/stderr +# are all connected to a tty. In any case, it will abort with error +# exit code. function deprecated { cat >&2 < Date: Mon, 27 Jan 2020 12:04:24 +0000 Subject: [PATCH 03/12] Remove bro-config.h.in and bro-path-dev.in. --- CMakeLists.txt | 3 --- bro-config.h.in | 5 ----- bro-path-dev.in | 1 - 3 files changed, 9 deletions(-) delete mode 100644 bro-config.h.in delete mode 120000 bro-path-dev.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 956f2cd9b8..a919b8ffe1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -379,11 +379,8 @@ endif () string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/bro-config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/bro-config.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h DESTINATION include/zeek) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bro-config.h DESTINATION include/zeek) if ( CAF_ROOT_DIR ) set(ZEEK_CONFIG_CAF_ROOT_DIR ${CAF_ROOT_DIR}) diff --git a/bro-config.h.in b/bro-config.h.in deleted file mode 100644 index 879249be38..0000000000 --- a/bro-config.h.in +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#pragma message("Warning: bro-config.h is deprecated, use zeek-config.h instead") - -#include "zeek-config.h" diff --git a/bro-path-dev.in b/bro-path-dev.in deleted file mode 120000 index 854029fbb8..0000000000 --- a/bro-path-dev.in +++ /dev/null @@ -1 +0,0 @@ -zeek-path-dev.in \ No newline at end of file From a941e3d94205dd8e39f01bab0e39e8591f5589bb Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Mon, 27 Jan 2020 12:06:43 +0000 Subject: [PATCH 04/12] Remove old_comm_usage_is_ok. That was just a left-over without any functionality. --- scripts/base/init-bare.zeek | 7 ------- 1 file changed, 7 deletions(-) diff --git a/scripts/base/init-bare.zeek b/scripts/base/init-bare.zeek index 5a6f0a47ae..9a908b651e 100644 --- a/scripts/base/init-bare.zeek +++ b/scripts/base/init-bare.zeek @@ -5228,10 +5228,3 @@ const global_hash_seed: string = "" &redef; ## files. The larger the value, the more confidence in UID uniqueness. ## The maximum is currently 128 bits. const bits_per_uid: count = 96 &redef; - -## Whether usage of the old communication system is considered an error or -## not. The default Zeek configuration no longer works with the non-Broker -## communication system unless you have manually taken action to initialize -## and set up the old comm. system. Deprecation warnings are still emitted -## when setting this flag, but they will not result in a fatal error. -const old_comm_usage_is_ok: bool = F &redef; From ad8e659943dc9af1a127b4c13ea2117a42d7ee88 Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Mon, 27 Jan 2020 12:08:00 +0000 Subject: [PATCH 05/12] Update notice user agent. --- scripts/base/frameworks/notice/main.zeek | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/base/frameworks/notice/main.zeek b/scripts/base/frameworks/notice/main.zeek index 9e43a9ed50..f3bc6bc8df 100644 --- a/scripts/base/frameworks/notice/main.zeek +++ b/scripts/base/frameworks/notice/main.zeek @@ -402,7 +402,7 @@ function email_headers(subject_desc: string, dest: string): string "From: ", mail_from, "\n", "Subject: ", mail_subject_prefix, " ", subject_desc, "\n", "To: ", dest, "\n", - "User-Agent: Bro-IDS/", zeek_version(), "\n"); + "User-Agent: Zeek/", zeek_version(), "\n"); if ( reply_to != "" ) header_text = string_cat(header_text, "Reply-To: ", reply_to, "\n"); return header_text; From 123cbba6be924720bd366de87b5a56bd09c7157e Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Mon, 27 Jan 2020 12:08:43 +0000 Subject: [PATCH 06/12] No longer symlink local.zeek to local.bro. --- scripts/CMakeLists.txt | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index e5611aefaa..96b2c897c1 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -7,26 +7,6 @@ install(DIRECTORY ./ DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH} FILES_MATCHING PATTERN "*.fp" ) -if ( NOT BINARY_PACKAGING_MODE ) - # If the user has a local.bro file from a previous installation, prefer to - # symlink local.zeek to it to avoid breaking their custom configuration -- - # because ZeekControl will now prefer to load local.zeek rather than local.bro - # and we're about to install a default version of local.zeek. - - set(_local_bro_dst ${ZEEK_SCRIPT_INSTALL_PATH}/site/local.bro) - set(_local_zeek_dst ${ZEEK_SCRIPT_INSTALL_PATH}/site/local.zeek) - - install(CODE " - if ( \"\$ENV{DESTDIR}\" STREQUAL \"\" ) - if ( EXISTS \"${_local_bro_dst}\" AND NOT EXISTS \"${_local_zeek_dst}\" ) - message(STATUS \"WARNING: installed ${_local_zeek_dst} as symlink to ${_local_bro_dst}\") - execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink - \"${_local_bro_dst}\" \"${_local_zeek_dst}\") - endif () - endif () - ") -endif () - # Install local script as a config file since it's meant to be modified directly. InstallPackageConfigFile( ${CMAKE_CURRENT_SOURCE_DIR}/site/local.zeek From bbc308cb021d70adcf6457314d363311a656a740 Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Mon, 27 Jan 2020 14:00:45 +0000 Subject: [PATCH 07/12] Fix missing rename. --- src/DNS_Mgr.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DNS_Mgr.cc b/src/DNS_Mgr.cc index 0b50700bd1..5599074b0d 100644 --- a/src/DNS_Mgr.cc +++ b/src/DNS_Mgr.cc @@ -467,7 +467,7 @@ void DNS_Mgr::InitPostScript() const char* cache_dir = dir ? dir : "."; cache_name = new char[strlen(cache_dir) + 64]; - sprintf(cache_name, "%s/%s", cache_dir, ".bro-dns-cache"); + sprintf(cache_name, "%s/%s", cache_dir, ".zeek-dns-cache"); LoadCache(fopen(cache_name, "r")); } From 649301b667e9027f6cd716c60a23880cacba07e2 Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Mon, 27 Jan 2020 14:17:41 +0000 Subject: [PATCH 08/12] Add warnings when loading scripts ending in ".bro", or using legacy environment variables. --- src/plugin/Manager.cc | 3 + src/util.cc | 70 ++++++++++++++----- src/util.h | 3 + .../out | 2 + .../load-explicit-bro-suffix-fallback.zeek | 4 +- 5 files changed, 64 insertions(+), 18 deletions(-) diff --git a/src/plugin/Manager.cc b/src/plugin/Manager.cc index 58dc52e033..51b85bdbb5 100644 --- a/src/plugin/Manager.cc +++ b/src/plugin/Manager.cc @@ -189,6 +189,7 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_ if ( is_file(init) ) { DBG_LOG(DBG_PLUGINS, " Loading %s", init.c_str()); + warn_if_legacy_script(init); scripts_to_load.push_back(init); break; } @@ -202,6 +203,7 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_ if ( is_file(init) ) { DBG_LOG(DBG_PLUGINS, " Loading %s", init.c_str()); + warn_if_legacy_script(init); scripts_to_load.push_back(init); break; } @@ -214,6 +216,7 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_ if ( is_file(init) ) { DBG_LOG(DBG_PLUGINS, " Loading %s", init.c_str()); + warn_if_legacy_script(init); scripts_to_load.push_back(init); break; } diff --git a/src/util.cc b/src/util.cc index 519c7ba35d..e52f365d1c 100644 --- a/src/util.cc +++ b/src/util.cc @@ -62,6 +62,36 @@ #endif #endif +static bool starts_with(const std::string_view& s, const std::string& beginning) + { + if ( beginning.size() > s.size() ) + return false; + + return std::equal(beginning.begin(), beginning.end(), s.begin()); + } + +TEST_CASE("util starts_with") + { + CHECK(starts_with("abcde", "ab") == true); + CHECK(starts_with("abcde", "de") == false); + CHECK(starts_with("abcde", "abcedf") == false); + } + +static bool ends_with(const std::string_view& s, const std::string& ending) + { + if ( ending.size() > s.size() ) + return false; + + return std::equal(ending.rbegin(), ending.rend(), s.rbegin()); + } + +TEST_CASE("util ends_with") + { + CHECK(ends_with("abcde", "de") == true); + CHECK(ends_with("abcde", "fg") == false); + CHECK(ends_with("abcde", "abcedf") == false); + } + TEST_CASE("util extract_ip") { CHECK(extract_ip("[1.2.3.4]") == "1.2.3.4"); @@ -1249,6 +1279,15 @@ TEST_CASE("util is_package_loader") const array script_extensions = {".zeek", ".bro"}; +void warn_if_legacy_script(const std::string_view& filename) + { + if ( ends_with(filename, ".bro") ) + { + std::string x(filename); + reporter->Warning("Loading script '%s' with legacy extension, support for '.bro' will be removed in Zeek v4.1", x.c_str()); + } + } + bool is_package_loader(const string& path) { string filename(std::move(SafeBasename(path).result)); @@ -1256,7 +1295,10 @@ bool is_package_loader(const string& path) for ( const string& ext : script_extensions ) { if ( filename == "__load__" + ext ) + { + warn_if_legacy_script(filename); return true; + } } return false; @@ -1294,6 +1336,7 @@ FILE* open_package(string& path, const string& mode) string p = path + ext; if ( can_read(p) ) { + warn_if_legacy_script(path); path.append(ext); return open_file(path, mode); } @@ -1604,21 +1647,6 @@ string find_file(const string& filename, const string& path_set, return string(); } -static bool ends_with(const std::string& s, const std::string& ending) - { - if ( ending.size() > s.size() ) - return false; - - return std::equal(ending.rbegin(), ending.rend(), s.rbegin()); - } - -TEST_CASE("util ends_with") - { - CHECK(ends_with("abcde", "de") == true); - CHECK(ends_with("abcde", "fg") == false); - CHECK(ends_with("abcde", "abcedf") == false); - } - string find_script_file(const string& filename, const string& path_set) { vector paths; @@ -1631,11 +1659,16 @@ string find_script_file(const string& filename, const string& path_set) string f = find_file_in_path(filename, paths[n], ext); if ( ! f.empty() ) + { + warn_if_legacy_script(f); return f; + } } if ( ends_with(filename, ".bro") ) { + warn_if_legacy_script(filename); + // We were looking for a file explicitly ending in .bro and didn't // find it, so fall back to one ending in .zeek, if it exists. auto fallback = string(filename.data(), filename.size() - 4) + ".zeek"; @@ -2186,7 +2219,12 @@ char* zeekenv(const char* name) if ( it == legacy_vars.end() ) return rval; - return getenv(it->second); + auto val = getenv(it->second); + + if ( val && starts_with(it->second, "BRO_") ) + reporter->Warning("Using legacy environment variable %s, support will be removed in Zeek v4.1; use %s instead", it->second, name); + + return val; } static string json_escape_byte(char c) diff --git a/src/util.h b/src/util.h index 5a5a8c5159..51cf00242f 100644 --- a/src/util.h +++ b/src/util.h @@ -265,6 +265,9 @@ extern std::string bro_prefixes(); extern const std::array script_extensions; +/** Prints a warning if the filename ends in .bro. */ +void warn_if_legacy_script(const std::string_view& filename); + bool is_package_loader(const std::string& path); extern void add_to_bro_path(const std::string& dir); diff --git a/testing/btest/Baseline/core.load-explicit-bro-suffix-fallback/out b/testing/btest/Baseline/core.load-explicit-bro-suffix-fallback/out index c67eefbfc1..a0a25698a1 100644 --- a/testing/btest/Baseline/core.load-explicit-bro-suffix-fallback/out +++ b/testing/btest/Baseline/core.load-explicit-bro-suffix-fallback/out @@ -1 +1,3 @@ +warning in /home/robin/bro/master/testing/btest/.tmp/core.load-explicit-bro-suffix-fallback/load-explicit-bro-suffix-fallback.zeek, line 5: Loading script 'foo.bro' with legacy extension, support for '.bro' will be removed in Zeek v4.1 +warning in /home/robin/bro/master/testing/btest/.tmp/core.load-explicit-bro-suffix-fallback/load-explicit-bro-suffix-fallback.zeek, line 5: Loading script 'foo.bro' with legacy extension, support for '.bro' will be removed in Zeek v4.1 loaded foo.zeek diff --git a/testing/btest/core/load-explicit-bro-suffix-fallback.zeek b/testing/btest/core/load-explicit-bro-suffix-fallback.zeek index d2ce412209..4cf890cb09 100644 --- a/testing/btest/core/load-explicit-bro-suffix-fallback.zeek +++ b/testing/btest/core/load-explicit-bro-suffix-fallback.zeek @@ -1,5 +1,5 @@ -# @TEST-EXEC: zeek -b %INPUT >out -# @TEST-EXEC: btest-diff out +# @TEST-EXEC: zeek -b %INPUT >out 2>&1 +# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out # We don't have a foo.bro, but we'll accept foo.zeek. @load foo.bro From e552a07249c12709b7243ff74259d8f81acd6656 Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Mon, 27 Jan 2020 14:42:34 +0000 Subject: [PATCH 09/12] Remove legancy symlinks in aux/. That's aux/bro-aux and aux/broctl. --- aux/bro-aux | 1 - aux/broctl | 1 - 2 files changed, 2 deletions(-) delete mode 120000 aux/bro-aux delete mode 120000 aux/broctl diff --git a/aux/bro-aux b/aux/bro-aux deleted file mode 120000 index b28967a8e2..0000000000 --- a/aux/bro-aux +++ /dev/null @@ -1 +0,0 @@ -zeek-aux \ No newline at end of file diff --git a/aux/broctl b/aux/broctl deleted file mode 120000 index d17a55b030..0000000000 --- a/aux/broctl +++ /dev/null @@ -1 +0,0 @@ -zeekctl \ No newline at end of file From 4eeabd521064adea6585775bae83e01c7a241bb4 Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Mon, 27 Jan 2020 15:40:52 +0000 Subject: [PATCH 10/12] Remove test for legacy plugin. We no longer support creating new plugins using the old naming scheme. --- testing/btest/Baseline/plugins.legacy/output | 6 -- .../btest/plugins/legacy-plugin/.btest-ignore | 0 .../plugins/legacy-plugin/CMakeLists.txt | 19 ------ .../scripts/Demo/Foo/base/main.zeek | 7 --- .../legacy-plugin/scripts/__load__.zeek | 1 - .../btest/plugins/legacy-plugin/src/Foo.cc | 59 ------------------- testing/btest/plugins/legacy-plugin/src/Foo.h | 29 --------- .../btest/plugins/legacy-plugin/src/Plugin.cc | 21 ------- .../plugins/legacy-plugin/src/events.bif | 2 - .../legacy-plugin/src/foo-analyzer.pac | 15 ----- .../legacy-plugin/src/foo-protocol.pac | 4 -- .../btest/plugins/legacy-plugin/src/foo.pac | 26 -------- testing/btest/plugins/legacy.zeek | 14 ----- 13 files changed, 203 deletions(-) delete mode 100644 testing/btest/Baseline/plugins.legacy/output delete mode 100644 testing/btest/plugins/legacy-plugin/.btest-ignore delete mode 100644 testing/btest/plugins/legacy-plugin/CMakeLists.txt delete mode 100644 testing/btest/plugins/legacy-plugin/scripts/Demo/Foo/base/main.zeek delete mode 100644 testing/btest/plugins/legacy-plugin/scripts/__load__.zeek delete mode 100644 testing/btest/plugins/legacy-plugin/src/Foo.cc delete mode 100644 testing/btest/plugins/legacy-plugin/src/Foo.h delete mode 100644 testing/btest/plugins/legacy-plugin/src/Plugin.cc delete mode 100644 testing/btest/plugins/legacy-plugin/src/events.bif delete mode 100644 testing/btest/plugins/legacy-plugin/src/foo-analyzer.pac delete mode 100644 testing/btest/plugins/legacy-plugin/src/foo-protocol.pac delete mode 100644 testing/btest/plugins/legacy-plugin/src/foo.pac delete mode 100644 testing/btest/plugins/legacy.zeek diff --git a/testing/btest/Baseline/plugins.legacy/output b/testing/btest/Baseline/plugins.legacy/output deleted file mode 100644 index 675a884b16..0000000000 --- a/testing/btest/Baseline/plugins.legacy/output +++ /dev/null @@ -1,6 +0,0 @@ -Demo::Foo - A Foo test analyzer (dynamic, version 1.0.0) - [Analyzer] Foo (ANALYZER_FOO, enabled) - [Event] foo_message - -=== -foo_message, [orig_h=::1, orig_p=37927/tcp, resp_h=::1, resp_p=4242/tcp], Hello, Foo!\x0a diff --git a/testing/btest/plugins/legacy-plugin/.btest-ignore b/testing/btest/plugins/legacy-plugin/.btest-ignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/testing/btest/plugins/legacy-plugin/CMakeLists.txt b/testing/btest/plugins/legacy-plugin/CMakeLists.txt deleted file mode 100644 index 92e1a90e9d..0000000000 --- a/testing/btest/plugins/legacy-plugin/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ - -project(Zeek-Plugin-Demo-Foo) - -cmake_minimum_required(VERSION 2.6.3) - -if ( NOT BRO_DIST ) - message(FATAL_ERROR "BRO_DIST not set") -endif () - -set(CMAKE_MODULE_PATH ${BRO_DIST}/cmake) - -include(BroPlugin) - -bro_plugin_begin(Demo Foo) -bro_plugin_cc(src/Plugin.cc) -bro_plugin_cc(src/Foo.cc) -bro_plugin_bif(src/events.bif) -bro_plugin_pac(src/foo.pac src/foo-protocol.pac src/foo-analyzer.pac) -bro_plugin_end() diff --git a/testing/btest/plugins/legacy-plugin/scripts/Demo/Foo/base/main.zeek b/testing/btest/plugins/legacy-plugin/scripts/Demo/Foo/base/main.zeek deleted file mode 100644 index 76c63723b7..0000000000 --- a/testing/btest/plugins/legacy-plugin/scripts/Demo/Foo/base/main.zeek +++ /dev/null @@ -1,7 +0,0 @@ - -const ports = { 4242/tcp }; - -event zeek_init() &priority=5 - { - Analyzer::register_for_ports(Analyzer::ANALYZER_FOO, ports); - } diff --git a/testing/btest/plugins/legacy-plugin/scripts/__load__.zeek b/testing/btest/plugins/legacy-plugin/scripts/__load__.zeek deleted file mode 100644 index 330718c604..0000000000 --- a/testing/btest/plugins/legacy-plugin/scripts/__load__.zeek +++ /dev/null @@ -1 +0,0 @@ -@load Demo/Foo/base/main diff --git a/testing/btest/plugins/legacy-plugin/src/Foo.cc b/testing/btest/plugins/legacy-plugin/src/Foo.cc deleted file mode 100644 index be3c52a98b..0000000000 --- a/testing/btest/plugins/legacy-plugin/src/Foo.cc +++ /dev/null @@ -1,59 +0,0 @@ - -#include "Foo.h" -#include "foo_pac.h" -#include "events.bif.h" - -#include - -using namespace plugin::Demo_Foo; - -Foo::Foo(Connection* conn) - : analyzer::tcp::TCP_ApplicationAnalyzer("Foo", conn) - { - interp = new binpac::Foo::Foo_Conn(this); - } - -Foo::~Foo() - { - delete interp; - } - -void Foo::Done() - { - analyzer::tcp::TCP_ApplicationAnalyzer::Done(); - - interp->FlowEOF(true); - interp->FlowEOF(false); - } - -void Foo::EndpointEOF(bool is_orig) - { - analyzer::tcp::TCP_ApplicationAnalyzer::EndpointEOF(is_orig); - interp->FlowEOF(is_orig); - } - -void Foo::DeliverStream(int len, const u_char* data, bool orig) - { - analyzer::tcp::TCP_ApplicationAnalyzer::DeliverStream(len, data, orig); - - assert(TCP()); - - if ( TCP()->IsPartial() ) - // punt on partial. - return; - - try - { - interp->NewData(orig, data, data + len); - } - catch ( const binpac::Exception& e ) - { - ProtocolViolation(fmt("Binpac exception: %s", e.c_msg())); - } - } - -void Foo::Undelivered(uint64 seq, int len, bool orig) - { - analyzer::tcp::TCP_ApplicationAnalyzer::Undelivered(seq, len, orig); - interp->NewGap(orig, len); - } diff --git a/testing/btest/plugins/legacy-plugin/src/Foo.h b/testing/btest/plugins/legacy-plugin/src/Foo.h deleted file mode 100644 index f68aa3814d..0000000000 --- a/testing/btest/plugins/legacy-plugin/src/Foo.h +++ /dev/null @@ -1,29 +0,0 @@ - -#pragma once - -#include "analyzer/protocol/tcp/TCP.h" -#include "analyzer/protocol/pia/PIA.h" - -namespace binpac { namespace Foo { class Foo_Conn; } } - -namespace plugin { -namespace Demo_Foo { - -class Foo : public analyzer::tcp::TCP_ApplicationAnalyzer { -public: - Foo(Connection* conn); - ~Foo(); - - virtual void Done(); - virtual void DeliverStream(int len, const u_char* data, bool orig); - virtual void Undelivered(uint64 seq, int len, bool orig); - virtual void EndpointEOF(bool is_orig); - - static analyzer::Analyzer* Instantiate(Connection* conn) - { return new Foo(conn); } - -protected: - binpac::Foo::Foo_Conn* interp; -}; - -} } diff --git a/testing/btest/plugins/legacy-plugin/src/Plugin.cc b/testing/btest/plugins/legacy-plugin/src/Plugin.cc deleted file mode 100644 index bd2662d67c..0000000000 --- a/testing/btest/plugins/legacy-plugin/src/Plugin.cc +++ /dev/null @@ -1,21 +0,0 @@ - -#include "Plugin.h" - -#include "Foo.h" - -namespace plugin { namespace Demo_Foo { Plugin plugin; } } - -using namespace plugin::Demo_Foo; - -plugin::Configuration Plugin::Configure() - { - AddComponent(new ::analyzer::Component("Foo", plugin::Demo_Foo::Foo::Instantiate)); - - plugin::Configuration config; - config.name = "Demo::Foo"; - config.description = "A Foo test analyzer"; - config.version.major = 1; - config.version.minor = 0; - config.version.patch = 0; - return config; - } diff --git a/testing/btest/plugins/legacy-plugin/src/events.bif b/testing/btest/plugins/legacy-plugin/src/events.bif deleted file mode 100644 index 4603fe4cf6..0000000000 --- a/testing/btest/plugins/legacy-plugin/src/events.bif +++ /dev/null @@ -1,2 +0,0 @@ - -event foo_message%(c: connection, data: string%); diff --git a/testing/btest/plugins/legacy-plugin/src/foo-analyzer.pac b/testing/btest/plugins/legacy-plugin/src/foo-analyzer.pac deleted file mode 100644 index a210a8430c..0000000000 --- a/testing/btest/plugins/legacy-plugin/src/foo-analyzer.pac +++ /dev/null @@ -1,15 +0,0 @@ - -refine connection Foo_Conn += { - - function Foo_data(msg: Foo_Message): bool - %{ - StringVal* data = new StringVal(${msg.data}.length(), (const char*) ${msg.data}.data()); - BifEvent::generate_foo_message(bro_analyzer(), bro_analyzer()->Conn(), data); - return true; - %} - -}; - -refine typeattr Foo_Message += &let { - proc: bool = $context.connection.Foo_data(this); -}; diff --git a/testing/btest/plugins/legacy-plugin/src/foo-protocol.pac b/testing/btest/plugins/legacy-plugin/src/foo-protocol.pac deleted file mode 100644 index 892513c4f0..0000000000 --- a/testing/btest/plugins/legacy-plugin/src/foo-protocol.pac +++ /dev/null @@ -1,4 +0,0 @@ - -type Foo_Message(is_orig: bool) = record { - data: bytestring &restofdata; -}; diff --git a/testing/btest/plugins/legacy-plugin/src/foo.pac b/testing/btest/plugins/legacy-plugin/src/foo.pac deleted file mode 100644 index 826bcc624e..0000000000 --- a/testing/btest/plugins/legacy-plugin/src/foo.pac +++ /dev/null @@ -1,26 +0,0 @@ -%include binpac.pac -%include bro.pac - -%extern{ -#include "Foo.h" - -#include "events.bif.h" -%} - -analyzer Foo withcontext { - connection: Foo_Conn; - flow: Foo_Flow; -}; - -connection Foo_Conn(bro_analyzer: BroAnalyzer) { - upflow = Foo_Flow(true); - downflow = Foo_Flow(false); -}; - -%include foo-protocol.pac - -flow Foo_Flow(is_orig: bool) { - datagram = Foo_Message(is_orig) withcontext(connection, this); -}; - -%include foo-analyzer.pac diff --git a/testing/btest/plugins/legacy.zeek b/testing/btest/plugins/legacy.zeek deleted file mode 100644 index bb663d744b..0000000000 --- a/testing/btest/plugins/legacy.zeek +++ /dev/null @@ -1,14 +0,0 @@ -# Test that legacy Bro plugins still work. -# @TEST-EXEC: ${DIST}/aux/zeek-aux/plugin-support/init-plugin -u . Demo Foo -# @TEST-EXEC: cp -r %DIR/legacy-plugin/* . -# @TEST-EXEC: ./configure --bro-dist=${DIST} && make -# @TEST-EXEC: unset ZEEK_PLUGIN_PATH; BRO_PLUGIN_PATH=`pwd` zeek -NN Demo::Foo >>output -# @TEST-EXEC: echo === >>output -# @TEST-EXEC: unset ZEEK_PLUGIN_PATH; BRO_PLUGIN_PATH=`pwd` zeek -r $TRACES/port4242.trace %INPUT >>output -# @TEST-EXEC: TEST_DIFF_CANONIFIER= btest-diff output - -event foo_message(c: connection, data: string) - { - print "foo_message", c$id, data; - } - From e1458360e3ea36b2f17ac6dc9c69e34de7a160b9 Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Mon, 27 Jan 2020 14:43:05 +0000 Subject: [PATCH 11/12] Small cleanup and updating submodules. --- aux/zeek-aux | 2 +- aux/zeekctl | 2 +- doc | 2 +- zeek-wrapper.in | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aux/zeek-aux b/aux/zeek-aux index 0790f42014..cd0daf5fda 160000 --- a/aux/zeek-aux +++ b/aux/zeek-aux @@ -1 +1 @@ -Subproject commit 0790f420148806c1380fc7e0e0a4278c7970753c +Subproject commit cd0daf5fda4b1c0848ccc0025d67205b0e006da7 diff --git a/aux/zeekctl b/aux/zeekctl index e166c066b6..172ad814e2 160000 --- a/aux/zeekctl +++ b/aux/zeekctl @@ -1 +1 @@ -Subproject commit e166c066b64b196a7dc5de285c68e0977344acc9 +Subproject commit 172ad814e2404a36b6efdd603619ff80f6a9fbca diff --git a/doc b/doc index 7192dbedf3..799ed621e3 160000 --- a/doc +++ b/doc @@ -1 +1 @@ -Subproject commit 7192dbedf3ca9ce49294057262074f0e888177f3 +Subproject commit 799ed621e33a5d3e3ba0288241989bfcfbd17f95 diff --git a/zeek-wrapper.in b/zeek-wrapper.in index 249df3ad53..3c4123b27a 100755 --- a/zeek-wrapper.in +++ b/zeek-wrapper.in @@ -1,8 +1,8 @@ #! /usr/bin/env bash # # Wrapper to continue reporting usage old names of executables. -# This will print an error warning to stderr if stdin/stdout/stderr -# are all connected to a tty. In any case, it will abort with error +# This will print an error to stderr if stdin/stdout/stderr +# are all connected to a tty. It will then abort with an error # exit code. function deprecated { From 42a7629695caf7ef9b09ebeedee7bee97e64e7de Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Wed, 29 Jan 2020 12:14:55 +0000 Subject: [PATCH 12/12] Update NEWS for naming changes. --- NEWS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/NEWS b/NEWS index 208fb89d5b..8ffa29783e 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,15 @@ New Functionality Changed Functionality --------------------- +- The naming-related backwards-compability wrappers & work-arounds + introduced in 3.0 have either changed their operation, or in some + cases been removed. Generally, anything that reported a + naming-related warning in 3.0 now aborts with a corresponding error + message. In cases where 3.0 silently continued to accept old names, + 3.1 now reports warnings. Most importantly, that's loading of + scripts with ".bro" endings, which are now flagged and should be + renamed. + - The key type of ``Known::service_store`` has changed to ``Known::AddrPortServTriplet`` and ``Known::services`` is now a table instead of just a set.