mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
Testing/external scripts no longer compute MD5 checksums for SMTP
entities. Before, whether they did depended on libmagic. To do that, smpt/entities.bro gets a new option `never_calc_md5`. Also restructuring the tests a bit so that load a common testing-setup.bro scripts that can set a global configuration.
This commit is contained in:
parent
4bc18bd3f2
commit
9ee8a9f806
4 changed files with 19 additions and 4 deletions
|
@ -69,6 +69,11 @@ export {
|
|||
## The on-disk prefix for files to be extracted from MIME entity bodies.
|
||||
const extraction_prefix = "smtp-entity" &redef;
|
||||
|
||||
## If set, never generate MD5s. This is mainly for testing purposes to create
|
||||
## reproducable output in the case that the decision whether to create
|
||||
## checksums depends on environment specifics.
|
||||
const never_calc_md5 = F &redef;
|
||||
|
||||
global log_mime: event(rec: EntityInfo);
|
||||
}
|
||||
|
||||
|
@ -121,7 +126,7 @@ event mime_segment_data(c: connection, length: count, data: string) &priority=-5
|
|||
|
||||
if ( c$smtp$current_entity$content_len == 0 )
|
||||
{
|
||||
if ( generate_md5 in c$smtp$current_entity$mime_type )
|
||||
if ( generate_md5 in c$smtp$current_entity$mime_type && ! never_calc_md5 )
|
||||
c$smtp$current_entity$calc_md5 = T;
|
||||
|
||||
if ( c$smtp$current_entity$calc_md5 )
|
||||
|
|
8
testing/external/scripts/skel/test.skeleton
vendored
8
testing/external/scripts/skel/test.skeleton
vendored
|
@ -1,2 +1,6 @@
|
|||
@TEST-EXEC: zcat $TRACES/test.trace.gz | bro -r - test-all-policy
|
||||
@TEST-EXEC: $SCRIPTS/diff-all *.log
|
||||
# @TEST-EXEC: zcat $TRACES/trace.gz | bro -r - %INPUT
|
||||
# @TEST-EXEC: $SCRIPTS/diff-all *.log
|
||||
|
||||
@load testing-setup
|
||||
@load test-all-policy
|
||||
|
||||
|
|
6
testing/external/scripts/testing-setup.bro
vendored
Normal file
6
testing/external/scripts/testing-setup.bro
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Sets some testing specific options.
|
||||
|
||||
@ifdef ( SMTP::never_calc_md5 )
|
||||
# MDD5s can depend on libmagic output.
|
||||
redef SMTP::never_calc_md5 = T;
|
||||
@endif
|
2
testing/external/subdir-btest.cfg
vendored
2
testing/external/subdir-btest.cfg
vendored
|
@ -6,7 +6,7 @@ IgnoreDirs = .svn CVS .tmp
|
|||
IgnoreFiles = *.tmp *.swp #* *.trace .gitignore *.skeleton
|
||||
|
||||
[environment]
|
||||
BROPATH=`bash -c %(testbase)s/../../../build/bro-path-dev`
|
||||
BROPATH=`bash -c %(testbase)s/../../../build/bro-path-dev`:%(testbase)s/../scripts
|
||||
BRO_SEED_FILE=%(testbase)s/../random.seed
|
||||
TZ=UTC
|
||||
LC_ALL=C
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue