Commit graph

483 commits

Author SHA1 Message Date
Tim Wojtulewicz
9af6b2f48d clang-format: Set penalty for breaking after assignment operator 2021-09-27 10:49:48 -07:00
Tim Wojtulewicz
4423574d26 clang-format: Set IndentCaseBlocks to false 2021-09-27 10:49:48 -07:00
Tim Wojtulewicz
9cb54f5d44 clang-format: Force zeek-config.h to be earlier in the config ordering 2021-09-25 11:52:55 -07:00
Christian Kreibich
b6a11a69db Add debug string and ODesc support to HashKey class
This allows tracing of hash key buffer reservations, reads, and writes via a new
debug stream, and supports printing a summary of a HashKey object via
Describe(). The latter comes in handy e.g. in TableVal::Describe() (where
including the hash key is now available but commented out).
2021-09-20 17:51:43 -07:00
Tim Wojtulewicz
b2f171ec69 Reformat the world 2021-09-16 15:35:39 -07:00
Vern Paxson
a67897135e factoring out logic to check for overflows during coercions 2021-09-08 10:23:39 -07:00
Tim Wojtulewicz
802dfd80c1 Fix failing test due to patricia change 2021-07-23 12:26:09 -07:00
Johanna Amann
13cfa4c938 Fix handling of timers when cloning TableVals
When cloning TableVals, a new timer was created for the wrong object
(the existing TableVal, not the clone). This lead to the already
existing timer being no longer accessible. Which, in turn, leads to an
abandoned timer reading into no longer allocated data when the original
TableVal is deleted.

Fixes GH-1687
2021-07-21 12:52:22 +01:00
Johanna Amann
e4b2fa50a9 Merge remote-tracking branch 'origin/master' into topic/johanna/gh-859 2021-06-29 15:09:56 +01:00
Johanna Amann
833168090a Add ability to check if hostname is valid for a specific cert
This commit adds two new bifs, x509_check_hostname and
x509_check_cert_hostname. These bifs can be used to check if a given
hostname which can, e.g., be sent in a SNI is valid for a specific
certificate.

This PR furthermore modifies the ssl logs again, and adds information
about this to the log-file. Furthermore we now by default remove the
server certificate information from ssl.log - I doubt that this is often
looked at, it is not present in TLS 1.3, we do still have the SNI, and
if you need it you have the information in x509.log.

This also fixes a small potential problem in X509.cc assuming there
might be SAN-entries that contain null-bytes.

Baseline update will follow in another commit.
2021-06-29 15:00:48 +01:00
Tim Wojtulewicz
a7fd34375f GH-572: Mark MemoryAllocation() and related methods deprecated 2021-06-28 11:07:58 -07:00
Vern Paxson
099dc99d2b fix for cloning records with fields of type "any" 2021-06-01 08:52:24 -07:00
Vern Paxson
d524318154 faster construction of records by factoring static decisions into RecordType's 2021-05-30 18:25:15 -07:00
Vern Paxson
e06d988bfd support for constructing VectorVal's directly from underlying ZVal vectors 2021-05-30 17:58:53 -07:00
Vern Paxson
fb01f6fdef support for ensuring that a vector can be treated as having a homogeneous type 2021-05-30 17:55:03 -07:00
Vern Paxson
a16a25efbd fixed / removed out-of-date comments, tidied check_and_promote_args() interface 2021-05-30 17:25:40 -07:00
Vern Paxson
f2f041b63b various accessors used by ZAM compiler 2021-05-30 17:16:03 -07:00
Vern Paxson
09dc074a26 switched RecordVal's to use std::optional for tracking missing fields 2021-05-02 12:33:20 -07:00
Jon Siwek
d51bd4bc46 Fix using clear_table() within an &expire_func
This previously crashed since clear_table()/TableVal::RemoveAll() left
behind a stale iterator to the old table causing a heap-use-after-free
when resuming table expiry iteration in TableVal::DoExpire().
2021-04-26 22:49:44 -07:00
Jon Siwek
76483a9efa Remove saving/restoring of value pointer after calling expire_func
It's no longer used for anything.  Previously, it was used to detect
whether the expiry batch finished iterating the entire table or not, but
that's now determined by directly checking if the iterator itself
signifies the end of the table.
2021-04-26 22:31:24 -07:00
Jon Siwek
f28a648057 Avoid allocating a HashKey for no-op table expiry iterations 2021-04-26 22:07:13 -07:00
Jon Siwek
e8247c2472 Merge remote-tracking branch 'origin/topic/vern/vector-holes'
* origin/topic/vern/vector-holes:
  Remove NEWS entry regarding changed vector-holes functionality
  Fix potential segfaults in VectorVal Insert/Remove methods
  Fix copy() to work with a vector that has trailing holes
  update test suite for vector holes now being supported for numeric types
  add vector tests for creating holes, "in" operator, "?" operator, copying vectors with holes
  restore support for vectors with holes remove vestigial comment
  fix using ++/-- to vectors that contain holes
