Merge remote-tracking branch 'origin/topic/dnthayer/ticket1595'

* origin/topic/dnthayer/ticket1595:
  Fix a bug in receiving remote logs via broker

BIT-1595 #merged
This commit is contained in:
Johanna Amann 2016-05-12 08:04:33 -07:00
commit 49ca47895d
6 changed files with 23 additions and 12 deletions

View file

@ -1,4 +1,12 @@
2.4-552 | 2016-05-12 08:04:33 -0700
* Fix a bug in receiving remote logs via broker. (Daniel Thayer)
* Fix Bro and unit tests when broker is not enabled. (Daniel Thayer)
* Added interpreter error for local event variables. (Jan Grashoefer)
2.4-544 | 2016-05-07 12:19:07 -0700
* Switching all use of gmtime and localtime to use reentrant

View file

@ -1 +1 @@
2.4-544
2.4-552

@ -1 +1 @@
Subproject commit 17e32544540156832a8e547e9d17538f2e8a67ec
Subproject commit ebab672fa404b26944a6df6fbfb1aaab95ec5d48

View file

@ -318,25 +318,27 @@ struct val_converter {
auto rt = type->AsRecordType();
auto rval = new RecordVal(rt);
auto idx = 0u;
for ( auto i = 0u; i < static_cast<size_t>(rt->NumFields()); ++i )
{
if ( require_log_attr && ! rt->FieldDecl(i)->FindAttr(ATTR_LOG) )
continue;
if ( i >= a.fields.size() )
if ( idx >= a.fields.size() )
{
Unref(rval);
return nullptr;
}
if ( ! a.fields[i] )
if ( ! a.fields[idx] )
{
rval->Assign(i, nullptr);
++idx;
continue;
}
auto item_val = bro_broker::data_to_val(move(*a.fields[i]),
auto item_val = bro_broker::data_to_val(move(*a.fields[idx]),
rt->FieldType(i));
if ( ! item_val )
@ -346,6 +348,7 @@ struct val_converter {
}
rval->Assign(i, item_val);
++idx;
}
return rval;

View file

@ -1,6 +1,6 @@
wrote log, [msg=ping, num=0, nolog=no]
wrote log, [msg=ping, num=1, nolog=no]
wrote log, [msg=ping, num=2, nolog=no]
wrote log, [msg=ping, num=3, nolog=no]
wrote log, [msg=ping, num=4, nolog=no]
wrote log, [msg=ping, num=5, nolog=no]
wrote log, [msg=ping, nolog=no, num=0]
wrote log, [msg=ping, nolog=no, num=1]
wrote log, [msg=ping, nolog=no, num=2]
wrote log, [msg=ping, nolog=no, num=3]
wrote log, [msg=ping, nolog=no, num=4]
wrote log, [msg=ping, nolog=no, num=5]

View file

@ -19,8 +19,8 @@ export {
type Info: record {
msg: string &log;
num: count &log;
nolog: string &default="no";
num: count &log;
};
global log_test: event(rec: Test::Info);