Commit Graph

54 Commits (suricata-2.1beta3)

Author SHA1 Message Date
Victor Julien 844065bf58 conf api: use const pointers where possible
Use const pointers where possible in the Conf API.
11 years ago
Victor Julien b955ca7b86 conf: fix potential use-after-free on error
Coverity 1139544

If strdup would fail, 'node' was freed but it wasn't set to NULL. The
code then returned node. The caller would not detect there was an error
and use the freed pointer.
12 years ago
Ken Steele 12ab6f3ab4 Fix uninitialized variable warning.
These two lines reported warnings with -Werror -O3 on Tile.
12 years ago
Eric Leblond 28c5c68192 error checking: add missing alloc error treatment
The return of some malloc like functions was not treated in some
places of the code.
12 years ago
Jason Ish eaff01a57f Use the stack for temporary memory buffers. 12 years ago
Jason Ish ab7091927e When setting final configuration nodes, set the whole tree as final.
Prevents benign log message of parent nodes of final values being
redefined (which ends up having no affect as the final nodes
are protected from being removed).
12 years ago
Jason Ish 8d29dfca59 Instead of exiting on memory failure, log a warning then return NULL
to signify an error to the caller.
12 years ago
Jason Ish 5f6705c4dc Better document ConfSet and ConfSetFinal. 12 years ago
Jason Ish c981a16579 Function to prune all non-final nodes from a configuration node. 12 years ago
Jason Ish b8e13d4bd6 More concise API for setting config values that
can be overrided or not (final values).
12 years ago
Jason Ish 0820ac9355 Cleanup ConfSet, ConfGet, make more concise.
Removes ifdef's for readability by using strchr instead
of strtok.
12 years ago
Eric Leblond 6dfd106139 conf: add unittest for WithDefault functions. 13 years ago
Eric Leblond 0bddf4f02f conf: introduce WithDefault function
This patch introduces a new set of functions to the ConfGetChildValue
family. They permit to look under a default node if looking under
base node as failed. This will be used to access to default parameters
for a data type (for instance, first usage will be interface).
13 years ago
Victor Julien 472e061c6d build: more checking for includes 13 years ago
Eric Leblond e176be6fcc Use unlikely for error treatment.
When handling error case on SCMallog, SCCalloc or SCStrdup
we are in an unlikely case. This patch adds the unlikely()
expression to indicate this to gcc.

This patch has been obtained via coccinelle. The transformation
is the following:

@istested@
identifier x;
statement S1;
identifier func =~ "(SCMalloc|SCStrdup|SCCalloc)";
@@

x = func(...)
... when != x
- if (x == NULL) S1
+ if (unlikely(x == NULL)) S1
13 years ago
Eric Leblond d292004880 Add some missing checks of SCStrdup return. 13 years ago
Victor Julien be5fed869d conf api: remove dead code 13 years ago
Anoop Saldanha d7a93b6fcd clear root node during conf de-init. also create root_backup when the root is restored back using it 13 years ago
Victor Julien cdba2f50d1 Various fixes and improvements based on feedback by Coverity analyzer. 14 years ago
Victor Julien 489b8b8bcc Allow other yaml files to be included in the main yaml. 14 years ago
Victor Julien 55da9787a4 Win32 compile fixes. 14 years ago
Eileen Donlon 89599d3b9b fixed bug 288; corrected config boolean parsing problems 14 years ago
Eric Leblond fbca1a4e6b af-packet: multi interface support
This patch adds multi interface support to AF_PACKET. A structure
is used at thread creation to give all needed information to the
input module. Parsing of the options is done in runmode preparation
through a dedicated function which return the configuration in a
structure usable by thread creation.
14 years ago
Eric Leblond dc667af1a1 conf: Introduce new function to input configuration.
The input modules are needing a per interface configuration. This
implies some new operations to be able to parse easily te configuration.

The syntax of the configuration file is for example:
af-packet:
  - interface: eth0
    threads: 2
  - interface: eth1
    threads: 3
We need a way to express get a configuration variable for interface[eth0].
This is by using ConfNodeLookupKeyValue() to get the matching node. And
after that value can be fetch by using ConfGetChildValue*() functions.
14 years ago
Jason Ish 7257fed0f3 Fix bug 288, accept true in output configuration.
Refactor a bit to run checks for truth through a common function
that takes yes, true, on and 1 as true values.
14 years ago
Victor Julien cb0bb668eb Add support for retrieving float and double variables from the configuration. 15 years ago
Jason Ish 18e5ac8cde Basic rule profiling even though the results may be skewed by a bad rule in a grouping of rules. 15 years ago
Gerardo Iglesias Galvan 9f4fae5b1a Fix inconsistent use of dynamic memory allocation 15 years ago
William Metcalf ce01927515 Import of GPLv2 Header 050410 16 years ago
Pablo Rincon 25a3a5c6d8 Adding mem wrapper to debug runtime alloc()/free() functions. Fixing some memory leaks. 16 years ago
Jason Ish 7537013e16 Fix bug 99.
- Handle the case where the parent node already exists in ConfSet.
- Deal with allow_override properly when a node has already been
  set with ConfSet.
16 years ago
Jason Ish ea277a0b36 Cleanup of configuration internals. Use an n-ary type tree for everything instead of a first level hash branching off into n-ary type trees.
Reduces the code and uses a uniform internal data structure.
16 years ago
Victor Julien 0d34990d7f Add OpenBSD's strlcpy and strlcat and replace all strcat/strcpy/strncat/strncpy by those calls. 16 years ago
Jason Ish 844c444af1 Use the configuration file to setup alert logging (and http logging).
Only setup for the live pcap modes at the moment.
16 years ago
Victor Julien b7bac14040 Fixup code to compile with -Wall -Werror -Wextra -Wno-unused-parameter compiler options. 16 years ago
Jason Ish d86282af9c pretty up ConfDump output for when there is no valid prefix 16 years ago
Jason Ish fdb1c9c4f2 cleanup warnings. 16 years ago
Jason Ish 6cc0771d6f - Fix memory leak error when freeing node.
- Cleanup ConfDump output a little.
16 years ago
Victor Julien 4c79e6d5b6 compile fixes 16 years ago
Jason Ish 90c46ee2c9 Add the ability to lookup a child ConfNode, or just the value of a child ConfNode. 16 years ago
Jason Ish 59ec05645f Index sequence items - allows us to store sequences of mappings in the configuration database. 16 years ago
Victor Julien ecf86f9c23 Rename to Suricata. 16 years ago
Victor Julien 241db64dd7 Fix a few memory issues. 16 years ago
Anoop Saldanha dc44700ce5 Support vars lookup from conf file. Current patch support address and port group vars lookup 16 years ago
Victor Julien bf72331849 Fix compilation warning in conf test. 16 years ago
Jason Ish ec9fa7b0a7 Files missed in last commit.
Update Conf API to allow direct access to nodes.

    A configuration node is now a tailq head and a tailq entry.  This allows us to build
    n-ary type trees to build something DOM like.

    Properly process lists so a list of rule files (for example) can be loaded.
16 years ago
Anoop Saldanha 6858192660 Added a NULL check inside ConfGet() 16 years ago
Victor Julien bcc5bbef93 Yet more logging api usage changes. 16 years ago
Victor Julien 0d0ffb9963 Reorganize header inclusions. 16 years ago
Jason Ish f508d1e0fd Add getters for integer and boolean values. 16 years ago