2021-04-20 14:43:01 -07:00
Jon Siwek
fd5cdbbe50 Fix potential segfaults in VectorVal Insert/Remove methods
The existence/hole check for managed types was needed to prevent
accessing a nil-optional value.
2021-04-19 19:29:37 -07:00
Jon Siwek
819fc1aac0 Fix copy() to work with a vector that has trailing holes
Previously, the trailing holes would not be preserved in the copy.
2021-04-19 19:23:04 -07:00
Vern Paxson
c1903afb3b restore support for vectors with holes
remove vestigial comment
2021-04-14 18:16:46 -07:00
Jon Siwek
01f6264c87 GH-1503: Improve &expire_func compatibility type-checking
Previously, incompatible &expire_funcs could mistakenly be used, such as
when using that attribute on the unspecified table()/set()
initializations/assignments, resulting in invalid function calls that
eventually crash Zeek.
2021-04-12 16:27:50 -07:00
Jon Siwek
c0b8fc4d60 Change TableVal::ToMap() to return ValPtr-indexed maps 2021-04-03 10:08:02 -07:00
Vern Paxson
6e8baafeb9 Added TableVal::ToMap to retrieve a table's entire contents as a unordered_map 2021-04-01 17:33:37 -07:00
Tim Wojtulewicz
f45df63cd0 Merge remote-tracking branch 'origin/topic/vern/zval'
* origin/topic/vern/zval: (42 commits)
  whitespace tweaks
  resolved some TODO comments
  remove unnecessary casts, and change necessary ones to use static_cast<>
  explain cmp_func default
  change functions for ZVal type management to static members
  fix some unsigned/signed integer warnings
  address lint concern about uninitialized variable
  Remove use of obsolete forward-declaration macros
  fix #include's that lack zeek/ prefixes
  explicitly populate holes created in vectors
  fixes for now-incorrect assumption that GetField always returns an existing ValPtr
  memory management for assignment to vector elements
  memory management for assignment to record fields
  destructor cleanup from ZAM_vector/ZAM_record
  fix #include's that lack zeek/ prefixes
  overlooked another way in which vector holes can be created
  initialize vector holes to the correct corresponding type
  explicitly populate holes created in vectors
  fix other instances of GetField().get() assuming long-lived ValPtr's
  fix for now-incorrect assumption that GetField always returns an existing ValPtr
  ...
2021-03-23 20:44:19 -07:00
Jon Siwek
f46d3dec8f Merge remote-tracking branch 'origin/topic/vern/cpp-new-func'
- Removed a couple of dead statements during merge

* origin/topic/vern/cpp-new-func:
  option for deterministic descriptions of sets & tables
  determinism for concurrent Zeek test suite invocations; split out deprecations
  disambiguate descriptions of enums; include attributes when describing records
  more liberal view of attribute equality; allow suppressing attr type-checking
  support for operations on sets that return new values
  low-level addition of enum values
  sundry accessors/cast-ers; RE_Matcher's track their construction values
  convenience functions for comparing IP addresses
2021-03-23 19:27:11 -07:00
Vern Paxson
9e4c87b112 option for deterministic descriptions of sets & tables 2021-03-18 16:18:32 -07:00
Vern Paxson
efe40204e0 change functions for ZVal type management to static members 2021-03-18 11:31:31 -07:00
Vern Paxson
d53d2ac755 sundry accessors/cast-ers; RE_Matcher's track their construction values 2021-03-18 10:33:10 -07:00
Vern Paxson
1e316c05c9 fix some unsigned/signed integer warnings 2021-03-01 17:08:14 -08:00
Vern Paxson
6aab151d97 explicitly populate holes created in vectors 2021-02-28 07:23:06 -08:00
Vern Paxson
3a59bc1a37 memory management for assignment to vector elements 2021-02-28 07:22:40 -08:00
Vern Paxson
7adcd1b27b memory management for assignment to record fields 2021-02-28 07:22:31 -08:00
Vern Paxson
498d8c4bde destructor cleanup from ZAM_vector/ZAM_record 2021-02-28 07:22:18 -08:00
Vern Paxson
c757db2714 new RecordVal Remove() method to clear a field 2021-02-25 15:04:46 -08:00
Vern Paxson
0118b6ee38 migrate to differentiated vector "At" accessors to support future efficiency 2021-02-25 13:28:23 -08:00
Vern Paxson
3f6f8e0709 use HasField() rather than GetField() where appropriate 2021-02-25 12:38:46 -08:00
Vern Paxson
13e7ba3a00 moving sort()/order() functionality into VectorVal 2021-02-24 18:09:40 -08:00
Vern Paxson
0299ea0894 convert VectorVal's to use vector<ZVal> as internal representation 2021-02-24 17:38:31 -08:00
Vern Paxson
6121e409d3 convert RecordVal's to use vector<ZVal> as internal representation 2021-02-24 17:02:47 -08:00
Jon Siwek
8a8a983c49 Add missing zeek/ to header includes
Related to https://github.com/zeek/zeek/pull/1377
2021-01-29 19:16:29 -08:00
Tim Wojtulewicz
0618be792f Remove all of the random single-file deprecations
These are the changes that don't require a ton of changes to other files outside
of the original removal.
2021-01-27 10:52:40 -07:00
Tim Wojtulewicz
892124378c Implement standard-library-compatible iterators for Dictionary 2021-01-14 13:49:40 -07:00
Tim Wojtulewicz
42f2691251 Some review cleanup in Val.cc 2021-01-14 11:58:59 -07:00
Vern Paxson
e652aff277 Changes addressing pending issues per PR discussion 2021-01-14 11:58:59 -07:00
Vern Paxson
7f92a573d2 Remove BroValUnion by hoisting underlying Val subclass values into subclasses 2021-01-14 11:58:59 -07:00