Commit graph

6667 commits

Author SHA1 Message Date
Jon Siwek
a961f0b4c4 Fix packet filter memory leaks 2020-01-02 12:05:49 -08:00
Jon Siwek
7db84dfcb6 Skip sending thread heartbeat if it alread asked to be finished
Otherwise the heartbeat message may fail to be processed and show up as
leaked memory.
2020-01-02 12:05:49 -08:00
Jon Siwek
13831ca21b Fix memory leak of sqlite input reader prepared statement 2020-01-02 12:05:49 -08:00
Jon Siwek
9e07b8a9f1 Prevent duplicate "finish" threading messages
As they don't get processed and may show up as a memory leak.
2020-01-02 12:05:49 -08:00
Jon Siwek
3742e5601c Fix memory leak when table-based input stream overwrites old entries 2020-01-02 12:05:49 -08:00
Jon Siwek
53fadb2bb0 Fix memory leaks in Kerberos ticket decryption
Memory allocated to the decrypted ticket data as well as the server
principal were not freed.

Also fixed potential leaks in error cases that called
krb5_get_error_message() without freeing the returned value.
2020-01-02 12:05:49 -08:00
Jon Siwek
c0d6eb9efb Fix malloc/delete mismatch in JSON formatting
ODesc allocated with malloc() and BroString deallocated with delete[],
but really the intermediate BroString wasn't even needed when copying
into std::string.
2020-01-01 12:47:39 -08:00
Jon Siwek
8cdcfad6d2 Delete/timeout pending DNS requests during shutdown
Primarily, this change prevents the pending requests showing up as
memory leaks.
2020-01-01 12:47:39 -08:00
Jon Siwek
2fbcf23f76 Fix memory leak in OCSP parsing functions
Various OCSP parsing functions used in presence of OpenSSL 1.1 used
"d2i_ASN1_SEQUENCE_ANY" which returns a "STACK_OF(ASN1_TYPE)", but used
"sk_ASN1_TYPE_free" instead of "sk_ASN1_TYPE_pop_free" to free it.  The
former only frees the stack structure while the later frees both the
structure and the elements.
2020-01-01 12:47:39 -08:00
Jon Siwek
bf90587cb8 Free the global X509 certificate root store on shutdown
Otherwise LeakSanitizer reports its contents as leaked.
2020-01-01 12:47:39 -08:00
Jon Siwek
447c3712cf Add general LeakSanitizer macros/instrumentation 2020-01-01 12:47:39 -08:00
Dev Bali
4002a1124e Enable Patterns as Table index in non singleton cases 2019-12-19 19:32:55 -08:00
Dev Bali
a907732e25 Added support to create a Hashkey for PatternVals using their Pattern Texts 2019-12-19 19:32:55 -08:00
Tim Wojtulewicz
98d1aadb9e GHI-599: avoid memory leak with default pattern matching and json formatting 2019-12-13 10:07:51 -07:00
Tim Wojtulewicz
679da0b15b Merge remote-tracking branch 'origin/topic/jsiwek/gh-700-zeek-args-bif'
* origin/topic/jsiwek/gh-700-zeek-args-bif:
  GH-700: add zeek_args() BIF
2019-12-05 12:36:35 -07:00
Tim Wojtulewicz
66f5f6916b Fix typo in documentation for packet_sources BIF method 2019-12-05 12:21:36 -07:00
Tim Wojtulewicz
5c85b083b6 Merge remote-tracking branch 'origin/topic/jsiwek/gh-700-packet-sources-bif'
* origin/topic/jsiwek/gh-700-packet-sources-bif:
  GH-700: add packet_sources() BIF
2019-12-05 11:58:06 -07:00
Jon Siwek
30d0b21ecc Merge remote-tracking branch 'origin/topic/dev/print-to-log'
Adjustments during merge:

- kept the UNKNOWN Log::ID as placeholder value
- changed the coverage.find-bro-logs test to check for arbitrary $path
  field values instead of just string literals
