summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Helmert III <ajak@gentoo.org>2021-04-24 20:48:40 -0500
committerJohn Helmert III <ajak@gentoo.org>2021-04-24 20:50:28 -0500
commit4abf217d4186500972a49e636d2b878e1a69110b (patch)
tree2c5785c89c91d407e60cafc0d0ea60247c6f2baa /net-analyzer
parentsys-process/incron: Fix crash when accessing path of.. (diff)
downloadgentoo-4abf217d4186500972a49e636d2b878e1a69110b.tar.gz
gentoo-4abf217d4186500972a49e636d2b878e1a69110b.tar.bz2
gentoo-4abf217d4186500972a49e636d2b878e1a69110b.zip
net-analyzer/pmacct: fix mysql crash
Reported-by: Göran Bruns <goeran@brunsware.de> Signed-off-by: John Helmert III <ajak@gentoo.org>
Diffstat (limited to 'net-analyzer')
-rw-r--r--net-analyzer/pmacct/files/pmacct-1.7.6-fix-mysql-crash.patch26
-rw-r--r--net-analyzer/pmacct/pmacct-1.7.6-r1.ebuild99
2 files changed, 125 insertions, 0 deletions
diff --git a/net-analyzer/pmacct/files/pmacct-1.7.6-fix-mysql-crash.patch b/net-analyzer/pmacct/files/pmacct-1.7.6-fix-mysql-crash.patch
new file mode 100644
index 000000000000..b76ce8761326
--- /dev/null
+++ b/net-analyzer/pmacct/files/pmacct-1.7.6-fix-mysql-crash.patch
@@ -0,0 +1,26 @@
+From 1922062277d87da024938cc3057df9a4c3725e76 Mon Sep 17 00:00:00 2001
+From: Paolo Lucente <pl+github@pmacct.net>
+Date: Sun, 28 Feb 2021 02:51:10 +0000
+Subject: [PATCH] * fix, MySQL plugin: check for 'unix:' string only if
+ sql_host is supplied
+
+---
+ src/mysql_plugin.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/mysql_plugin.c b/src/mysql_plugin.c
+index 7f5179abd..dce117732 100644
+--- a/src/mysql_plugin.c
++++ b/src/mysql_plugin.c
+@@ -695,7 +695,10 @@ void MY_DB_Connect(struct DBdesc *db, char *host)
+ mysql_options(db->desc, MYSQL_OPT_RECONNECT, &reconnect);
+ if (config.sql_conn_ca_file) mysql_ssl_set(db->desc, NULL, NULL, config.sql_conn_ca_file, NULL, NULL);
+
+- usp = strstr(host, "unix:");
++ if (host) {
++ usp = strstr(host, "unix:");
++ }
++
+ if (usp && usp == host) {
+ usp += 5; /* go right past the 'unix:' string */
+ mysql_ret = mysql_real_connect(db->desc, NULL, config.sql_user, config.sql_passwd, config.sql_db, FALSE, usp, 0);
diff --git a/net-analyzer/pmacct/pmacct-1.7.6-r1.ebuild b/net-analyzer/pmacct/pmacct-1.7.6-r1.ebuild
new file mode 100644
index 000000000000..2f066465acba
--- /dev/null
+++ b/net-analyzer/pmacct/pmacct-1.7.6-r1.ebuild
@@ -0,0 +1,99 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools flag-o-matic toolchain-funcs
+
+DESCRIPTION="A network tool to gather IP traffic information"
+HOMEPAGE="http://www.pmacct.net/"
+SRC_URI="http://www.pmacct.net/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="
+ +bgp-bins +bmp-bins geoip geoipv2 jansson kafka +l2 mysql ndpi nflog
+ postgres rabbitmq sqlite +st-bins +traffic-bins zmq
+"
+REQUIRED_USE="
+ ?? ( geoip geoipv2 )
+ kafka? ( jansson )
+ rabbitmq? ( jansson )
+"
+
+RDEPEND="dev-libs/libcdada
+ net-libs/libpcap
+ geoip? ( dev-libs/geoip )
+ geoipv2? ( dev-libs/libmaxminddb )
+ jansson? ( dev-libs/jansson )
+ kafka? ( dev-libs/librdkafka )
+ mysql? (
+ dev-db/mysql-connector-c:0=
+ sys-process/numactl
+ )
+ ndpi? ( >=net-libs/nDPI-3.2:= )
+ nflog? ( net-libs/libnetfilter_log )
+ postgres? ( dev-db/postgresql:* )
+ rabbitmq? ( net-libs/rabbitmq-c )
+ sqlite? ( =dev-db/sqlite-3* )
+ zmq? ( >=net-libs/zeromq-4.2.0:= )"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-1.7.4--Werror.patch"
+ "${FILESDIR}/${PN}-1.7.6-nogit.patch"
+ "${FILESDIR}/${P}-fix-mysql-crash.patch"
+)
+
+DOCS=(
+ CONFIG-KEYS ChangeLog FAQS QUICKSTART UPGRADE
+ docs/INTERNALS docs/PLUGINS docs/SIGNALS
+)
+
+src_prepare() {
+ default
+ eautoreconf
+}
+
+src_configure() {
+ tc-export CC AR RANLIB
+ append-cflags -fcommon
+
+ econf \
+ $(use_enable bgp-bins) \
+ $(use_enable bmp-bins) \
+ $(use_enable geoip) \
+ $(use_enable geoipv2) \
+ $(use_enable jansson) \
+ $(use_enable kafka) \
+ $(use_enable l2) \
+ $(use_enable mysql) \
+ $(use_enable ndpi) \
+ $(use_enable nflog) \
+ $(use_enable postgres pgsql) \
+ $(use_enable rabbitmq) \
+ $(use_enable sqlite sqlite3) \
+ $(use_enable st-bins) \
+ $(use_enable traffic-bins) \
+ $(use_enable zmq) \
+ --without-external-deps \
+ --disable-debug \
+ --disable-mongodb
+}
+
+src_install() {
+ default
+
+ for dirname in examples sql telemetry; do
+ docinto ${dirname}
+ dodoc -r ${dirname}/*
+ done
+
+ newinitd "${FILESDIR}"/pmacctd-init.d pmacctd
+ newconfd "${FILESDIR}"/pmacctd-conf.d pmacctd
+
+ insinto /etc/pmacctd
+ newins examples/pmacctd-imt.conf.example pmacctd.conf
+}