mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Allow access to global variables using GLOBAL:: namespace.
Addresses BIT-1758. Patch was contributed by François Pennaneach <francois.pennaneach@free.fr>.
This commit is contained in:
parent
ad345d7277
commit
8eddeed78f
3 changed files with 7 additions and 0 deletions
|
@ -52,7 +52,12 @@ string make_full_var_name(const char* module_name, const char* var_name)
|
|||
{
|
||||
if ( ! module_name || streq(module_name, GLOBAL_MODULE_NAME) ||
|
||||
strstr(var_name, "::") )
|
||||
{
|
||||
if ( streq(GLOBAL_MODULE_NAME, extract_module_name(var_name).c_str()) )
|
||||
return extract_var_name(var_name);
|
||||
|
||||
return string(var_name);
|
||||
}
|
||||
|
||||
string full_name = normalized_module_name(module_name);
|
||||
full_name += "::";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
function (PASS)
|
||||
global variable (PASS)
|
||||
fully qualified global variable (PASS)
|
||||
const (PASS)
|
||||
event (PASS)
|
||||
|
|
|
@ -27,6 +27,7 @@ event bro_init()
|
|||
{
|
||||
test_case( "function", T );
|
||||
test_case( "global variable", num == 123 );
|
||||
test_case( "fully qualified global variable", GLOBAL::num == 123 ); # test for BIT-1758 : GLOBAL scope ID discovery bug
|
||||
test_case( "const", daysperyear == 365 );
|
||||
event testevent( "foo" );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue