1 |
commit: 4abf217d4186500972a49e636d2b878e1a69110b |
2 |
Author: John Helmert III <ajak <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Apr 25 01:48:40 2021 +0000 |
4 |
Commit: John Helmert III <ajak <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 25 01:50:28 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4abf217d |
7 |
|
8 |
net-analyzer/pmacct: fix mysql crash |
9 |
|
10 |
Reported-by: Göran Bruns <goeran <AT> brunsware.de> |
11 |
Signed-off-by: John Helmert III <ajak <AT> gentoo.org> |
12 |
|
13 |
.../files/pmacct-1.7.6-fix-mysql-crash.patch | 26 ++++++ |
14 |
net-analyzer/pmacct/pmacct-1.7.6-r1.ebuild | 99 ++++++++++++++++++++++ |
15 |
2 files changed, 125 insertions(+) |
16 |
|
17 |
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 |
18 |
new file mode 100644 |
19 |
index 00000000000..b76ce876132 |
20 |
--- /dev/null |
21 |
+++ b/net-analyzer/pmacct/files/pmacct-1.7.6-fix-mysql-crash.patch |
22 |
@@ -0,0 +1,26 @@ |
23 |
+From 1922062277d87da024938cc3057df9a4c3725e76 Mon Sep 17 00:00:00 2001 |
24 |
+From: Paolo Lucente <pl+github@××××××.net> |
25 |
+Date: Sun, 28 Feb 2021 02:51:10 +0000 |
26 |
+Subject: [PATCH] * fix, MySQL plugin: check for 'unix:' string only if |
27 |
+ sql_host is supplied |
28 |
+ |
29 |
+--- |
30 |
+ src/mysql_plugin.c | 5 ++++- |
31 |
+ 1 file changed, 4 insertions(+), 1 deletion(-) |
32 |
+ |
33 |
+diff --git a/src/mysql_plugin.c b/src/mysql_plugin.c |
34 |
+index 7f5179abd..dce117732 100644 |
35 |
+--- a/src/mysql_plugin.c |
36 |
++++ b/src/mysql_plugin.c |
37 |
+@@ -695,7 +695,10 @@ void MY_DB_Connect(struct DBdesc *db, char *host) |
38 |
+ mysql_options(db->desc, MYSQL_OPT_RECONNECT, &reconnect); |
39 |
+ if (config.sql_conn_ca_file) mysql_ssl_set(db->desc, NULL, NULL, config.sql_conn_ca_file, NULL, NULL); |
40 |
+ |
41 |
+- usp = strstr(host, "unix:"); |
42 |
++ if (host) { |
43 |
++ usp = strstr(host, "unix:"); |
44 |
++ } |
45 |
++ |
46 |
+ if (usp && usp == host) { |
47 |
+ usp += 5; /* go right past the 'unix:' string */ |
48 |
+ mysql_ret = mysql_real_connect(db->desc, NULL, config.sql_user, config.sql_passwd, config.sql_db, FALSE, usp, 0); |
49 |
|
50 |
diff --git a/net-analyzer/pmacct/pmacct-1.7.6-r1.ebuild b/net-analyzer/pmacct/pmacct-1.7.6-r1.ebuild |
51 |
new file mode 100644 |
52 |
index 00000000000..2f066465acb |
53 |
--- /dev/null |
54 |
+++ b/net-analyzer/pmacct/pmacct-1.7.6-r1.ebuild |
55 |
@@ -0,0 +1,99 @@ |
56 |
+# Copyright 1999-2021 Gentoo Authors |
57 |
+# Distributed under the terms of the GNU General Public License v2 |
58 |
+ |
59 |
+EAPI=7 |
60 |
+ |
61 |
+inherit autotools flag-o-matic toolchain-funcs |
62 |
+ |
63 |
+DESCRIPTION="A network tool to gather IP traffic information" |
64 |
+HOMEPAGE="http://www.pmacct.net/" |
65 |
+SRC_URI="http://www.pmacct.net/${P}.tar.gz" |
66 |
+ |
67 |
+LICENSE="GPL-2" |
68 |
+SLOT="0" |
69 |
+KEYWORDS="~amd64 ~x86" |
70 |
+IUSE=" |
71 |
+ +bgp-bins +bmp-bins geoip geoipv2 jansson kafka +l2 mysql ndpi nflog |
72 |
+ postgres rabbitmq sqlite +st-bins +traffic-bins zmq |
73 |
+" |
74 |
+REQUIRED_USE=" |
75 |
+ ?? ( geoip geoipv2 ) |
76 |
+ kafka? ( jansson ) |
77 |
+ rabbitmq? ( jansson ) |
78 |
+" |
79 |
+ |
80 |
+RDEPEND="dev-libs/libcdada |
81 |
+ net-libs/libpcap |
82 |
+ geoip? ( dev-libs/geoip ) |
83 |
+ geoipv2? ( dev-libs/libmaxminddb ) |
84 |
+ jansson? ( dev-libs/jansson ) |
85 |
+ kafka? ( dev-libs/librdkafka ) |
86 |
+ mysql? ( |
87 |
+ dev-db/mysql-connector-c:0= |
88 |
+ sys-process/numactl |
89 |
+ ) |
90 |
+ ndpi? ( >=net-libs/nDPI-3.2:= ) |
91 |
+ nflog? ( net-libs/libnetfilter_log ) |
92 |
+ postgres? ( dev-db/postgresql:* ) |
93 |
+ rabbitmq? ( net-libs/rabbitmq-c ) |
94 |
+ sqlite? ( =dev-db/sqlite-3* ) |
95 |
+ zmq? ( >=net-libs/zeromq-4.2.0:= )" |
96 |
+DEPEND="${RDEPEND}" |
97 |
+BDEPEND="virtual/pkgconfig" |
98 |
+ |
99 |
+PATCHES=( |
100 |
+ "${FILESDIR}/${PN}-1.7.4--Werror.patch" |
101 |
+ "${FILESDIR}/${PN}-1.7.6-nogit.patch" |
102 |
+ "${FILESDIR}/${P}-fix-mysql-crash.patch" |
103 |
+) |
104 |
+ |
105 |
+DOCS=( |
106 |
+ CONFIG-KEYS ChangeLog FAQS QUICKSTART UPGRADE |
107 |
+ docs/INTERNALS docs/PLUGINS docs/SIGNALS |
108 |
+) |
109 |
+ |
110 |
+src_prepare() { |
111 |
+ default |
112 |
+ eautoreconf |
113 |
+} |
114 |
+ |
115 |
+src_configure() { |
116 |
+ tc-export CC AR RANLIB |
117 |
+ append-cflags -fcommon |
118 |
+ |
119 |
+ econf \ |
120 |
+ $(use_enable bgp-bins) \ |
121 |
+ $(use_enable bmp-bins) \ |
122 |
+ $(use_enable geoip) \ |
123 |
+ $(use_enable geoipv2) \ |
124 |
+ $(use_enable jansson) \ |
125 |
+ $(use_enable kafka) \ |
126 |
+ $(use_enable l2) \ |
127 |
+ $(use_enable mysql) \ |
128 |
+ $(use_enable ndpi) \ |
129 |
+ $(use_enable nflog) \ |
130 |
+ $(use_enable postgres pgsql) \ |
131 |
+ $(use_enable rabbitmq) \ |
132 |
+ $(use_enable sqlite sqlite3) \ |
133 |
+ $(use_enable st-bins) \ |
134 |
+ $(use_enable traffic-bins) \ |
135 |
+ $(use_enable zmq) \ |
136 |
+ --without-external-deps \ |
137 |
+ --disable-debug \ |
138 |
+ --disable-mongodb |
139 |
+} |
140 |
+ |
141 |
+src_install() { |
142 |
+ default |
143 |
+ |
144 |
+ for dirname in examples sql telemetry; do |
145 |
+ docinto ${dirname} |
146 |
+ dodoc -r ${dirname}/* |
147 |
+ done |
148 |
+ |
149 |
+ newinitd "${FILESDIR}"/pmacctd-init.d pmacctd |
150 |
+ newconfd "${FILESDIR}"/pmacctd-conf.d pmacctd |
151 |
+ |
152 |
+ insinto /etc/pmacctd |
153 |
+ newins examples/pmacctd-imt.conf.example pmacctd.conf |
154 |
+} |