Return a warning and fail if creating a store at global scope

This commit is contained in:
Tim Wojtulewicz 2024-12-16 13:40:47 -07:00
parent 33eaa5ccda
commit 6b5d0491aa
3 changed files with 16 additions and 0 deletions

View file

@ -1582,6 +1582,13 @@ void Manager::ProcessStoreResponse(detail::StoreHandleVal* s, broker::store::res
}
detail::StoreHandleVal* Manager::MakeMaster(const string& name, broker::backend type, broker::backend_options opts) {
if ( ! bstate ) {
if ( zeek::detail::current_scope() == zeek::detail::global_scope() )
reporter->Error("Broker stores cannot be created at the global scope");
return nullptr;
}
if ( bstate->endpoint.is_shutdown() )
return nullptr;