From 8bf6aeee547bdbcffaa138145c77de286f35106a Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 27 Aug 2009 23:44:54 +0200 Subject: [PATCH] patches: Added bts535787-powerdns-fix-localsocket.dpatch. This is an upstream patch fixing the handling of the LocalSocket config option of the powerdns plugin. Thanks to Thomas Morgan for reporting this and Luke Heberling for providing a patch. References: #535787 --- debian/changelog | 6 ++- debian/patches/00list | 1 + .../bts535787-powerdns-fix-localsocket.dpatch | 54 +++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100755 debian/patches/bts535787-powerdns-fix-localsocket.dpatch diff --git a/debian/changelog b/debian/changelog index 8ac3a6b..e6d6936 100644 --- a/debian/changelog +++ b/debian/changelog @@ -46,6 +46,10 @@ collectd (4.7.2-1) unstable; urgency=low - Added curl-followlocation.dpatch - upstream patch to let plugins using libcurl follow HTTP redirects; thanks to Joey Hess for reporting this (Closes: #541953). + - Added bts535787-powerdns-fix-localsocket.dpatch - upstream patch fixing + the handling of the LocalSocket config option of the powerdns plugin; + thanks to Thomas Morgan for reporting this and Luke Heberling for + providing a patch (references: #535787). * debian/README.Debian: - Removed the note about how to get collectd2html.pl working with version 4 of collectd - the script now supports the --recursive option @@ -63,7 +67,7 @@ collectd (4.7.2-1) unstable; urgency=low - Set the 'apache' plugin's URL according to the default used by Debian's Apache; thanks to Joey Hess for reporting this (Closes: #541888). - -- Sebastian Harl Thu, 27 Aug 2009 23:29:41 +0200 + -- Sebastian Harl Thu, 27 Aug 2009 23:41:50 +0200 collectd (4.6.3-1) unstable; urgency=low diff --git a/debian/patches/00list b/debian/patches/00list index cdf98cf..06e05c4 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -5,4 +5,5 @@ libvirt-reconnect.dpatch plugin-fix-unregister.dpatch java-fix-jvm-start.dpatch curl-followlocation.dpatch +bts535787-powerdns-fix-localsocket.dpatch diff --git a/debian/patches/bts535787-powerdns-fix-localsocket.dpatch b/debian/patches/bts535787-powerdns-fix-localsocket.dpatch new file mode 100755 index 0000000..c113aad --- /dev/null +++ b/debian/patches/bts535787-powerdns-fix-localsocket.dpatch @@ -0,0 +1,54 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## bts535787-powerdns-fix-localsocket.dpatch by Luke Heberling +## +## +## DP: powerdns plugin: Fixed handling of the LocalSocket option. + +@DPATCH@ + +diff a/src/powerdns.c b/src/powerdns.c +--- a/src/powerdns.c ++++ b/src/powerdns.c +@@ -380,6 +380,18 @@ static int powerdns_get_data_dgram (list_item_t *item, /* {{{ */ + break; + } + ++ struct timeval timeout; ++ timeout.tv_sec=2; ++ if (timeout.tv_sec < interval_g * 3 / 4) ++ timeout.tv_sec = interval_g * 3 / 4; ++ timeout.tv_usec=0; ++ status = setsockopt (sd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof (timeout)); ++ if (status != 0) ++ { ++ FUNC_ERROR ("setsockopt"); ++ break; ++ } ++ + status = connect (sd, (struct sockaddr *) &item->sockaddr, + sizeof (item->sockaddr)); + if (status != 0) +@@ -911,11 +923,18 @@ static int powerdns_config (oconfig_item_t *ci) /* {{{ */ + powerdns_config_add_server (option); + else if (strcasecmp ("LocalSocket", option->key) == 0) + { +- char *temp = strdup (option->key); +- if (temp == NULL) +- return (1); +- sfree (local_sockpath); +- local_sockpath = temp; ++ if ((option->values_num != 1) || (option->values[0].type != OCONFIG_TYPE_STRING)) ++ { ++ WARNING ("powerdns plugin: `%s' needs exactly one string argument.", option->key); ++ } ++ else ++ { ++ char *temp = strdup (option->values[0].value.string); ++ if (temp == NULL) ++ return (1); ++ sfree (local_sockpath); ++ local_sockpath = temp; ++ } + } + else + { -- 2.30.2