556 Commits

Author SHA1 Message Date
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
Rainer Gerhards
3c18216588 config processing: ensure proper alignment
This came up on arm (raspbian) build, but is probably the right thing
to do in any case!
2017-12-08 14:58:45 +00:00
Jan Gerhards
38d92ff814 rainerscript: bugfix
fix a bug causing a crash if rtrim or ltrim were called
with a string containing a blank and one single different character.

closes https://github.com/rsyslog/rsyslog/issues/2127
2017-12-02 18:26:39 +01:00
Rainer Gerhards
1bb9aa4c38 work around flex/bison problems with gcc-7 2017-11-29 12:39:07 +01:00
Rainer Gerhards
047624147c some primarily cosmetic changes 2017-11-22 12:33:03 +01:00
Rainer Gerhards
dc2e06d6b8 "fix" Coverity scan cosmetic issues
Let us get rid of some dismissed CID entries...
2017-11-21 09:15:31 +01:00
PascalWithopf
e485c5c5bc codestyle: shorten lines to max 130 chars 2017-11-15 09:04:42 +01:00
Rainer Gerhards
d65dc24616
Merge pull request #1925 from mrworkman/rscript-parse-time
Add RainerScript parse_time() function to convert date/time strings to UNIX time.
2017-11-08 08:38:56 +01:00
Rainer Gerhards
38084023cc improve error messages in case of failing to obtain group info
Also fixes Coverity Scan CID 185357.
2017-11-07 13:21:09 +01:00
Rainer Gerhards
c45df26475 cleanup: reduce the number of warning-avoidance pragmas 2017-11-07 12:03:04 +01:00
Stephen Workman
b2e7c05263 Add parse_time() RainerScript function. 2017-11-06 13:01:00 -05:00
Rainer Gerhards
0f65df6a12 exp: remove #pragma causing trouble with newer clang 2017-11-04 18:11:26 +01:00
Rainer Gerhards
f6f569651c rainerscript: check that we really do not have mem leak via assert()
This is done because a) it is generally a good idea to have it and
b) we investigate CID 185385 which looks much like a false positive.
2017-11-01 19:35:42 +01:00
Rainer Gerhards
028d87170b config parser: potential double free on invalid config
commit 4aa6be5da6dc9a7bd921d02695f734c4097189a0 was incomplete

Detected by Coverity scan, CID 185388
2017-10-29 19:13:04 +01:00
Rainer Gerhards
4aa6be5da6 config parser: potential double free on invalid config
If a the compare operation in a property filter could not properly
be parsed, a double free occured.

Detected by Coverity scan, CID 185388
2017-10-29 10:54:49 +01:00
Rainer Gerhards
adec568655 cosmetic: fix code style, most importantly indention 2017-10-19 13:30:39 +02:00
Rainer Gerhards
9dab121f7b lookup table: fix fallthrough in case statement
... plus a case where we explicitley give fallthrough attribute
2017-10-19 13:29:45 +02:00
Stephen Workman
0ff332ab87 Remove NULL checks. 2017-10-11 17:19:34 -04:00
Stephen Workman
993f2ca187 Remove use of strftime(), for portability reasons. 2017-10-08 17:50:33 -04:00
Stephen Workman
7b5b6c2295 Use gmtime, and var2Number. 2017-10-05 21:31:26 -04:00
Stephen Workman
8d82d59343 Move formatting code to datetime.c, and update test. 2017-10-05 09:57:19 -04:00
Stephen Workman
e6edbbc598 Wip. 2017-10-04 22:08:49 -04:00
Stephen Workman
8391e0fdf1 Initial testing of format_time(). 2017-10-04 13:04:44 -04:00
Jan Gerhards
0abf897e52 rainerscript: add functions lTrim and rTrim
closes https://github.com/rsyslog/rsyslog/issues/1711
2017-08-09 15:45:30 +02:00
Jan Gerhards
779fce20b3 multiple modules: add better error messages when regcomp is failing
see also: https://github.com/rsyslog/rsyslog/issues/1102
2017-06-26 11:03:00 +02:00
Jiri Vymazal
ea477f961e reverted str2num() bSuccess return to be consistent with past behavior 2017-03-22 14:57:01 +01:00
Jan Gerhards
31ee2057f1 bugfix: str2num mishandling empty strings
If str2num() receives an empty string, misadressing happens.
Under extreme conditions, this theoretically can lead to a segfault.

