From bff88ccd5cd0e4c3204a0ed2dfec2209b2443335 Mon Sep 17 00:00:00 2001 From: Daniel Thayer Date: Wed, 9 Jul 2014 15:36:47 -0500 Subject: [PATCH 1/8] Remove gawk from list of optional packages in documentation --- doc/install/install.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/install/install.rst b/doc/install/install.rst index 4450e842e3..9a258773ce 100644 --- a/doc/install/install.rst +++ b/doc/install/install.rst @@ -91,7 +91,6 @@ build time: * LibGeoIP (for geolocating IP addresses) * sendmail (enables Bro and BroControl to send mail) - * gawk (enables all features of bro-cut) * curl (used by a Bro script that implements active HTTP) * gperftools (tcmalloc is used to improve memory and CPU usage) * ipsumdump (for trace-summary; http://www.cs.ucla.edu/~kohler/ipsumdump) From 10f202b627892f74f7ad1b20390ce95e8adef459 Mon Sep 17 00:00:00 2001 From: Daniel Thayer Date: Wed, 9 Jul 2014 23:50:59 -0500 Subject: [PATCH 2/8] Update PATH so that documentation btests can find bro-cut --- doc/conf.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py.in b/doc/conf.py.in index 9720d12ade..4faebed3b8 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -21,7 +21,7 @@ sys.path.insert(0, os.path.abspath('sphinx_input/ext')) # ----- Begin of BTest configuration. ----- btest = os.path.abspath("@CMAKE_SOURCE_DIR@/aux/btest") -brocut = os.path.abspath("@CMAKE_SOURCE_DIR@/aux/bro-aux/bro-cut") +brocut = os.path.abspath("@CMAKE_SOURCE_DIR@/build/aux/bro-aux/bro-cut") bro = os.path.abspath("@CMAKE_SOURCE_DIR@/build/src") os.environ["PATH"] += (":%s:%s/sphinx:%s:%s" % (btest, btest, bro, brocut)) From fe60d5e9dd45e8bedb1b5b0959873daec031cd69 Mon Sep 17 00:00:00 2001 From: Johanna Amann Date: Fri, 1 Aug 2014 11:06:19 -0700 Subject: [PATCH 3/8] Split dhcp log writing from record creation. This allows users to customize dhcp.log by changing the record in their own dhcp_ack event. --- scripts/base/protocols/dhcp/main.bro | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/base/protocols/dhcp/main.bro b/scripts/base/protocols/dhcp/main.bro index c94bae0476..d6bb0defd2 100644 --- a/scripts/base/protocols/dhcp/main.bro +++ b/scripts/base/protocols/dhcp/main.bro @@ -47,13 +47,13 @@ redef record connection += { const ports = { 67/udp, 68/udp }; redef likely_server_ports += { 67/udp }; -event bro_init() +event bro_init() &priority=5 { Log::create_stream(DHCP::LOG, [$columns=Info, $ev=log_dhcp]); Analyzer::register_for_ports(Analyzer::ANALYZER_DHCP, ports); } -event dhcp_ack(c: connection, msg: dhcp_msg, mask: addr, router: dhcp_router_list, lease: interval, serv_addr: addr, host_name: string) +event dhcp_ack(c: connection, msg: dhcp_msg, mask: addr, router: dhcp_router_list, lease: interval, serv_addr: addr, host_name: string) &priority=5 { local info: Info; info$ts = network_time(); @@ -71,6 +71,9 @@ event dhcp_ack(c: connection, msg: dhcp_msg, mask: addr, router: dhcp_router_lis info$assigned_ip = c$id$orig_h; c$dhcp = info; + } +event dhcp_ack(c: connection, msg: dhcp_msg, mask: addr, router: dhcp_router_list, lease: interval, serv_addr: addr, host_name: string) &priority=-5 + { Log::write(DHCP::LOG, c$dhcp); } From 605a49f9bd35e868ddd13d6fea7a28754e25fead Mon Sep 17 00:00:00 2001 From: Johanna Amann Date: Fri, 1 Aug 2014 11:19:05 -0700 Subject: [PATCH 4/8] small change to documentation. In server->client messages the host name may differ from the one requested by the client. --- src/analyzer/protocol/dhcp/events.bif | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/analyzer/protocol/dhcp/events.bif b/src/analyzer/protocol/dhcp/events.bif index 1f1e84ef0c..c7b35c8bd7 100644 --- a/src/analyzer/protocol/dhcp/events.bif +++ b/src/analyzer/protocol/dhcp/events.bif @@ -33,7 +33,7 @@ event dhcp_discover%(c: connection, msg: dhcp_msg, req_addr: addr, host_name: st ## ## serv_addr: The server address specified by the message. ## -## host_name: The value of the host name option, if specified by the client. +## host_name: Optional host-name value. May differ from the host name requested from the client. ## ## .. bro:see:: dhcp_discover dhcp_request dhcp_decline dhcp_ack dhcp_nak ## dhcp_release dhcp_inform @@ -75,7 +75,7 @@ event dhcp_request%(c: connection, msg: dhcp_msg, req_addr: addr, serv_addr: add ## ## msg: The parsed type-independent part of the DHCP message. ## -## host_name: The value of the host name option, if specified by the client. +## host_name: Optional host name value. ## ## .. bro:see:: dhcp_discover dhcp_offer dhcp_request dhcp_ack dhcp_nak ## dhcp_release dhcp_inform @@ -101,7 +101,7 @@ event dhcp_decline%(c: connection, msg: dhcp_msg, host_name: string%); ## ## serv_addr: The server address specified by the message. ## -## host_name: The value of the host name option, if specified by the client. +## host_name: Optional host-name value. May differ from the host name requested from the client. ## ## .. bro:see:: dhcp_discover dhcp_offer dhcp_request dhcp_decline dhcp_nak ## dhcp_release dhcp_inform @@ -116,7 +116,7 @@ event dhcp_ack%(c: connection, msg: dhcp_msg, mask: addr, router: dhcp_router_li ## ## msg: The parsed type-independent part of the DHCP message. ## -## host_name: The value of the host name option, if specified by the client. +## host_name: Optional host name value. ## ## .. bro:see:: dhcp_discover dhcp_offer dhcp_request dhcp_decline dhcp_ack dhcp_release ## dhcp_inform From 2ed79639fe796bf228cca9d18e3786583f7f0c47 Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Fri, 1 Aug 2014 14:06:13 -0700 Subject: [PATCH 5/8] Updating submodule(s). [nomail] --- aux/binpac | 2 +- aux/bro-aux | 2 +- aux/broccoli | 2 +- aux/broctl | 2 +- cmake | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aux/binpac b/aux/binpac index 231a593eb8..ec1e052afd 160000 --- a/aux/binpac +++ b/aux/binpac @@ -1 +1 @@ -Subproject commit 231a593eb851713cc8da1ece3ce90d9317fb46b7 +Subproject commit ec1e052afd5a8cd3d1d2cbb28fcd688018e379a5 diff --git a/aux/bro-aux b/aux/bro-aux index 33719f8fb2..046d8fbe1f 160000 --- a/aux/bro-aux +++ b/aux/bro-aux @@ -1 +1 @@ -Subproject commit 33719f8fb2b6bfb9324923ae1b17ce219e4c8b51 +Subproject commit 046d8fbe1f458db34c4767aa92d759714d61209d diff --git a/aux/broccoli b/aux/broccoli index 1f1f235163..1ee129f715 160000 --- a/aux/broccoli +++ b/aux/broccoli @@ -1 +1 @@ -Subproject commit 1f1f2351635bf3f437f35ceb6ba898ccff28dfea +Subproject commit 1ee129f7159a2c32fe0cb0f44c9412486fb7a479 diff --git a/aux/broctl b/aux/broctl index 2ebe2e3c92..8a13886f32 160000 --- a/aux/broctl +++ b/aux/broctl @@ -1 +1 @@ -Subproject commit 2ebe2e3c9298fd21b06ff93dab8c6980edef144b +Subproject commit 8a13886f322f3b618832c0ca3976e07f686d14da diff --git a/cmake b/cmake index fb67896d2c..0f301aa08a 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit fb67896d2c3fe61c6479e78c3e9b12de8637be87 +Subproject commit 0f301aa08a970150195a2ea5b3ed43d2d98b35b3 From 8d936e593f27992f8a80827ed8b7e93df86663bd Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Fri, 1 Aug 2014 14:15:30 -0700 Subject: [PATCH 6/8] Updating submodule(s). [nomail] --- CHANGES | 18 ++++++++++++++++++ VERSION | 2 +- aux/binpac | 2 +- aux/bro-aux | 2 +- aux/broccoli | 2 +- aux/broctl | 2 +- cmake | 2 +- 7 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index a662995f2d..e09355fa13 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,22 @@ +2.3-95 | 2014-08-01 14:15:30 -0700 + + * Small change to DHCP documentation. In server->client messages the + host name may differ from the one requested by the client. + (Johanna Amann) + + * Split DHCP log writing from record creation. This allows users to + customize dhcp.log by changing the record in their own dhcp_ack + event. (Johanna Amann) + + * Update PATH so that documentation btests can find bro-cut. (Daniel + Thayer) + + * Remove gawk from list of optional packages in documentation. + (Daniel Thayer) + + * Fix for redefining built-in constants. (Robin Sommer) + 2.3-86 | 2014-07-31 14:19:58 -0700 * Fix for redefining built-in constants. (Robin Sommer) diff --git a/VERSION b/VERSION index 7551c78f13..c81efdf65b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3-86 +2.3-95 diff --git a/aux/binpac b/aux/binpac index ec1e052afd..30c156d879 160000 --- a/aux/binpac +++ b/aux/binpac @@ -1 +1 @@ -Subproject commit ec1e052afd5a8cd3d1d2cbb28fcd688018e379a5 +Subproject commit 30c156d879f6303f15ebf8e59989d8a42d882bdf diff --git a/aux/bro-aux b/aux/bro-aux index 046d8fbe1f..bdb83e43ce 160000 --- a/aux/bro-aux +++ b/aux/bro-aux @@ -1 +1 @@ -Subproject commit 046d8fbe1f458db34c4767aa92d759714d61209d +Subproject commit bdb83e43ce29250b32033e96c3054c486cbee1ef diff --git a/aux/broccoli b/aux/broccoli index 1ee129f715..07cfcc76fb 160000 --- a/aux/broccoli +++ b/aux/broccoli @@ -1 +1 @@ -Subproject commit 1ee129f7159a2c32fe0cb0f44c9412486fb7a479 +Subproject commit 07cfcc76fb08365b545bd3f412c3f6e6c92824e9 diff --git a/aux/broctl b/aux/broctl index 8a13886f32..2606a95c9d 160000 --- a/aux/broctl +++ b/aux/broctl @@ -1 +1 @@ -Subproject commit 8a13886f322f3b618832c0ca3976e07f686d14da +Subproject commit 2606a95c9dcbc83bd863c2981ce7189e5d58697b diff --git a/cmake b/cmake index 0f301aa08a..f2e8ba6b90 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 0f301aa08a970150195a2ea5b3ed43d2d98b35b3 +Subproject commit f2e8ba6b90b3a2da9f1f77c55d0e718c25376bbb From ccfd081437adf7ab75089c4e3b2d33eafed08def Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Fri, 1 Aug 2014 14:35:01 -0700 Subject: [PATCH 7/8] Fixing PATH to bro-cut in BTest configuration. --- CHANGES | 2 +- VERSION | 2 +- testing/btest/btest.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index e09355fa13..e4588559c8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,5 @@ -2.3-95 | 2014-08-01 14:15:30 -0700 +2.3-96 | 2014-08-01 14:35:01 -0700 * Small change to DHCP documentation. In server->client messages the host name may differ from the one requested by the client. diff --git a/VERSION b/VERSION index c81efdf65b..e247bc816b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3-95 +2.3-96 diff --git a/testing/btest/btest.cfg b/testing/btest/btest.cfg index deb33b7767..430f4ba47c 100644 --- a/testing/btest/btest.cfg +++ b/testing/btest/btest.cfg @@ -13,7 +13,7 @@ BRO_PLUGIN_PATH= TZ=UTC LC_ALL=C BTEST_PATH=%(testbase)s/../../aux/btest -PATH=%(testbase)s/../../build/src:%(testbase)s/../scripts:%(testbase)s/../../aux/btest:%(testbase)s/../../aux/bro-aux/bro-cut:%(default_path)s:%(testbase)s/../../aux/btest/sphinx:%(default_path)s +PATH=%(testbase)s/../../build/src:%(testbase)s/../scripts:%(testbase)s/../../aux/btest:%(testbase)s/../../build/aux/bro-aux/bro-cut:%(default_path)s:%(testbase)s/../../aux/btest/sphinx:%(default_path)s TRACES=%(testbase)s/Traces FILES=%(testbase)s/Files SCRIPTS=%(testbase)s/../scripts From f8bb17bcb8fad4ba46d68fc24416f3c8aa8233f6 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Mon, 4 Aug 2014 10:53:36 -0500 Subject: [PATCH 8/8] Fix possible null ptr derefs reported by Coverity. --- src/plugin/Manager.cc | 103 ++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 48 deletions(-) diff --git a/src/plugin/Manager.cc b/src/plugin/Manager.cc index 4d81506817..ab0b85676b 100644 --- a/src/plugin/Manager.cc +++ b/src/plugin/Manager.cc @@ -542,15 +542,16 @@ int Manager::HookLoadFile(const string& file) int rc = -1; - for ( hook_list::iterator i = l->begin(); l && i != l->end(); i++ ) - { - Plugin* p = (*i).second; + if ( l ) + for ( hook_list::iterator i = l->begin(); i != l->end(); ++i ) + { + Plugin* p = (*i).second; - rc = p->HookLoadFile(normalized_file, ext); + rc = p->HookLoadFile(normalized_file, ext); - if ( rc >= 0 ) - break; - } + if ( rc >= 0 ) + break; + } if ( HavePluginForHook(META_HOOK_POST) ) MetaHookPost(HOOK_LOAD_FILE, args, HookArgument(rc)); @@ -573,15 +574,16 @@ Val* Manager::HookCallFunction(const Func* func, val_list* vargs) const Val* v = 0; - for ( hook_list::iterator i = l->begin(); l && i != l->end(); i++ ) - { - Plugin* p = (*i).second; + if ( l ) + for ( hook_list::iterator i = l->begin(); i != l->end(); ++i ) + { + Plugin* p = (*i).second; - v = p->HookCallFunction(func, vargs); + v = p->HookCallFunction(func, vargs); - if ( v ) - break; - } + if ( v ) + break; + } if ( HavePluginForHook(META_HOOK_POST) ) MetaHookPost(HOOK_CALL_FUNCTION, args, HookArgument(v)); @@ -603,16 +605,17 @@ bool Manager::HookQueueEvent(Event* event) const bool result = false; - for ( hook_list::iterator i = l->begin(); l && i != l->end(); i++ ) - { - Plugin* p = (*i).second; - - if ( p->HookQueueEvent(event) ) + if ( l ) + for ( hook_list::iterator i = l->begin(); i != l->end(); ++i ) { - result = true; - break; + Plugin* p = (*i).second; + + if ( p->HookQueueEvent(event) ) + { + result = true; + break; + } } - } if ( HavePluginForHook(META_HOOK_POST) ) MetaHookPost(HOOK_QUEUE_EVENT, args, HookArgument(result)); @@ -629,11 +632,12 @@ void Manager::HookDrainEvents() const hook_list* l = hooks[HOOK_DRAIN_EVENTS]; - for ( hook_list::iterator i = l->begin(); l && i != l->end(); i++ ) - { - Plugin* p = (*i).second; - p->HookDrainEvents(); - } + if ( l ) + for ( hook_list::iterator i = l->begin(); i != l->end(); ++i ) + { + Plugin* p = (*i).second; + p->HookDrainEvents(); + } if ( HavePluginForHook(META_HOOK_POST) ) MetaHookPost(HOOK_DRAIN_EVENTS, args, HookArgument()); @@ -652,11 +656,12 @@ void Manager::HookUpdateNetworkTime(double network_time) const hook_list* l = hooks[HOOK_UPDATE_NETWORK_TIME]; - for ( hook_list::iterator i = l->begin(); l && i != l->end(); i++ ) - { - Plugin* p = (*i).second; - p->HookUpdateNetworkTime(network_time); - } + if ( l ) + for ( hook_list::iterator i = l->begin(); i != l->end(); ++i ) + { + Plugin* p = (*i).second; + p->HookUpdateNetworkTime(network_time); + } if ( HavePluginForHook(META_HOOK_POST) ) MetaHookPost(HOOK_UPDATE_NETWORK_TIME, args, HookArgument()); @@ -674,35 +679,37 @@ void Manager::HookBroObjDtor(void* obj) const hook_list* l = hooks[HOOK_BRO_OBJ_DTOR]; - for ( hook_list::iterator i = l->begin(); l && i != l->end(); i++ ) - { - Plugin* p = (*i).second; - p->HookBroObjDtor(obj); - } + if ( l ) + for ( hook_list::iterator i = l->begin(); i != l->end(); ++i ) + { + Plugin* p = (*i).second; + p->HookBroObjDtor(obj); + } if ( HavePluginForHook(META_HOOK_POST) ) MetaHookPost(HOOK_BRO_OBJ_DTOR, args, HookArgument()); - } void Manager::MetaHookPre(HookType hook, const HookArgumentList& args) const { hook_list* l = hooks[HOOK_CALL_FUNCTION]; - for ( hook_list::iterator i = l->begin(); l && i != l->end(); i++ ) - { - Plugin* p = (*i).second; - p->MetaHookPre(hook, args); - } + if ( l ) + for ( hook_list::iterator i = l->begin(); i != l->end(); ++i ) + { + Plugin* p = (*i).second; + p->MetaHookPre(hook, args); + } } void Manager::MetaHookPost(HookType hook, const HookArgumentList& args, HookArgument result) const { hook_list* l = hooks[HOOK_CALL_FUNCTION]; - for ( hook_list::iterator i = l->begin(); l && i != l->end(); i++ ) - { - Plugin* p = (*i).second; - p->MetaHookPost(hook, args, result); - } + if ( l ) + for ( hook_list::iterator i = l->begin(); i != l->end(); ++i ) + { + Plugin* p = (*i).second; + p->MetaHookPost(hook, args, result); + } }