- don't force EnumVal to unsigned integer since the relevant union member
  is the signed integer and added the relevant enum values/types to
  .bif files for easier access
- compare FILE* versus file name to check for stdout equality (don't
  think it matters much, just a bit more efficient)
- minor whitespace/style tweaks

* origin/topic/dev/print-to-log:
  Added a non boolean configuration and other changes as suggested by Jon
  Allow Print Statements to be redirected to a Log# This is a combination of 3 commits.
2019-12-02 13:47:09 -08:00
Jon Siwek
57c7cbdb92 GH-700: add zeek_args() BIF
Provides access to all zeek command-line arguments ("argv").
2019-11-28 10:24:48 -08:00
Jon Siwek
6e7b101df2 GH-700: add packet_sources() BIF
Provides access to properties of packet sources, like interface or pcap
file name.
2019-11-28 09:44:38 -08:00
Dev Bali
4be6871df2 Added a non boolean configuration and other changes as suggested by Jon 2019-11-26 21:53:21 -08:00
Johanna Amann
e5db1f085c Merge remote-tracking branch 'origin/topic/jsiwek/gh-684-fix-rpc-parsing'
* origin/topic/jsiwek/gh-684-fix-rpc-parsing:
  GH-684: Fix parsing of RPC calls with non-AUTH_UNIX flavors

Addresses GH-684
2019-11-21 08:50:28 -08:00
Johanna Amann
5dafa7218d Merge remote-tracking branch 'origin/topic/jsiwek/fix-zeek-profiler-file'
* origin/topic/jsiwek/fix-zeek-profiler-file:
  Fix ZEEK_PROFILER_FILE file format/parsing
2019-11-21 08:37:04 -08:00
Robin Sommer
a00f139f1c Merge remote-tracking branch 'origin/topic/jsiwek/gh-646-conn-removal'
Clarified doc strings a bit.

* origin/topic/jsiwek/gh-646-conn-removal:
  GH-646: add new "successful_connection_remove" event
2019-11-18 12:08:12 +00:00
Jon Siwek
25ae6d90b7 Merge remote-tracking branch 'origin/topic/jsiwek/openbsd'
* origin/topic/jsiwek/openbsd:
  Adjust btests for OpenBSD portability
  Convert pcapng test suite files to pcap format
  Fix undefined symbols loading libbroker on OpenBSD
  Fix compile warnings on OpenBSD
2019-11-15 18:26:50 -08:00
Jon Siwek
17fd371eae Merge remote-tracking branch 'origin/topic/neverlord/doctest'
- Minor whitespace tweaks
- Add line to build summary output for whether unit tests are enabled

* origin/topic/neverlord/doctest:
  Add doctest license and copyright
  Integrate review feedback
  Fix submodule reference for doctest
  Add initial scaffold for unit testing via doctest
2019-11-14 19:17:37 -08:00
Dominik Charousset
773adab76b Integrate review feedback 2019-11-14 09:15:50 +01:00
Dev Bali
c9016f1397 Allow Print Statements to be redirected to a Log# This is a combination of 3 commits. 2019-11-13 19:59:42 -08:00
Jon Siwek
ca48a1865d Merge branch 'improve-container-record-fields-bif' of https://github.com/henridf/zeek
- Minor whitespace adjustment in merge

* 'improve-container-record-fields-bif' of https://github.com/henridf/zeek:
  Recursively handle into container types in record_fields()
  tabify
  Apply suggestions from code review
  Print full container types in record_fields()
