1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
|