mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
Add minimal testcase for sqlite writer crash.
The writer did not work with a non-empty set or vector as the last element in the logged column.
This commit is contained in:
parent
cb6f6467c7
commit
81d0def327
2 changed files with 51 additions and 0 deletions
|
@ -0,0 +1 @@
|
|||
CC,AA,BB
|
50
testing/btest/scripts/base/frameworks/logging/sqlite/set.bro
Normal file
50
testing/btest/scripts/base/frameworks/logging/sqlite/set.bro
Normal file
|
@ -0,0 +1,50 @@
|
|||
#
|
||||
# Check if set wors in last position (the describe call in sqlite.cc has a good
|
||||
# chance of being off by one if someone changes it).
|
||||
#
|
||||
# @TEST-REQUIRES: which sqlite3
|
||||
# @TEST-REQUIRES: has-writer SQLite
|
||||
# @TEST-GROUP: sqlite
|
||||
#
|
||||
# @TEST-EXEC: bro -b %INPUT
|
||||
# @TEST-EXEC: sqlite3 ssh.sqlite 'select * from ssh' > ssh.select
|
||||
# @TEST-EXEC: btest-diff ssh.select
|
||||
#
|
||||
# Testing all possible types.
|
||||
|
||||
redef LogSQLite::unset_field = "(unset)";
|
||||
|
||||
module SSH;
|
||||
|
||||
export {
|
||||
redef enum Log::ID += { LOG };
|
||||
|
||||
type Log: record {
|
||||
ss: set[string];
|
||||
} &log;
|
||||
}
|
||||
|
||||
function foo(i : count) : string
|
||||
{
|
||||
if ( i > 0 )
|
||||
return "Foo";
|
||||
else
|
||||
return "Bar";
|
||||
}
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
Log::create_stream(SSH::LOG, [$columns=Log]);
|
||||
Log::remove_filter(SSH::LOG, "default");
|
||||
|
||||
local filter: Log::Filter = [$name="sqlite", $path="ssh", $writer=Log::WRITER_SQLITE];
|
||||
Log::add_filter(SSH::LOG, filter);
|
||||
|
||||
local empty_set: set[string];
|
||||
local empty_vector: vector of string;
|
||||
|
||||
Log::write(SSH::LOG, [
|
||||
$ss=set("AA", "BB", "CC")
|
||||
]);
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue