Merge pull request #2278 from octo/ff/perl
perl plugin: Fix potential double-free.
perl plugin: Fix potential double-free.
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.
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.
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
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
fix BIND timezone parsing issue
collectd.conf(5): Add section documenting the ignorelist functionality.
Fixes: #2267
Fixes: #2267
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>
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>
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.
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.
Merge pull request #2204 from collectd/check-for-cap-is-supported
Check for the CAP_IS_SUPPORTED macro
Check for the CAP_IS_SUPPORTED macro
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
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
look for cap_get_proc instead of cap_get_bound
a2ddc38 switched the capability check from cap_get_bound() to
cap_get_proc()
a2ddc38 switched the capability check from cap_get_bound() to
cap_get_proc()
Merge pull request #2151 from mfournier/check_capability-rewrite-fix
daemon/common.c: Fix check_capability() by using cap_get_proc()
daemon/common.c: Fix check_capability() by using cap_get_proc()
smart: log warning if CAP_SYS_RAWIO is missing
Related to #2143
Related to #2143
Merge pull request #2192 from maryamtahhan/bugfix_regex_memleak
fix for memory leak in utils_match.c
fix for memory leak in utils_match.c
fix for memory leak in utils_match.c
Change-Id: I058afae8c0a99115bda70e125840fc6bd224b358
Signed-off-by: Krzysztof Matczak <krzysztofx.matczak@intel.com>
Change-Id: I058afae8c0a99115bda70e125840fc6bd224b358
Signed-off-by: Krzysztof Matczak <krzysztofx.matczak@intel.com>
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.
... as the message the user would be looking for can be found on
stderr/stdout or in any configured logfile.
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
This prevents early startup log messages from going unnoticed if the
default logfile isn't writeable.
Fixes: #2057
collectd.spec: enable XFS support in df plugin
Fixes #2178
Fixes #2178
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
libesmtp takes care of this.
Pointed out by https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852924
daemon/common.c: Fix check_capability() by using cap_get_proc()
Rewrite this function, as 58acba67f made it a no-op.
Rewrite this function, as 58acba67f made it a no-op.
mqtt plugin: Fix invalid symbols in topic name.
mqtt plugin: Fix resource leak.
Fixes: #2123
Fixes: #2123
collectd.spec: ensure write_riemann build deps are installed
collectd.spec: fixes to previous commit
collectd.spec: re-enable write_riemann on EL7, as build dep is now available in EPEL7
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.
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.
Auto-Merge pull request #2099 from tokkee/sh/booleans
Automatically merged due to "Automerge" label
Automatically merged due to "Automerge" label
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
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
smart plugin: Refactor, demote warnings to debug.
Fixes: #2062
Fixes: #2062
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
Previously, negative numbers would be truncated to "ffffffff" by the
buffer length on architectures where longs are 64 bit.
Fixes: #2074
src/daemon/utils_random.[ch]: Implement cdrand_u().
Bump version to 5.6.1; Update ChangeLog.
Collected podtypo
collectd.spec: also disable write_redis on EL6
This plugin also depends on the hiredis library, which was retired from
EPEL6.
This plugin also depends on the hiredis library, which was retired from
EPEL6.
Merge branch 'collectd-5.5' into collectd-5.6
Conflicts:
contrib/redhat/collectd.spec
Conflicts:
contrib/redhat/collectd.spec
collectd.spec: disable redis plugin on EL6
hiredis has been retired from EPEL6
hiredis has been retired from EPEL6
collectd.spec: disable redis plugin on EL6
More reformatting.
No idea why the previous round missed these files.
No idea why the previous round missed these files.
Tree wide: Reformat with clang-format.
Merge branch 'collectd-5.5' into collectd-5.6
Bump version to 5.5.3; Update ChangeLog.
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.
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.
contrib/README: sort items
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.
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.
Merge branch 'collectd-5.5' into collectd-5.6
Merge remote-tracking branch 'github/pr/2026' into collectd-5.5
apcups plugin: Skip metrics not reported by the UPS.
Fixes: #2025
Fixes: #2025
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
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
Merge remote-tracking branch 'github/pr/2027' into collectd-5.5
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;
^
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;
^
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.
* 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.
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
^
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
^
Merge branch 'collectd-5.5' into collectd-5.6
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
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
battery plugin: Fix type in a warning.
zfs_arc: remove double metric
I accidentally added prefetch_metadata_misses in 61635f3 but we
already had that metric.
Fixes #1963
I accidentally added prefetch_metadata_misses in 61635f3 but we
already had that metric.
Fixes #1963
Merge remote-tracking branch 'github/pr/2012' into collectd-5.6
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
When plugin loaded without configuration, it starts to spam logs with message
'read-function of plugin `openvpn' failed'.
Issue: #1932
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
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
write_kafka plugin: Reintroduce the "Key Random" setting.
Fixes: #1977
Fixes: #1977
Merge pull request #2005 from rpv-tomsk/issue-1996
write_http: Fixed DS type check
write_http: Fixed DS type check
write_http: Fixed DS type check
Closes: #1996
Closes: #1996
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>
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>
utils_format_graphite: terminate buffer with \0
Signed-off-by: Florian Forster <octo@collectd.org>
Signed-off-by: Florian Forster <octo@collectd.org>
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>
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>
Merge branch 'collectd-5.5' into collectd-5.6
fix one typo spotted by Debian's lintian tool
fix a couple of typos spotted by Debian's lintian tool
collectd.spec: increment changelog to mention 5.6.1
Bump version number in redhat spec
Merge remote-tracking branch 'github/pr/1958' into collectd-5.5
Bump version to 5.6.1; Update ChangeLog.
Merge branch 'collectd-5.5' into collectd-5.6
Merge remote-tracking branch 'github/pr/1961' into collectd-5.5
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
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
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
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
src/daemons/plugin.c: Don't modify user_data_t* in plugin_register_flush().
Fixes: #1954
Fixes: #1954
Revert "write_graphite: remove #ifndefs"
This reverts commit de80d27fe7023c2e377674b4cc341e539388b98e.
Fixes: #1953
This reverts commit de80d27fe7023c2e377674b4cc341e539388b98e.
Fixes: #1953
write_http plugin: Don't register a flush callback unconditionally.
Fixes: #1955
Fixes: #1955
Use readdir() instead of the deprecated readdir_r().
Cf. https://sourceware.org/ml/libc-alpha/2016-02/msg00093.html
Cf. https://sourceware.org/ml/libc-alpha/2016-02/msg00093.html
RRDCacheD plugin: Improve various RRD-related error messages.
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
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
commom: Fixed AIX doesn't have MSG_DONTWAIT
Merge branch 'collectd-5.4' into collectd-5.5
contrib/examples/myplugin.c: Fix copy and paste error.
Merge branch 'collectd-5.5' into collectd-5.6
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
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
collectd.conf(5): Document the semantics of the "TypesDB" option in more detail.
Fixed: #1241
Fixed: #1241
contrib/migrate-4-5.px: Don't convert "ps_code" and "ps_data" to derive.
Fixes: #1687
Fixes: #1687
Add missing option to write_graphite example
Signed-off-by: Florian Forster <octo@collectd.org>
Signed-off-by: Florian Forster <octo@collectd.org>
apache plugin: End statements with semi-colons.
If only I knew why this wasn't considered a syntax error …
If only I knew why this wasn't considered a syntax error …
Bump version to 5.6.0; Update ChangeLog.
Merge branch 'collectd-5.5' into collectd-5.6
src/types.db: Remove minimum value from "power".
The battery plugin reports negative power when the battery is discharging.
The battery plugin reports negative power when the battery is discharging.
Merge branch 'collectd-5.5' into collectd-5.6
Merge remote-tracking branch 'github/pr/1909' into collectd-5.5
Merge branch 'collectd-5.5' into collectd-5.6
target_set.c: rename 'MetaDataSet' option
Fixes #1910
Fixes #1910
plugin_dispatch_multivalue: Submit NAN when computing percantage of an empty set.