Commit graph

6667 commits

Author SHA1 Message Date
Jon Siwek
dbbbea312c Fix DNS_Mgr iterator mismatch.
But not really since the global dns_mgr should be equal to "this" while
in all the member funcs.  Still, better that they always refer to their
own instance instead of the global one.
2013-09-20 11:37:19 -05:00
Jon Siwek
e5a4123b4e Kill raw input reader's child by process group.
This should help on systems where the default shell (e.g. dash on
Ubuntu) fork-execs in order to run commands.  In that case, we were
just killing the shell and the shell would exit without killing
the actual process corresponding to command that was requested.
Setting a process group for the shell exec'd from Bro and killing
by process group should help clean everything up since process group
will be inherited by any procs that shell fork-execs.
2013-09-20 09:38:52 -05:00
Bernhard Amann
df552ca87d parse out extension. One event for general extensions (just returns the
openssl-parsed string-value), one event for basicconstraints (is a certificate
a CA or not) and one event for subject-alternative-names (only DNS parts).
2013-09-19 14:41:34 -07:00
Jon Siwek
1ed210a572 Set safe umask when creating script profiler tmp files. 2013-09-19 13:57:51 -05:00
Jon Siwek
b6350d518a Merge branch 'master' into topic/jsiwek/coverity 2013-09-19 12:58:22 -05:00
Jon Siwek
79bd81c8da Fix nesting/indent level whitespace mismatch.
The EndData() doesn't make sense as part of the condition that implies
the state is such that it's not inside data.  It might make sense as
part of an else block, but it also seems fine to unconditionally
EndData() like it currently does.  That way unexpected states (mail !=
0) are dealt with sooner rather than later.
2013-09-19 11:39:52 -05:00
Robin Sommer
3738b4136b Merge remote-tracking branch 'origin/topic/bernhard/ticket950'
* origin/topic/bernhard/ticket950:
  make client and server random available on script-level.

BIT-950 #merged
2013-09-18 15:02:55 -07:00
Robin Sommer
c6de23ebe1 Merge remote-tracking branch 'origin/topic/bernhard/ticket1072'
* origin/topic/bernhard/ticket1072:
  and const 2 more functions
  update hll documentation, make a few functions private and create a new copy constructor.
  fix case where hll_error_margin could be undefined (thanks John)

