From 793e32648be9482e23b1333a9727c7b939f5a11e Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Mon, 23 Jan 2017 20:23:51 +0100 Subject: [PATCH] patches: add mqtt_invalid_symbols.patch --- debian/changelog | 2 ++ debian/patches/mqtt_invalid_symbols.patch | 26 +++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 29 insertions(+) create mode 100644 debian/patches/mqtt_invalid_symbols.patch diff --git a/debian/changelog b/debian/changelog index c3e61f6..434f19b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ collectd (5.7.1-1) UNRELEASED; urgency=medium * debian/patches: - drop dpdkstat-portable-format-string.patch, included upstream. - add mqtt_resource_leak.patch, fixing a connection leak. + - add mqtt_invalid_symbols.patch, stripping out invalid characters from + MQTT topic names. -- Marc Fournier Mon, 23 Jan 2017 09:23:07 +0100 diff --git a/debian/patches/mqtt_invalid_symbols.patch b/debian/patches/mqtt_invalid_symbols.patch new file mode 100644 index 0000000..5adce34 --- /dev/null +++ b/debian/patches/mqtt_invalid_symbols.patch @@ -0,0 +1,26 @@ +Description: mqtt plugin: Fix invalid symbols in topic name. +Author: Denys Fedoryshchenko + +diff --git a/src/mqtt.c b/src/mqtt.c +index 6b76af97b..8a24ccaa0 100644 +--- a/src/mqtt.c ++++ b/src/mqtt.c +@@ -462,6 +462,7 @@ static int format_topic(char *buf, size_t buf_len, data_set_t const *ds, + value_list_t const *vl, mqtt_client_conf_t *conf) { + char name[MQTT_MAX_TOPIC_SIZE]; + int status; ++ char *c; + + if ((conf->topic_prefix == NULL) || (conf->topic_prefix[0] == 0)) + return (FORMAT_VL(buf, buf_len, vl)); +@@ -474,6 +475,10 @@ static int format_topic(char *buf, size_t buf_len, data_set_t const *ds, + if ((status < 0) || (((size_t)status) >= buf_len)) + return (ENOMEM); + ++ while((c = strchr(buf, '#')) || (c = strchr(buf, '+'))) { ++ *c = '_'; ++ } ++ + return (0); + } /* int format_topic */ + diff --git a/debian/patches/series b/debian/patches/series index b0cc80c..afc72ed 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ collection_conf_path.patch myplugin_includes.patch nagios-debian-paths.patch mqtt_resource_leak.patch +mqtt_invalid_symbols.patch -- 2.30.2