Pavel Rochnyack [Tue, 11 Jul 2017 04:08:56 +0000 (11:08 +0700)]
Fixed failed compilation on AIX
Caused by typo in
2761915bed8c6caea41018be3e675aa712cc0b0a / #1842.
Closes: #2305
Ruben Kerkhof [Tue, 4 Jul 2017 15:27:03 +0000 (17:27 +0200)]
Merge pull request #2341 from rpv-tomsk/issue-2328
curl plugins: Use configured URL for all poll cycles
Pavel Rochnyack [Tue, 4 Jul 2017 10:31:46 +0000 (17:31 +0700)]
curl plugins: Use configured URL for all poll cycles
After redirect received, Collectd send subsequent requests to new location.
That is wrong - Collectd should use configured URL for all poll cycles, regardless of the responses received previously.
Problem was caused by libcurl issue 1631. To avoid that we set request url in each poll cycle.
Closes: #2328
Ruben Kerkhof [Fri, 30 Jun 2017 14:15:25 +0000 (16:15 +0200)]
email, exec and unixsock plugins: enlarge buffer for getgrnam_r result
Thanks to Jeremie Courreges-Anglas and Daniel Jakots.
Ruben Kerkhof [Fri, 30 Jun 2017 14:12:57 +0000 (16:12 +0200)]
email, exec and unixsock plugins: fix error handling
Diff from Jeremie Courreges-Anglas, via Daniel Jakots
Ruben Kerkhof [Wed, 28 Jun 2017 17:38:12 +0000 (19:38 +0200)]
Merge pull request #2331 from mfournier/ldap_unbind-segfault
openldap: check ld structure before passing it to ldap_unbind()
Marc Fournier [Wed, 28 Jun 2017 11:46:59 +0000 (13:46 +0200)]
openldap: check ld structure before passing it to ldap_unbind()
This prevents collectd from segfaulting when the ldap session setup
fails before opening a connection to openldap (syntax error in the URL
option for example).
Ruben Kerkhof [Tue, 30 May 2017 15:25:17 +0000 (17:25 +0200)]
Bind plugin: plug a few leaks
Fixes: #2303
Iain Buclaw [Fri, 19 May 2017 10:55:37 +0000 (12:55 +0200)]
format_graphite: Error if call to uc_get_rate fails to return a value.
This prevents a wrong value being sent to graphite for DERIVE types.
See #2209
Signed-off-by: Florian Forster <octo@collectd.org>
Florian Forster [Wed, 17 May 2017 06:01:29 +0000 (08:01 +0200)]
amqp plugin: Enable the "ExchangeType" for publishers, too.
Fixes: #2286
Florian Forster [Mon, 15 May 2017 12:40:26 +0000 (14:40 +0200)]
curl_json plugin: Fix array index and key handling.
Previously, the "key" was loaded by calling cj_cb_map_key() from
cj_cb_inc_array_index(). That means that the key for the previous element
was loaded as the array index was updated for the next element, resulting
in an off-by-one error. Also the key was not unset in time, resulting in
two metrics with the same identifier being created.
This patch fixes this with the following changes:
* cj_advance_array() (nee cj_cb_inc_array_index()) now loads the key for
the new index position instead of the previous one.
* The initial "0" key is loaded from cj_cb_start_array().
* cj_advance_array() always updates the key. The "update_key" argument
has been removed.
* Refactoring: key loading has been moved out of cj_cb_map_key() and
into its own function, cj_load_key().
Unit tests are in a separate commit for easier cherry-picking.
Fixes: #2266
Florian Forster [Mon, 15 May 2017 06:14:03 +0000 (08:14 +0200)]
collectd.conf(5): Fix typo ("queries" vs. "queried").
By avoiding the word: "metrics" is bettern than "statistics".
Ruben Kerkhof [Sun, 14 May 2017 10:38:58 +0000 (12:38 +0200)]
Merge pull request #2278 from octo/ff/perl
perl plugin: Fix potential double-free.
Florian Forster [Sun, 14 May 2017 06:24:51 +0000 (08:24 +0200)]
perl plugin: Fix potential double-free.
The av2notification_meta() function updated it's parameter by doing
(*m) = malloc();
Afterwards, if an error occurred, it would call `free(*m);` and (potentially)
return, leaving an invalid pointer stored in `m`. The caller would then try to
free the returned pointer because it was non-NULL.
This patch fixes this by doing several code cleanups:
* The meta argument is not updated unnecessarily. Instead, a local variable
is allocated and used within the loop and only on success is the return
pointer updated.
* Introduce additional local variables instead of re-using the `tmp` variable
multiple times.
* Name the variable pointing to the end of the linked list appropriately
`tail` and remove one level of indirection. Reading code that is using
pointers to pointers is unnecessarily hard.
Florian Forster [Sun, 7 May 2017 18:34:09 +0000 (20:34 +0200)]
bind plugin: Use timegm() to convert to time_t if available.
FreeBSD doesn't provide the "extern long timezone", presumably because
it's "only" an XSI extension, leading to a portability issue with the
previous approach.
timegm() is a non-standard function available in GNU's and BSD's libc
which is doing exactly what we need. The previous code is left as a
fallback.
Fixes: #1268
Ed Ravin [Sat, 6 May 2017 02:53:59 +0000 (22:53 -0400)]
fix BIND timezone parsing issue
Florian Forster [Sun, 7 May 2017 10:06:47 +0000 (12:06 +0200)]
collectd.conf(5): Add section documenting the ignorelist functionality.
Fixes: #2267
Pavel Rochnyack [Mon, 3 Apr 2017 05:57:09 +0000 (11:57 +0600)]
network plugin: Fix endless loop DOS in parse_packet()
When correct 'Signature part' is received by Collectd, configured without
AuthFile option, condition for endless loop occurs due to missing increase
of pointer to next unprocessed part.
This is a forward-port of #2233.
Fixes: CVE-2017-7401
Closes: #2174
Signed-off-by: Florian Forster <octo@collectd.org>
Ruben Kerkhof [Sun, 5 Mar 2017 17:30:23 +0000 (18:30 +0100)]
collectd.spec: Don't enable XFS support on RHEL6
It is missing for i386.
If there's strong interest in having support for xfs in the df plugin in
RHEL6 we can do some macro magic to only BuildRequire xfsprogs-devel if
were not on rhel6 i386, but this was the easiest fix and unblocks our
package builds.
Ruben Kerkhof [Sun, 5 Mar 2017 16:14:18 +0000 (17:14 +0100)]
Merge pull request #2204 from collectd/check-for-cap-is-supported
Check for the CAP_IS_SUPPORTED macro
Ruben Kerkhof [Sun, 5 Mar 2017 15:46:47 +0000 (16:46 +0100)]
Check for the CAP_IS_SUPPORTED macro
On EPEL6:
src/daemon/common.c: In function 'check_capability':
src/daemon/common.c:1571: error: implicit declaration of function 'CAP_IS_SUPPORTED'
make[1]: *** [src/daemon/common.lo] Error 1
Ruben Kerkhof [Fri, 24 Feb 2017 16:42:59 +0000 (17:42 +0100)]
look for cap_get_proc instead of cap_get_bound
a2ddc38 switched the capability check from cap_get_bound() to
cap_get_proc()
Ruben Kerkhof [Fri, 24 Feb 2017 16:40:41 +0000 (17:40 +0100)]
Merge pull request #2151 from mfournier/check_capability-rewrite-fix
daemon/common.c: Fix check_capability() by using cap_get_proc()
Marc Fournier [Wed, 25 Jan 2017 07:10:48 +0000 (08:10 +0100)]
smart: log warning if CAP_SYS_RAWIO is missing
Related to #2143
Ruben Kerkhof [Fri, 24 Feb 2017 15:52:17 +0000 (16:52 +0100)]
Merge pull request #2192 from maryamtahhan/bugfix_regex_memleak
fix for memory leak in utils_match.c
Krzysztof Matczak [Fri, 24 Feb 2017 09:38:14 +0000 (09:38 +0000)]
fix for memory leak in utils_match.c
Change-Id: I058afae8c0a99115bda70e125840fc6bd224b358
Signed-off-by: Krzysztof Matczak <krzysztofx.matczak@intel.com>
Marc Fournier [Wed, 11 Jan 2017 12:39:27 +0000 (13:39 +0100)]
log_logstash: send log messages to STDERR by default
See also
dec394e08
Marc Fournier [Tue, 10 Jan 2017 21:58:21 +0000 (22:58 +0100)]
src/daemon/collectd.c: do not refer to syslog in error message
... as the message the user would be looking for can be found on
stderr/stdout or in any configured logfile.
Marc Fournier [Tue, 10 Jan 2017 21:23:55 +0000 (22:23 +0100)]
logfile: send log messages to STDERR by default
This prevents early startup log messages from going unnoticed if the
default logfile isn't writeable.
Fixes: #2057
Ruben Kerkhof [Wed, 22 Feb 2017 08:59:02 +0000 (09:59 +0100)]
collectd.spec: enable XFS support in df plugin
Fixes #2178
Marc Fournier [Sat, 28 Jan 2017 10:47:38 +0000 (11:47 +0100)]
notify_email: don't explicitly link against libssl and libcrypto
libesmtp takes care of this.
Pointed out by https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852924
Marc Fournier [Wed, 25 Jan 2017 06:37:41 +0000 (07:37 +0100)]
daemon/common.c: Fix check_capability() by using cap_get_proc()
Rewrite this function, as
58acba67f made it a no-op.
Denys Fedoryshchenko [Fri, 6 Jan 2017 01:36:16 +0000 (03:36 +0200)]
mqtt plugin: Fix invalid symbols in topic name.
Denys Fedoryshchenko [Fri, 6 Jan 2017 01:36:16 +0000 (03:36 +0200)]
mqtt plugin: Fix resource leak.
Fixes: #2123
Marc Fournier [Tue, 10 Jan 2017 20:39:22 +0000 (21:39 +0100)]
chrony: add missing build flag
This is a backport of
211bd4843.
Marc Fournier [Tue, 10 Jan 2017 07:34:08 +0000 (08:34 +0100)]
collectd.spec: ensure write_riemann build deps are installed
Marc Fournier [Mon, 9 Jan 2017 18:53:52 +0000 (19:53 +0100)]
collectd.spec: fixes to previous commit
Marc Fournier [Mon, 9 Jan 2017 17:06:19 +0000 (18:06 +0100)]
collectd.spec: re-enable write_riemann on EL7, as build dep is now available in EPEL7
Marc Fournier [Wed, 4 Jan 2017 00:05:49 +0000 (01:05 +0100)]
curl_json: use configured interval as default timeout value
When no timeout is specified, the default timeout should be set to the
configured interval, not the default timeout (which is -1, no timeout).
This bug got introduced in
bce14a848.
Florian Forster [Fri, 16 Dec 2016 13:39:07 +0000 (14:39 +0100)]
Auto-Merge pull request #2099 from tokkee/sh/booleans
Automatically merged due to "Automerge" label
Sebastian Harl [Sun, 11 Dec 2016 11:06:58 +0000 (12:06 +0100)]
configfile: Reintroduce support for boolean string config values.
For the network plugin, this was changed in
ac73c75aed7 (which landed in 5.6)
which was a backward incompatible change breaking user configuration. Adding
support back in a central location ensures a more consistent behavior across
plugins. At the same time, we issue a warning message that this behavior is
deprecated.
GH #2083, #2098
Florian Forster [Tue, 6 Dec 2016 12:28:20 +0000 (13:28 +0100)]
smart plugin: Refactor, demote warnings to debug.
Fixes: #2062
Florian Forster [Mon, 5 Dec 2016 10:52:35 +0000 (11:52 +0100)]
write_kafka plugin: Use 32bit random number when formatting a random key.
Previously, negative numbers would be truncated to "
ffffffff" by the
buffer length on architectures where longs are 64 bit.
Fixes: #2074
Florian Forster [Mon, 5 Dec 2016 10:49:34 +0000 (11:49 +0100)]
src/daemon/utils_random.[ch]: Implement cdrand_u().
Florian Forster [Wed, 30 Nov 2016 08:44:51 +0000 (09:44 +0100)]
Bump version to 5.6.1; Update ChangeLog.
Kevin Bowling [Wed, 6 Apr 2016 06:17:26 +0000 (23:17 -0700)]
Collected podtypo
Ruben Kerkhof [Tue, 29 Nov 2016 11:33:20 +0000 (12:33 +0100)]
collectd.spec: also disable write_redis on EL6
This plugin also depends on the hiredis library, which was retired from
EPEL6.
Ruben Kerkhof [Tue, 29 Nov 2016 11:31:39 +0000 (12:31 +0100)]
Merge branch 'collectd-5.5' into collectd-5.6
Conflicts:
contrib/redhat/collectd.spec
Ruben Kerkhof [Tue, 29 Nov 2016 10:48:40 +0000 (11:48 +0100)]
collectd.spec: disable redis plugin on EL6
hiredis has been retired from EPEL6
Ruben Kerkhof [Tue, 29 Nov 2016 10:43:08 +0000 (11:43 +0100)]
collectd.spec: disable redis plugin on EL6
Florian Forster [Mon, 28 Nov 2016 21:22:01 +0000 (22:22 +0100)]
More reformatting.
No idea why the previous round missed these files.
Florian Forster [Mon, 28 Nov 2016 21:09:22 +0000 (22:09 +0100)]
Tree wide: Reformat with clang-format.
Florian Forster [Mon, 28 Nov 2016 20:48:36 +0000 (21:48 +0100)]
Merge branch 'collectd-5.5' into collectd-5.6
Florian Forster [Mon, 28 Nov 2016 15:51:37 +0000 (16:51 +0100)]
Bump version to 5.5.3; Update ChangeLog.
Ruben Kerkhof [Sat, 19 Nov 2016 10:47:00 +0000 (11:47 +0100)]
Fix Lua header detection
checking lua.h usability... yes
checking lua.h presence... no
configure: WARNING: lua.h: accepted by the compiler, rejected by the
preprocessor!
configure: WARNING: lua.h: proceeding with the compiler's result
checking for lua.h... yes
checking lauxlib.h usability... yes
checking lauxlib.h presence... no
configure: WARNING: lauxlib.h: accepted by the compiler, rejected by the
preprocessor!
configure: WARNING: lauxlib.h: proceeding with the compiler's result
checking for lauxlib.h... yes
checking lualib.h usability... yes
checking lualib.h presence... no
configure: WARNING: lualib.h: accepted by the compiler, rejected by the
preprocessor!
configure: WARNING: lualib.h: proceeding with the compiler's result
checking for lualib.h... yes
AC_CHECK_HEADERS uses the preprocessor directly, which doesn't use
CFLAGS. Fixes detection of the lua-5.1 compat libs on Fedora Rawhide.
Marc Fournier [Wed, 16 Nov 2016 09:12:10 +0000 (10:12 +0100)]
contrib/README: sort items
Florian Forster [Fri, 11 Nov 2016 13:34:20 +0000 (14:34 +0100)]
collectd-tg: Fix sleep interval.
nanosleep() was called with the current time, meaning that it would
block for years. This correctly subtracts "now" from the metric's time
and only sleeps for the duration between the two.
Florian Forster [Mon, 7 Nov 2016 07:43:17 +0000 (08:43 +0100)]
Merge branch 'collectd-5.5' into collectd-5.6
Florian Forster [Mon, 7 Nov 2016 06:03:17 +0000 (07:03 +0100)]
Merge remote-tracking branch 'github/pr/2026' into collectd-5.5
Florian Forster [Sat, 5 Nov 2016 21:32:49 +0000 (22:32 +0100)]
apcups plugin: Skip metrics not reported by the UPS.
Fixes: #2025
Florian Forster [Sun, 6 Nov 2016 21:17:02 +0000 (22:17 +0100)]
write_kafka plugin: Fix support for librdkafka 0.9.0.
Use rd_kafka_set_logger() only when rd_kafka_conf_set_log_cb() is not
available:
write_kafka.c: In function 'kafka_handle':
write_kafka.c:119:6: error: 'rd_kafka_set_logger' is deprecated (declared at /usr/local/include/librdkafka/rdkafka.h:2400) [-Werror=deprecated-declarations]
rd_kafka_set_logger(ctx->kafka, kafka_log);
^
Fixes: #2029
Florian Forster [Sun, 6 Nov 2016 19:40:36 +0000 (20:40 +0100)]
Merge remote-tracking branch 'github/pr/2027' into collectd-5.5
Florian Forster [Sun, 6 Nov 2016 09:21:35 +0000 (10:21 +0100)]
modbus plugin: Avoid sizeof(struct sockaddr).
The previous version failed on FreeBSD with:
modbus.c: In function 'mb_read_data':
modbus.c:476:21: error: storage size of 'sockaddr' isn't known
struct sockaddr sockaddr;
^
Florian Forster [Sun, 6 Nov 2016 10:10:54 +0000 (11:10 +0100)]
src/write_riemann_threshold.h: Various fixes.
* Add license header. Simply copied src/write_riemann_threadhold.c's license.
* Make header self-contained. "plugin.h" is needed for data_source_t and
value_list_t.
* Add names to the parameters and write documentation for the only exported
function.
Florian Forster [Sun, 6 Nov 2016 09:34:22 +0000 (10:34 +0100)]
write_riemann plugin: Fix order of includes.
The previous version failed on Solaris with:
In file included from ./daemon/collectd.h:31:0,
from write_riemann.c:36:
./config.h:1619:0: error: "_FILE_OFFSET_BITS" redefined [-Werror]
#define _FILE_OFFSET_BITS 64
^
Florian Forster [Wed, 2 Nov 2016 08:20:57 +0000 (09:20 +0100)]
Merge branch 'collectd-5.5' into collectd-5.6
Marc Fournier [Tue, 1 Nov 2016 10:54:26 +0000 (11:54 +0100)]
configure.ac: make finding java deterministic
The sort order of the `find` command proves to be dependent on external
factors, which makes `./configure` pick different java versions on
different systems, making the whole build non-reproducible (see
https://reproducible-builds.org/ for more details).
Adding a call to `sort`, with the locale forced, fixes this issue.
Fixes: #1523
Florian Forster [Sun, 30 Oct 2016 20:42:49 +0000 (21:42 +0100)]
battery plugin: Fix type in a warning.
Ruben Kerkhof [Sun, 30 Oct 2016 10:58:51 +0000 (11:58 +0100)]
zfs_arc: remove double metric
I accidentally added prefetch_metadata_misses in
61635f3 but we
already had that metric.
Fixes #1963
Florian Forster [Sat, 29 Oct 2016 20:08:32 +0000 (22:08 +0200)]
Merge remote-tracking branch 'github/pr/2012' into collectd-5.6
Pavel Rochnyack [Sat, 29 Oct 2016 12:25:15 +0000 (18:25 +0600)]
openvpn: Fixed openvpn_read() on empty configuration.
When plugin loaded without configuration, it starts to spam logs with message
'read-function of plugin `openvpn' failed'.
Issue: #1932
Florian Forster [Fri, 28 Oct 2016 13:04:11 +0000 (15:04 +0200)]
src/daemon/common.c: Rewrite check_capability() using cap_get_bound().
capget(2) is Linux specific and the use of the raw syscalls is
discouraged. Also, there have been interesting crashes on some systems.
Issue: #2009
Florian Forster [Fri, 28 Oct 2016 05:17:17 +0000 (07:17 +0200)]
write_kafka plugin: Reintroduce the "Key Random" setting.
Fixes: #1977
Ruben Kerkhof [Wed, 26 Oct 2016 17:31:01 +0000 (19:31 +0200)]
Merge pull request #2005 from rpv-tomsk/issue-1996
write_http: Fixed DS type check
Pavel Rochnyack [Wed, 26 Oct 2016 17:27:36 +0000 (23:27 +0600)]
write_http: Fixed DS type check
Closes: #1996
Ruben Kerkhof [Mon, 10 Oct 2016 14:44:40 +0000 (16:44 +0200)]
powerdns plugin: fix parsing of last key
I found this in my logs:
collectd[4678]: powerdns plugin: submit: Not found in lookup table: questions#012 =
98797645;
The octal #012 is '\n'. Add a space before the newline so the default
command is split into keys correctly.
Signed-off-by: Florian Forster <octo@collectd.org>
Markus Linnala [Tue, 11 Oct 2016 15:07:25 +0000 (18:07 +0300)]
utils_format_graphite: terminate buffer with \0
Signed-off-by: Florian Forster <octo@collectd.org>
Thomas Deutschmann [Tue, 11 Oct 2016 14:16:23 +0000 (16:16 +0200)]
common.c: Use _LINUX_CAPABILITY_VERSION_3 in cap_header
While check_capability() function already requires
_LINUX_CAPABILITY_VERSION_3 via "#ifdef" since commit
448627953c we still
set the cap_header's version to deprecated _LINUX_CAPABILITY_VERSION. This
results in a warning like
> capability: warning: `collectd' uses 32-bit capabilities (legacy support in use)
from the kernel when a plugin (like iptables) calls our check_capability()
function.
With this commit we will set cap_header to kernel's current capability
version (_LINUX_CAPABILITY_VERSION_3), which is default since
kernel 2.6.26.
Signed-off-by: Florian Forster <octo@collectd.org>
Marc Fournier [Mon, 10 Oct 2016 18:58:19 +0000 (20:58 +0200)]
Merge branch 'collectd-5.5' into collectd-5.6
Marc Fournier [Mon, 10 Oct 2016 18:50:00 +0000 (20:50 +0200)]
fix one typo spotted by Debian's lintian tool
Marc Fournier [Mon, 10 Oct 2016 18:55:56 +0000 (20:55 +0200)]
fix a couple of typos spotted by Debian's lintian tool
Marc Fournier [Mon, 10 Oct 2016 18:47:30 +0000 (20:47 +0200)]
collectd.spec: increment changelog to mention 5.6.1
Victor Demonchy [Mon, 10 Oct 2016 13:28:22 +0000 (15:28 +0200)]
Bump version number in redhat spec
Florian Forster [Sat, 8 Oct 2016 05:48:15 +0000 (07:48 +0200)]
Merge remote-tracking branch 'github/pr/1958' into collectd-5.5
Florian Forster [Fri, 7 Oct 2016 13:52:00 +0000 (15:52 +0200)]
Bump version to 5.6.1; Update ChangeLog.
Florian Forster [Fri, 7 Oct 2016 06:51:29 +0000 (08:51 +0200)]
Merge branch 'collectd-5.5' into collectd-5.6
Florian Forster [Fri, 7 Oct 2016 06:44:53 +0000 (08:44 +0200)]
Merge remote-tracking branch 'github/pr/1961' into collectd-5.5
Marc Fournier [Tue, 4 Oct 2016 21:46:45 +0000 (23:46 +0200)]
write_graphite: remove linking against libyajl (#1976)
write_graphite doesn't have anything to do with json. This seems to have
been accidentally added in
30c1111.
Fixes https://bugs.debian.org/839771
Florian Forster [Wed, 28 Sep 2016 19:27:54 +0000 (21:27 +0200)]
src/daemon/plugin.[ch]: Make the user_data_t* const.
That is, user_data_t* passed to register_* functions. The actual callbacks
are still getting a user_data_t* since they, in theory, would be able to
modify the pointer stored in .data.
Issue: #1954
Florian Forster [Wed, 28 Sep 2016 19:23:49 +0000 (21:23 +0200)]
src/daemons/plugin.c: Don't modify user_data_t* in plugin_register_flush().
Fixes: #1954
Florian Forster [Wed, 28 Sep 2016 18:58:04 +0000 (20:58 +0200)]
Revert "write_graphite: remove #ifndefs"
This reverts commit
de80d27fe7023c2e377674b4cc341e539388b98e.
Fixes: #1953
Florian Forster [Wed, 28 Sep 2016 15:53:34 +0000 (17:53 +0200)]
write_http plugin: Don't register a flush callback unconditionally.
Fixes: #1955
Sebastian Harl [Sun, 25 Sep 2016 11:40:57 +0000 (13:40 +0200)]
Use readdir() instead of the deprecated readdir_r().
Cf. https://sourceware.org/ml/libc-alpha/2016-02/msg00093.html
Sebastian Harl [Sat, 24 Sep 2016 11:05:06 +0000 (13:05 +0200)]
RRDCacheD plugin: Improve various RRD-related error messages.
Sebastian Harl [Sat, 24 Sep 2016 10:55:40 +0000 (12:55 +0200)]
RRDCacheD plugin: Try to reconnect upon failed operations.
The RRD client library does not provide means to check the status of a
connection and there's no way to detect that the connection is broken after,
for example, the daemon restarted. To work around that, try to reconnect if
any client operation fails.
Reported via https://bugs.debian.org/657877
Chao Yang [Fri, 23 Sep 2016 14:48:53 +0000 (10:48 -0400)]
commom: Fixed AIX doesn't have MSG_DONTWAIT
Marc Fournier [Tue, 20 Sep 2016 19:23:09 +0000 (21:23 +0200)]
Merge branch 'collectd-5.4' into collectd-5.5
Florian Forster [Wed, 14 Sep 2016 07:00:00 +0000 (09:00 +0200)]
contrib/examples/myplugin.c: Fix copy and paste error.
Florian Forster [Tue, 13 Sep 2016 20:26:31 +0000 (22:26 +0200)]
Merge branch 'collectd-5.5' into collectd-5.6
Florian Forster [Tue, 13 Sep 2016 08:44:46 +0000 (10:44 +0200)]
curl_json plugin: Skip unexpected non-map values.
Assume, for example, the config `Key "*/foo"`. This config expects JSON
in the form:
{
"bar": {
"foo": 1337
}
}
If the available JSON is instead:
{
"error_code": 0,
"bar": {
"foo": 1337
}
}
the code will take a look at the zero associated with "error_code" and
determine that a map (with key "foo") is expected instead. Previously
the code would continue, eventually calling `cj_get_type()` which
expects that `key->type` is a valid pointer, resulting in a segmentation
fault.
This patch does three things to ensure that this segmentation fault does
not happen again:
1. `cj_get_type()` checks its argument to make sure it is valid before
dereferencing any pointers.
2. In case a non-map is found when a map is expected, the code will
return instead of limping on.
3. After calling `cj_cb_inc_array_index()`, which may update the key,
make sure that it actually did and that key is valid now.
Fixes: #1896