3096 Commits

Author SHA1 Message Date
Janmejay Singh
66bdb31377 Fix lookup-table unsigned underflow in quick-sort and binary-search comparators (identified in #2295) 2017-12-27 13:20:29 +05:30
Rainer Gerhards
d71ab8a5cc
Merge pull request #2296 from rgerhards/i2295
lookup tables: fix undefined behaviour
2017-12-26 15:37:44 +01:00
Rainer Gerhards
4f13c27d5a lookup tables: fix undefined behaviour
bsearch is not permitted to be called with NULL ptr for array.

Detectedb by LLVM UBSan.

see also https://github.com/rsyslog/rsyslog/issues/2295
2017-12-25 16:20:32 +01:00
Jan Gerhards
1987cabbbf rsconf: use new errmsg interface
see also https://github.com/rsyslog/rsyslog/issues/1684
2017-12-25 15:46:03 +01:00
Rainer Gerhards
8cb0a95a38 code style: fix too-long lines 2017-12-23 18:25:37 +01:00
Rainer Gerhards
49f9b26601
Merge pull request #2246 from mrworkman/rscript-is-timestamp
Add is_time() RainerScript function.
2017-12-22 12:49:02 +01:00
Rainer Gerhards
2af5c24d2d
Merge pull request #2285 from PascalWithopf/line_length_correction
codestyle: partially reduce line length to 120
2017-12-21 18:54:10 +01:00
PascalWithopf
29c9fb1f9a codestyle: reduce line length to 120
lines are still checked for a length of 125 because
these are just some of the lines
2017-12-21 17:09:32 +01:00
Rainer Gerhards
e05b3ff0fd core/glbl: remove long-unused option $optimizeforuniprocessor
This was still available, but had no effect (for ~10 years or so). The
plumbing is now removed. If someone tries to use the option, an
error message is generated.

closes https://github.com/rsyslog/rsyslog/issues/2280
2017-12-21 14:50:35 +01:00
Rainer Gerhards
bc8e88be63
Merge pull request #2277 from rgerhards/i1976
mmexternal: refactor and enhanced testbench test
2017-12-21 12:39:01 +01:00
PascalWithopf
79de51e4fc codestyle: reduce max line length to 125 2017-12-20 16:16:57 +01:00
Rainer Gerhards
8d807e35f0 mmexternal bugfix: potentially missing argv[0]
This is incorrect and can cause problems with some language, namely go.

see also https://github.com/rsyslog/rsyslog/issues/1858
closes https://github.com/rsyslog/rsyslog/issues/2278
2017-12-20 15:58:26 +01:00
Rainer Gerhards
ba66b20d20 core bugfix: race on LocalHostIP property during startup
The way the default was set could lead to a race if e.g. two internal
messages were emitted at startup when the property was not yet set. This
has been seen to happen in practice. It had no bad effect except a very
small stationary memory leak, but made using thread analyzers unreliable
(as it was rightfully detected as a problem).

closes https://github.com/rsyslog/rsyslog/issues/2012
2017-12-19 18:53:18 +01:00
Rainer Gerhards
fa70c62669
Merge pull request #2262 from rgerhards/i2228
core bugfix: MAXFNAME was set too low
2017-12-19 18:12:37 +01:00
Rainer Gerhards
c9c03d92cf
Merge pull request #2260 from rgerhards/i-352bis
replace SOL_TCP by portable equivalent IPPROTO_TCP
2017-12-19 18:00:16 +01:00
Stephen Workman
a8a7a1e8cf Add date/time format enum, and lookup function. 2017-12-19 09:12:09 -05:00
Rainer Gerhards
c1a08018da replace SOL_TCP by portable equivalent IPPROTO_TCP
see also https://github.com/rsyslog/rsyslog/issues/352#issuecomment-352667294
2017-12-19 14:00:41 +01:00
Rainer Gerhards
d5bcd5b89b core bugfix: MAXFNAME was set too low
it just permitted 200 chars, with almost all systems permitting for
more. I tried to find a more portable way to find out the actual max,
but this turned out horrible. The next solution would have been to use
dynamic alloc, but that often is overkill. So I now settle to just
increasing the value to 4KiB. This is the Linux limit, and it is by
far the highest I could find. This should be good to go for quite
some while but should not put too much stressure on the stack alloc.

closes https://github.com/rsyslog/rsyslog/issues/2228
2017-12-19 10:15:46 +01:00
Rainer Gerhards
e8627a4ec5 remove obsolete pre-KSI GuardTime signature interface
this is no longer functional starting Jan 2018 as it
reached end of life.

closes https://github.com/rsyslog/rsyslog/issues/2128
2017-12-19 09:42:44 +01:00
Rainer Gerhards
4642df4388
Merge pull request #2252 from rgerhards/i-352
import BSD project and Solaris patches
2017-12-19 08:11:02 +01:00
Rainer Gerhards
6aecce2516 fix build issue on BSD (based on original BSD project patch) 2017-12-18 14:09:26 +01:00
BSD Patch
3b50c7c6db lookup: import BSD project patch 2017-12-18 13:23:24 +01:00
Rainer Gerhards
1d7e772088 core: replace some inline functions by macros
I consider the C99 semantics to be pretty broken. Rather than
duplicating code for the inline variant and the non-inline one,
I replace the functions in question by macros. We do not loose
much in terms of type-safety.

see also https://github.com/rsyslog/rsyslog/pull/2246
2017-12-18 12:40:34 +01:00
Rainer Gerhards
d863d6c19b timestamp parsing: do not permit years > 2100
root cause detected by clang UBSAN
2017-12-15 10:51:56 +01:00
Rainer Gerhards
68a620fb5c fix potential unsigened integer overflow
should not have a bad impact on all current platforms, as the
result is properly casted. It's still a potential problem spot.

Detecec by clang UBSAN.
2017-12-15 09:35:39 +01:00
Rainer Gerhards
dd9b98986d core bugfix: inconsitent atomic fetch function interface
macro used unsigned, inline function int. This could lead to an unsigned
overflow if macro version was used. That could potentially lead to malfunction
on some platforms (not seen nor expected in practice, though).

Detected by clang UBSAN.
2017-12-15 09:28:05 +01:00
Rainer Gerhards
29f9bf6068 core bugfix: undefined behavior due to integer overflow
when searching strings, we may have an (unsigned) interger overflow
which can lead to misadressing.

Detected by clang ubsan.
2017-12-14 18:49:04 +01:00
Rainer Gerhards
6d29ae4e31 ubsan: flag unsigned integer overflow as intentional 2017-12-14 18:48:59 +01:00
Rainer Gerhards
1e9579b544 core bugfix: potential segfault on startup
timezone info table was "sorted" even though it may be NULL

Detected by clang ubsan.
2017-12-14 17:25:17 +01:00
Allan Park
5b720b3c8e lmsig_ksils12: fixing coverity issue 185331 2017-12-14 11:30:14 +02:00
Rainer Gerhards
ab7677108e cleanup: remove unused runtime instrumentation code
The --enable-rtinst configure switch and associated instrumentation
code dates back to the time pre-(valgrind, address sanitizer, ...).
It has not been actively used by rsyslog developers for years and is
inferior to the new debugging tools.

With this commit, we remove the --enable-rtinst option and do some
mild refactoring of the code itself. As it turned out, fully removing
the debug code requires a bit more of time, and we push this as a
follow-on activity. It's not as urgent as getting us to build
properly under all configure switches.

closes https://github.com/rsyslog/rsyslog/issues/2048
2017-12-12 16:39:36 +01:00
Rainer Gerhards
5099df4319
Merge pull request #2188 from rgerhards/i-1939
RainerScript: implement previous_action_suspended() function
2017-12-11 10:26:23 +01:00
Rainer Gerhards
ce06bba15c RainerScript: implement previous_action_suspended() function
This function returns a boolean indicating if the previous action is
suspended (0 - no, 1 - yes). This is useful if arbitrary processing
(other than calling actions) should be made depending on that state.
A prime example for this is probably calling a ruleset.

closes https://github.com/rsyslog/rsyslog/issues/1939
2017-12-09 17:48:28 +01:00
Rainer Gerhards
2614b1803c
Merge pull request #2172 from GrayTShirt/pg
update postgres output module
2017-12-09 17:25:22 +01:00
Rainer Gerhards
b63d3051bc RainerScript: add function script_error() and error-reporting support
This permits script functions that could fail to report errors back, so
that the user can handle them if desired. We use an errno-style of
interface. That means script_error() needs to be called after functions
that supports it. It will return either 0 (all OK) or something else
(an error condition).

The commit also modifies the parse_time() function to use the new
interface. First of all, this is useful for users, and secondly we
needed a capability to craft a testbench test.

closes https://github.com/rsyslog/rsyslog/issues/1978
2017-12-09 16:08:36 +01:00
Dan Molik
f334e2b250 ompgsql plugin - update postgres module
The PostgreSQL output module was woefully out-of-date the following
list is changes made to update the module to current Rsyslog standards.

  - allow for v6 configuration syntax
  - configurable ports
  - support transactional interface
  - push db connection into workers (libpq is threadsafe)
  - enable module testing on travis
  - ensure configuration syntax backwards compatibility
  - formatting around postgres core templating
  - use new test conventions
  - add new configuration syntax test
  - add valgrind tests for new and old syntax
  - add threading tests
  - add action queue long running tests
  - add action queue valgrind test
2017-12-09 09:04:46 -05:00
Rainer Gerhards
0701dd0972
Merge pull request #2180 from rgerhards/cid-185877
core: refactor parent directory creation function
2017-12-09 10:25:19 +01:00
Rainer Gerhards
43f4910a3e
Merge pull request #2179 from rgerhards/raspbian-1
fix build issue on raspbian
2017-12-08 18:11:47 +01:00
Rainer Gerhards
b3fbedae2d core: refactor parent directory creation function
streamline code, also fix Coverity scan ID 185877
2017-12-08 16:16:20 +01:00
Rainer Gerhards
17a39a3e9a fix build issue on raspbian 2017-12-08 13:38:57 +00:00
Rainer Gerhards
5aa044e452
Merge pull request #2175 from jgerhards/errmsg-net
net: use new errmsg interface
2017-12-08 08:38:53 +01:00
Rainer Gerhards
41e8460d79
Merge pull request #2177 from jgerhards/errmsg-nsd_ptcp
nsd_ptcp: use new errmsg interface
2017-12-08 08:38:03 +01:00
Jan Gerhards
811878f263 nsd_ptcp: use new errmsg interface 2017-12-07 19:35:46 +01:00
Rainer Gerhards
9001dc8796 file encryption subsystem: fix potential NULL pointer access
Under an out-of-memory condition when memory alloc fails a NULL
pointer was accessed. Note that this only happens if the system (process)
is totally out of memory.
2017-12-07 14:02:33 +01:00
Jan Gerhards
fec913d119 net: use new errmsg interface 2017-12-07 10:33:39 +01:00
Rainer Gerhards
45fbc97627
Merge pull request #2160 from mosvald/master
cache sin_addr instead of the whole sockaddr structure
2017-12-07 08:11:44 +01:00
Rainer Gerhards
7361603175 refactor core to unify random number generation
this is a step forward, but not everything yet done. Nevertheless
useful in itself.
2017-12-06 13:58:58 +01:00
mosvald
5f828658a3 cache sin_addr instead of the whole sockaddr structure 2017-12-04 08:10:37 +01:00
Rainer Gerhards
04220bdd3f omhttpfs: "fix" Coverity scan false positive CID 185398 2017-12-02 12:08:34 +01:00
7508010750 Basic Imfile FEN API support for Solaris (#2141)
imfile: Initial implementation of solaris FEN API (without wildcards)

FEN API is used to implement simular event based file
monitoring like with inotify.

This commit provides partial functionality. It supports event-driven
processing of files but does not yet provide wildcard functionality.
Wildscards will be provided by a later commit.

This can be committed as-is because the previous code did also
not provide wildcard support, so this is an improvement for
Solaris in any case.

see also https://github.com/rsyslog/rsyslog/issues/1954
2017-12-01 12:49:38 +01:00