diff --git a/NEWS b/NEWS index 2f58fb4070..060b25192f 100644 --- a/NEWS +++ b/NEWS @@ -381,6 +381,7 @@ Removed Functionality - ``rescan_state`` - ``log_file_name`` - ``open_log_file`` + - ``disable_print_hook`` - The following events were deprecated in version 2.6 or below and are completely removed from this release: @@ -409,6 +410,7 @@ Removed Functionality - ``software_version_found`` - ``software_unparsed_version_found`` - ``software_parse_error`` + - ``print_hook`` - The following types/records were deprecated in version 2.6 or below and are removed from this release: @@ -437,6 +439,7 @@ Removed Functionality - ``ssl_ca_certificate`` - ``ssl_private_key`` - ``ssl_passphrase`` + - ``suppress_local_output`` - The following constants were used as part of deprecated functionality in version 2.6 or below and are removed from this release: diff --git a/scripts/base/init-bare.zeek b/scripts/base/init-bare.zeek index d002334a03..c35525fc23 100644 --- a/scripts/base/init-bare.zeek +++ b/scripts/base/init-bare.zeek @@ -4723,9 +4723,6 @@ const time_machine_profiling = F &redef; ## If true, warns about unused event handlers at startup. const check_for_unused_event_handlers = F &redef; -## Deprecated. -const suppress_local_output = F &redef; - ## Holds the filename of the trace file given with ``-w`` (empty if none). ## ## .. zeek:see:: record_all_packets diff --git a/src/File.cc b/src/File.cc index d1f706514f..28fd8bea9c 100644 --- a/src/File.cc +++ b/src/File.cc @@ -168,7 +168,6 @@ void BroFile::Init() is_open = 0; attrs = 0; buffered = true; - print_hook = true; raw_output = false; t = 0; diff --git a/src/File.h b/src/File.h index 07512d4465..ffd912ab39 100644 --- a/src/File.h +++ b/src/File.h @@ -63,9 +63,6 @@ public: // Get the file with the given name, opening it if it doesn't yet exist. static BroFile* GetFile(const char* name); - void DisablePrintHook() { print_hook = false; } - bool IsPrintHookEnabled() const { return print_hook; } - void EnableRawOutput() { raw_output = true; } bool IsRawOutput() const { return raw_output; } @@ -98,7 +95,6 @@ protected: Attributes* attrs; bool buffered; double open_time; - bool print_hook; bool raw_output; static const int MIN_BUFFER_SIZE = 1024; diff --git a/src/Stmt.cc b/src/Stmt.cc index 58bca4fc5b..913fe31573 100644 --- a/src/Stmt.cc +++ b/src/Stmt.cc @@ -203,49 +203,25 @@ Val* PrintStmt::DoExec(val_list* vals, stmt_flow_type& /* flow */) const ++offset; } - bool ph = print_hook && f->IsPrintHookEnabled(); - desc_style style = f->IsRawOutput() ? RAW_STYLE : STANDARD_STYLE; - if ( ! (suppress_local_output && ph) ) - { - if ( f->IsRawOutput() ) - { - ODesc d(DESC_READABLE); - d.SetFlush(0); - d.SetStyle(style); - - PrintVals(&d, vals, offset); - f->Write(d.Description(), d.Len()); - } - else - { - ODesc d(DESC_READABLE, f); - d.SetFlush(0); - d.SetStyle(style); - - PrintVals(&d, vals, offset); - f->Write("\n", 1); - } - } - - if ( ph ) + if ( f->IsRawOutput() ) { ODesc d(DESC_READABLE); + d.SetFlush(0); d.SetStyle(style); + PrintVals(&d, vals, offset); + f->Write(d.Description(), d.Len()); + } + else + { + ODesc d(DESC_READABLE, f); + d.SetFlush(0); + d.SetStyle(style); - if ( print_hook ) - { - ::Ref(f); - - // Note, this doesn't do remote printing. - mgr.Dispatch( - new Event( - print_hook, - {new Val(f), new StringVal(d.Len(), d.Description())}), - true); - } + PrintVals(&d, vals, offset); + f->Write("\n", 1); } return 0; diff --git a/src/event.bif b/src/event.bif index 76a16fb071..79e54b9d37 100644 --- a/src/event.bif +++ b/src/event.bif @@ -813,6 +813,3 @@ event gaobot_signature_found%(c: connection%); ## Shows an IP address anonymization mapping. event anonymization_mapping%(orig: addr, mapped: addr%); - -## Deprecated. Will be removed. -event print_hook%(f:file, s: string%); diff --git a/src/zeek.bif b/src/zeek.bif index dac9f09bad..005d0be541 100644 --- a/src/zeek.bif +++ b/src/zeek.bif @@ -4723,28 +4723,10 @@ function file_size%(f: string%) : double return new Val(double(s.st_size), TYPE_DOUBLE); %} -## Disables sending :zeek:id:`print_hook` events to remote peers for a given -## file. In a -## distributed setup, communicating Zeek instances generate the event -## :zeek:id:`print_hook` for each print statement and send it to the remote -## side. When disabled for a particular file, these events will not be -## propagated to other peers. -## -## f: The file to disable :zeek:id:`print_hook` events for. -## -## .. zeek:see:: enable_raw_output -function disable_print_hook%(f: file%): any - %{ - f->DisablePrintHook(); - return 0; - %} - ## Prevents escaping of non-ASCII characters when writing to a file. ## This function is equivalent to :zeek:attr:`&raw_output`. ## ## f: The file to disable raw output for. -## -## .. zeek:see:: disable_print_hook function enable_raw_output%(f: file%): any %{ f->EnableRawOutput(); diff --git a/testing/btest/bifs/enable_raw_output.test b/testing/btest/bifs/enable_raw_output.test index c46b6e317f..b685b44069 100644 --- a/testing/btest/bifs/enable_raw_output.test +++ b/testing/btest/bifs/enable_raw_output.test @@ -4,7 +4,6 @@ # @TEST-EXEC: zeek -b %INPUT # @TEST-EXEC: tr '\000' 'X' output # @TEST-EXEC: btest-diff output -# @TEST-EXEC: cmp myfile hookfile event zeek_init() { @@ -14,10 +13,3 @@ event zeek_init() print myfile, "hello\x00world", "hi"; close(myfile); } - -event print_hook(f: file, s: string) - { - local hookfile = open("hookfile"); - write_file(hookfile, s); - close(hookfile); - } diff --git a/testing/btest/language/raw_output_attr.test b/testing/btest/language/raw_output_attr.test index ccf616405e..7f57481807 100644 --- a/testing/btest/language/raw_output_attr.test +++ b/testing/btest/language/raw_output_attr.test @@ -4,7 +4,6 @@ # @TEST-EXEC: zeek -b %INPUT # @TEST-EXEC: tr '\000' 'X' output # @TEST-EXEC: btest-diff output -# @TEST-EXEC: cmp myfile hookfile # first check local variable of file type w/ &raw_output @@ -16,10 +15,3 @@ event zeek_init() print myfile, "hello\x00world", "hi"; close(myfile); } - -event print_hook(f: file, s: string) - { - local hookfile = open("hookfile"); - write_file(hookfile, s); - close(hookfile); - }