2019-11-13 13:46:27 -08:00
Jon Siwek
37a478ae99 GH-684: Fix parsing of RPC calls with non-AUTH_UNIX flavors
The parsing logic that should be specific to the AUTH_UNIX credential
flavor was previously applied unconditionally to other flavors.
2019-11-13 13:14:14 -08:00
Henri DF
a645e38b78 Recursively handle into container types in record_fields() 2019-11-13 15:28:06 +01:00
Henri DF
bb8d6bca67 tabify 2019-11-13 14:06:47 +01:00
Henri DF
a0fa5758a6
Apply suggestions from code review
Co-Authored-By: Jon Siwek <jsiwek@corelight.com>
2019-11-13 13:49:06 +01:00
Dominik Charousset
8c848079fb Fix submodule reference for doctest 2019-11-12 17:05:17 +01:00
Henri DF
26633eb727 Print full container types in record_fields() 2019-11-12 13:19:12 +01:00
Dominik Charousset
f6407a4e0f Add initial scaffold for unit testing via doctest 2019-11-12 10:03:49 +01:00
Jon Siwek
31f60853c9 GH-646: add new "successful_connection_remove" event
And switch Zeek's base scripts over to using it in place of
"connection_state_remove".  The difference between the two is
that "connection_state_remove" is raised for all events while
"successful_connection_remove" excludes TCP connections that were never
established (just SYN packets).  There can be performance benefits
to this change for some use-cases.

There's also a new event called ``connection_successful`` and a new
``connection`` record field named "successful" to help indicate this new
property of connections.
2019-11-11 19:52:59 -08:00
Jon Siwek
eaa1350656 Update embedded CAF to 0.17.3 2019-11-11 13:40:31 -08:00
Jon Siwek
11028f45a7 Fix compile warnings on OpenBSD
warning: '__inet_makeaddr' has C-linkage specified, but returns
incomplete type 'struct in_addr' which could be incompatible with C
2019-11-08 12:29:12 -08:00
Jon Siwek
afb8bc6df8 Fix ZEEK_PROFILER_FILE file format/parsing
Some Zeek script statement descriptions were exceeding the hardcoded
maximum length and also could contain tab characters which were
supposed to be reserved for use as a delimiter in the file format.
2019-11-07 16:47:09 -08:00
Johanna Amann
b86a8acc2b Merge remote-tracking branch 'origin/topic/jsiwek/improve-record-fields-bif'
* origin/topic/jsiwek/improve-record-fields-bif:
  Allow record_fields() string arguments that name a record type
2019-11-07 13:49:14 -08:00
Jon Siwek
8aa77436f9 Refactor misc. Supervisor code
E.g. mostly to start taking advantage of C++17 things like
std::optional.  Also IntrusivePtr.
2019-11-05 19:29:43 -08:00
Jon Siwek
c43ffc14fe Fix misc. Supervisor bugs
- Stem environment wasn't inherited if it needs to be exec()'d
- Fix node creation message format when reviving Stem via exec()
- Cluster node type for workers was set wrong
2019-11-05 14:12:55 -08:00
Jon Siwek
cc37e505e4 Merge remote-tracking branch 'origin/master' into topic/jsiwek/supervisor 2019-11-05 10:11:47 -08:00
Jon Siwek
5cece12333 Merge remote-tracking branch 'origin/topic/neverlord/intrusive-ptr'
* origin/topic/neverlord/intrusive-ptr:
  Add API documentation to IntrusivePtr
  Rename make{ Counted => _intrusive }
  Remove braces around single return statements
  Integrate review feedback
  Add and use new IntrusivePt type in Zeek
2019-11-05 09:56:07 -08:00
Jon Siwek
1afcb5c993 Merge remote-tracking branch 'origin/topic/neverlord/object-libraries'
* origin/topic/neverlord/object-libraries:
  Update CMake submodule
  Use object libraries for subdir libs and plugins
2019-11-04 16:57:37 -08:00
Jon Siwek
e34562df48 Fix error handling in decode_base64() 2019-11-04 10:00:17 -08:00
Jon Siwek
b6def63167 Revert "Merge remote-tracking branch 'origin/topic/dev/bugrpone-narrowing-conversions-base64'"
This reverts commit 705210a035.
The original changes broke the Base64.h API which may be used by
external plugins.

Fixes GH-676
2019-11-04 09:47:56 -08:00
Jon Siwek
33c26e9ea3 Use #pragma once in Base64.h 2019-11-01 15:59:15 -07:00
Jon Siwek
63fe835acf Allow record_fields() string arguments that name a record type 2019-11-01 12:46:17 -07:00