closes https://github.com/rsyslog/rsyslog/issues/1412
2017-02-13 10:41:43 +01:00
Jan Gerhards
c41f91d249 add num2ipv4 function and test
closes https://github.com/rsyslog/rsyslog/issues/1322
2017-02-11 11:21:05 +01:00
Rainer Gerhards
f55c3cad93 Merge pull request #1405 from jgerhards/i1279
add ipv42num function and test
2017-02-10 17:32:14 +01:00
Jan Gerhards
00c2b4a4ae add ipv42num function and test
closes https://github.com/rsyslog/rsyslog/issues/1279
2017-02-10 15:13:07 +01:00
Rainer Gerhards
e2767839bc rainescript: set/unset statement do not check variable name validity
Only JSON-based variables can be use with set and unset. Unfortunately,
this restriction is not checked. If an invalid variable is given
(e.g. $invalid), this is not detected upon config processing on
startup. During execution phase, this can lead to a segfault, a
memory leak or other types of problems.

see also https://github.com/rsyslog/rsyslog/issues/1376
closes https://github.com/rsyslog/rsyslog/issues/1377
2017-01-24 13:24:29 +01:00
Pascal Withopf
b63a6b9010 codestyle: line length adjusted 2017-01-17 08:54:37 +01:00
Rainer Gerhards
d8d7fc58cd rainerscript: implement new "call_indirect" statement
closes https://github.com/rsyslog/rsyslog/issues/1318
2016-12-11 12:06:28 +01:00
purnima
d45daa2af0 Rebase,redefine msgDestruct() as smsg_t is used 2016-11-22 14:24:25 +05:30
Janmejay Singh
1320d5ac24 Initialize func-data(and to-be-freed flag) correctly for prifilt function-node (identified in valgrind run in issue #1071), it is almost definitely independent of the problem that user observed, but is a low-value bug anyway. 2016-10-14 16:10:57 +05:30
Rainer Gerhards
cfacd4c30f code cleanup: fix compiler warnings that newly came up
we got a bunch of new ones under updated Fedora
2016-10-11 14:10:25 +02:00
Rainer Gerhards
fee6141c51 Merge pull request #1085 from rgerhards/conf-system
build system: do not enable -Werror on release builds
2016-09-05 18:44:15 +02:00
Rainer Gerhards
51c03c66e0 make inline functions C99-compliant
As it seems, different C compilers have different rules/interpretations
on inline functions. The current code base did not properly obey all C99
rules. We fix this by converting some functions to macros and others to
include the necessary C99 plumbing. We also remove some inline attributes
for functions where this seems to be to agressive (aka "function to big").

This fixes build problems in some environments and is a general code
cleanup measure.
2016-09-05 16:47:14 +02:00
Rainer Gerhards
799cbb9524 generate somewhat better syntax error messages on startup 2016-08-24 08:48:21 +02:00
Rainer Gerhards
bbcbb03c64 fix compiler warnings 2016-07-22 15:00:28 +02:00
Rainer Gerhards
9879e391dd check for invalid recursive include
closes https://github.com/rsyslog/rsyslog/issues/1058
2016-06-06 08:40:20 +02:00
Rainer Gerhards
b3940cb966 remove excessive "inline" attributes 2016-06-03 12:24:27 +02:00
Rainer Gerhards
c1f9374931 fix compiler warning 2016-06-03 11:35:08 +02:00
Rainer Gerhards
87063ea683 shut off unevitable compiler warnings in lexer subsystem
they are caused by generated code that we cannot change
2016-06-03 10:43:46 +02:00
Rainer Gerhards
4ac258360c fix gcc compiler warnings (in pretty strict mode) 2016-06-02 17:06:45 +02:00
Rainer Gerhards
a9ff73b628 do not break build if compiler does not understand pragma
this is the case for older gcc
2016-06-02 12:53:21 +02:00
Rainer Gerhards
5e3b075d53 fix compiler warnings 2016-06-02 12:08:55 +02:00
Rainer Gerhards
8a8675b223 fix compiler warnings 2016-06-02 10:18:05 +02:00
Rainer Gerhards
17553f5195 cleanup: compiler warnings 2016-06-01 09:49:46 +02:00
Rainer Gerhards
070d987a45 fix compiler warnings 2016-06-01 09:49:46 +02:00