BIT-1072 #merged
2013-09-18 15:00:06 -07:00
Jon Siwek
a316878d01 Add checks to avoid improper negative values use. 2013-09-17 16:42:48 -05:00
Daniel Thayer
0d68aad9b1 Merge remote-tracking branch 'origin/master' into topic/dnthayer/compilerwarn 2013-09-17 16:17:41 -05:00
Daniel Thayer
fdc0d5c7ec Fix compiler warning (time_t is not a pointer type) 2013-09-17 15:29:41 -05:00
Jon Siwek
a3b963ad4e Refactor Analyzer::AddChildAnalyzer and usages.
Make feedback available regarding whether adding a child analyzer fails
because one of the same type already exists (so one can avoid invalid
pointer access of a delete'd analyzer).
2013-09-16 16:20:55 -05:00
Jon Siwek
bb8f102b2c Minor refactor to SSL BinPAC grammer.
An unsized array already parses indefinitely.  &until($element <= 0)
just causes nonsense code to be generated.  I.e. checking a pointer that
can never even be null against <= 0.  And the compare would happen after
delete'ing the pointer, making it even odder (though still benign).
2013-09-16 16:10:49 -05:00
Bernhard Amann
e5a589dbfe Very basic file-analyzer for x509 certificates. Mostly ripped from
the ssl-analyzer and the topic/bernhard/x509 branch.

Simply prints information about the encountered certificates (I have
not yet my mind up, what I will log...).

Next step: extensions...
2013-09-16 14:08:22 -07:00
Jon Siwek
19b15217f0 Minor refactor to broxygen enum comments.
Coverity claimed a mismatched iterator here.  Don't think it was, but
this might make it either go away or make its insane template output
understandable.  Else at least it makes the code more readable.
2013-09-16 15:40:44 -05:00
Jon Siwek
c8758c4f24 Fix possible (unlikely) use of uninitialized value.
Plus two minor refactors/nits.
2013-09-16 15:36:18 -05:00
Bernhard Amann
ecc20b932a and const 2 more functions 2013-09-16 11:00:54 -07:00
Bernhard Amann
c0f780c728 update hll documentation, make a few functions private and create
a new copy constructor.
2013-09-16 10:40:25 -07:00
Daniel Thayer
1580fb5d61 Merge remote-tracking branch 'origin/master' into topic/dnthayer/compilerwarn 2013-09-16 11:21:00 -05:00
Daniel Thayer
20f11ad237 Fix another compiler warning 2013-09-16 11:20:07 -05:00
Jon Siwek
735d2c402a Fix/improve dereference-before-null-checks. 2013-09-13 16:41:41 -05:00
Jon Siwek
3d81432a1e Fix out-of-bounds memory accesses.
And remove a variable-length-array usage.
2013-09-13 15:05:17 -05:00
Jon Siwek
5a992879a0 Fix potential mem leak. 2013-09-13 14:31:03 -05:00
Jon Siwek
a99e873d5c Fix double-free and deallocator mismatch. 2013-09-13 14:30:22 -05:00
Jon Siwek
33a7e96268 Fix another function val reference counting bug.
Now that functions get unref'd in the val dtor in order to free mem of
unserialized functions, it's important to ref a function when creating a
val from a pre-existing function so it's not prematurely free'd.
2013-09-13 12:51:24 -05:00
Daniel Thayer
1d33883dfc Fix compiler warnings 2013-09-13 00:30:18 -05:00
Jon Siwek
0b97343ff7 Fix various potential memory leaks.
Though I expect most not to be exercised in practice.
2013-09-12 15:23:52 -05:00
Bernhard Amann
c40a97156a make client and server random available on script-level.
Patch by ewust

Addresses BIT-950
2013-09-11 12:39:23 -07:00
Jon Siwek
c3a4454892 Fix significant memory leak.
Particularly, unserializing a function is frequent and leaked.
2013-09-10 16:10:10 -05:00
Jon Siwek
1fbeefedbc Fix two use-after-free bugs. 2013-09-10 13:30:23 -05:00
Daniel Thayer
ee1312f2ad Fix an error seen when building documentation 2013-09-10 11:22:14 -05:00
Jon Siwek
0b5a75a463 Fix mem leak in failing table initialization case.
Specifically that case looked like tables that have a compound index
and an element assignment fails due to a type mismatch.
2013-09-05 16:09:52 -05:00
Jon Siwek
f823b92e5e Fix mem leak when merging incompatible types.
Though this would typically be caused by a scripting error that should
be fixed and Bro would exit anyway if encountered at parse time.
2013-09-05 15:47:57 -05:00
Jon Siwek
75d469532c Fix mem leak when unserializing table entry fails.
Shouldn't happen in practice.
2013-09-05 15:40:10 -05:00
Jon Siwek
766cc0d220 Fix mem leak when failing to end a serialization.
We'd probably know about it if that actually ever happened in practice
(which it shouldn't).
2013-09-05 15:30:28 -05:00
Jon Siwek
703ef3b908 Fix mem leak when unserializing an arg in a function call fails.
Shouldn't be a typical scenario since hopefully we'd know about
and fix the underlying problem w/ unserialization...
2013-09-05 15:09:05 -05:00
Jon Siwek
4e8ba6eaa2 Fix signatures that use identifiers of type table. 2013-09-05 13:01:40 -05:00
Jon Siwek
eef432561e Fix memory leak if a DNS request fails to be made.
A symptom of this is a "can't issue DNS request" warning in
reporter.log. (Doesn't look like this should be a typical thing
that happens in most environments).
2013-09-05 11:52:40 -05:00
Jon Siwek
62de5678f7 Fix memory leak in DNS TXT lookups. 2013-09-04 16:47:44 -05:00
Jon Siwek
6ad82ff263 Fix invalid/mismatched deallocators. 2013-09-04 14:45:09 -05:00
Jon Siwek
f9dc48e573 Fix logging filter over-allocation and leak.
The leak could happen in a couple cases where adding a log filter
fails: OOM and unsupported field type.
2013-09-04 14:25:57 -05:00
Jon Siwek
0678468353 Internal UID simplifications/nits. 2013-09-04 11:46:53 -05:00
Jon Siwek
ca9b9162a7 Fix raw execution input reader's signal blocking.
Signals are generally blocked within threads in Bro so that the main
thread does all signal handling, however, signal masks are inherited
over fork() and exec(), so they should be unblocked before exec() so
that process can respond to signals normally.

This fixes the raw reader from leaving behind processes that didn't
respond to SIGTERM at shutdown because it was blocked before exec().
2013-09-04 10:45:29 -05:00
Jon Siwek
db470a637a Documentation fixes.
This cleans up most of the warnings from sphinx (broken :doc: links,
broxygen role misuses, etc.).  The remaining ones should be harmless,
but not quick to silence.

I found that the README for each component was a copy from the actual
repo, so I turned those in to symlinks so they don't get out of date.
2013-09-03 15:59:40 -05:00
Robin Sommer
de5bb65ff7 Removing the "uint8*" methods from SerializationFormat.
They conflict with the "char" version, so that other classes would now
pick the wrong one. Added a bit of casting to HLL to use the "char"
versions instead.
2013-08-31 11:17:49 -07:00
Robin Sommer
6f9d28cc18 Merge branch 'topic/robin/hyperloglog-merge'
* topic/robin/hyperloglog-merge: (35 commits)
  Making the confidence configurable.
  Renaming HyperLogLog->CardinalityCounter.
  Fixing bug introduced during merging.
  add clustered leak test for hll. No issues.
  make gcc happy
  (hopefully) fix refcounting problem in hll/bloom-filter opaque vals. Thanks Robin.
  re-use same hash class for all add operations
  get hll ready for merging
  and forgot a file...
  adapt to new structure
  fix opaqueval-related memleak.
  make it compile on case-sensitive file systems and fix warnings
  make error rate configureable
  add persistence test not using predetermined random seeds.
  update cluster test to also use hll
  persistence really works.
  well, with this commit synchronizing the data structure should work.. ...if we had consistent hashing.
  and also serialize the other things we need
  ok, this bug was hard to find.
  serialization compiles.
  ...
2013-08-31 10:42:42 -07:00
Robin Sommer
295987c8d0 Making the confidence configurable. 2013-08-31 10:34:50 -07:00
Robin Sommer
fb3ceae6d5 Renaming HyperLogLog->CardinalityCounter.
For consistency with the class' name.
2013-08-31 10:22:27 -07:00
Robin Sommer
ef04ce809b Fixing bug introduced during merging. 2013-08-31 10:17:13 -07:00
Robin Sommer
4dcf8fc0db Merge remote-tracking branch 'origin/topic/bernhard/hyperloglog'
* origin/topic/bernhard/hyperloglog: (32 commits)
  add clustered leak test for hll. No issues.
  make gcc happy
  (hopefully) fix refcounting problem in hll/bloom-filter opaque vals. Thanks Robin.
  re-use same hash class for all add operations
  get hll ready for merging
  and forgot a file...
  adapt to new structure
  fix opaqueval-related memleak.
  make it compile on case-sensitive file systems and fix warnings
  make error rate configureable
  add persistence test not using predetermined random seeds.
  update cluster test to also use hll
  persistence really works.
  well, with this commit synchronizing the data structure should work.. ...if we had consistent hashing.
  and also serialize the other things we need
  ok, this bug was hard to find.
  serialization compiles.
  change plugin after feedback of seth
  Forgot a file. Again. Like always. Basically.
  do away with old file.
  ...
2013-08-30 11:30:05 -07:00