mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Attr: Duplicated &is_used is allowed
When using the same function for eval conditions in signatures, we previously attempted to add &is_used multiple times to the function triggering an ambiguous attribute error. Turns out there's already a list of attributes that are accepted to be used multiple times, so just add ATTR_IS_USED there. Fixes #2628
This commit is contained in:
parent
dbbb6cd6f0
commit
ef920ef3f5
4 changed files with 43 additions and 1 deletions
|
@ -224,7 +224,7 @@ void Attributes::AddAttr(AttrPtr attr, bool is_redef)
|
||||||
|
|
||||||
return new_tag == ATTR_LOG || new_tag == ATTR_OPTIONAL || new_tag == ATTR_REDEF ||
|
return new_tag == ATTR_LOG || new_tag == ATTR_OPTIONAL || new_tag == ATTR_REDEF ||
|
||||||
new_tag == ATTR_BROKER_STORE_ALLOW_COMPLEX || new_tag == ATTR_RAW_OUTPUT ||
|
new_tag == ATTR_BROKER_STORE_ALLOW_COMPLEX || new_tag == ATTR_RAW_OUTPUT ||
|
||||||
new_tag == ATTR_ERROR_HANDLER;
|
new_tag == ATTR_ERROR_HANDLER || new_tag == ATTR_IS_USED;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A `redef` is allowed to overwrite an existing attribute instead of
|
// A `redef` is allowed to overwrite an existing attribute instead of
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
|
@ -0,0 +1,5 @@
|
||||||
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
|
signature_cond, GET /download/CHANGES.bro-aux.tx
|
||||||
|
signature_match, GET, GET /download/CHANGES.bro-aux.tx
|
||||||
|
signature_cond, HTTP/1.1 200 OK\x0d\x0aDate: Thu, 07 M
|
||||||
|
signature_match, STATUS, HTTP/1.1 200 OK\x0d\x0aDate: Thu, 07 M
|
36
testing/btest/signatures/signature-cond-used-twice.zeek
Normal file
36
testing/btest/signatures/signature-cond-used-twice.zeek
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# @TEST-DOC: The function signature_cond is used in two eval's in test.sig should not fail...
|
||||||
|
# @TEST-EXEC: unset ZEEK_ALLOW_INIT_ERRORS; zeek -b %INPUT -r $TRACES/http/get.trace
|
||||||
|
# @TEST-EXEC: btest-diff .stderr
|
||||||
|
# @TEST-EXEC: btest-diff .stdout
|
||||||
|
module SignatureEvalTest;
|
||||||
|
|
||||||
|
@load-sigs ./test.sig
|
||||||
|
|
||||||
|
event signature_match(state: signature_state, msg: string, data: string)
|
||||||
|
{
|
||||||
|
print "signature_match", msg, data[:32];
|
||||||
|
}
|
||||||
|
|
||||||
|
function signature_cond(state: signature_state, data: string): bool
|
||||||
|
{
|
||||||
|
print "signature_cond", data[:32];
|
||||||
|
return T;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@TEST-START-FILE test.sig
|
||||||
|
signature my-first-sig {
|
||||||
|
ip-proto == tcp
|
||||||
|
dst-port == 80
|
||||||
|
payload /GET/
|
||||||
|
event "GET"
|
||||||
|
eval SignatureEvalTest::signature_cond
|
||||||
|
}
|
||||||
|
|
||||||
|
signature my-second-sig {
|
||||||
|
ip-proto == tcp
|
||||||
|
payload /HTTP\/1\.1 [0-9]+/
|
||||||
|
event "STATUS"
|
||||||
|
eval SignatureEvalTest::signature_cond
|
||||||
|
}
|
||||||
|
@TEST-END-FILE
|
Loading…
Add table
Add a link
Reference in a new issue