Module: kamailio
Branch: master
Commit: c5acc58863acb133748ad9f2f8a963ab714af871
URL:
https://github.com/kamailio/kamailio/commit/c5acc58863acb133748ad9f2f8a963a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-06-15T09:09:53+02:00
db_mysql: use MARIADB_BASE_VERSION macro to check for MariaDB library
---
Modified: src/modules/db_mysql/km_my_con.c
Modified: src/modules/db_mysql/my_con.c
---
Diff:
https://github.com/kamailio/kamailio/commit/c5acc58863acb133748ad9f2f8a963a…
Patch:
https://github.com/kamailio/kamailio/commit/c5acc58863acb133748ad9f2f8a963a…
---
diff --git a/src/modules/db_mysql/km_my_con.c b/src/modules/db_mysql/km_my_con.c
index edfbb58caf..fb4f7dd5af 100644
--- a/src/modules/db_mysql/km_my_con.c
+++ b/src/modules/db_mysql/km_my_con.c
@@ -51,7 +51,6 @@ struct my_con* db_mysql_new_connection(const struct db_id* id)
struct my_con* ptr;
char *host, *grp, *egrp;
unsigned int connection_flag = 0;
- unsigned int optuint = 0;
#if MYSQL_VERSION_ID > 50012
#if MYSQL_VERSION_ID > 80000 && ! defined MARIADB_BASE_VERSION
@@ -116,9 +115,9 @@ struct my_con* db_mysql_new_connection(const struct db_id* id)
mysql_options(ptr->con, MYSQL_OPT_CONNECT_TIMEOUT, (const
void*)&db_mysql_timeout_interval);
mysql_options(ptr->con, MYSQL_OPT_READ_TIMEOUT, (const
void*)&db_mysql_timeout_interval);
mysql_options(ptr->con, MYSQL_OPT_WRITE_TIMEOUT, (const
void*)&db_mysql_timeout_interval);
-#ifndef LIBMARIADB
-#if MYSQL_VERSION_ID > 50710
+#if MYSQL_VERSION_ID > 50710 && !defined(MARIADB_BASE_VERSION)
if(db_mysql_opt_ssl_mode!=0) {
+ unsigned int optuint = 0;
if(db_mysql_opt_ssl_mode==1) {
if(db_mysql_opt_ssl_mode!=SSL_MODE_DISABLED) {
LM_WARN("ssl mode disabled is not 1 (value %u) - enforcing\n",
@@ -132,18 +131,11 @@ struct my_con* db_mysql_new_connection(const struct db_id* id)
}
#else
if(db_mysql_opt_ssl_mode!=0) {
- optuint = (unsigned int)db_mysql_opt_ssl_mode;
LM_WARN("ssl mode not supported by mysql version (value %u) - ignoring\n",
- optuint);
- }
-#endif
-#else
- if(db_mysql_opt_ssl_mode!=0) {
- optuint = (unsigned int)db_mysql_opt_ssl_mode;
- LM_WARN("ssl mode not supported by mariadb (value %u) - ignoring\n",
- optuint);
+ (unsigned int)db_mysql_opt_ssl_mode);
}
#endif
+
#if MYSQL_VERSION_ID > 50012
/* set reconnect flag if enabled */
if (db_mysql_auto_reconnect) {
diff --git a/src/modules/db_mysql/my_con.c b/src/modules/db_mysql/my_con.c
index df4d2df9db..2405468089 100644
--- a/src/modules/db_mysql/my_con.c
+++ b/src/modules/db_mysql/my_con.c
@@ -55,7 +55,6 @@ int my_con_connect(db_con_t* con)
{
struct my_con* mcon;
struct my_uri* muri;
- unsigned int optuint = 0;
mcon = DB_GET_PAYLOAD(con);
muri = DB_GET_PAYLOAD(con->uri);
@@ -72,9 +71,9 @@ int my_con_connect(db_con_t* con)
(const void*)&my_connect_to))
WARN("failed to set MYSQL_OPT_CONNECT_TIMEOUT\n");
}
-#ifndef LIBMARIADB
-#if MYSQL_VERSION_ID > 50710
+#if MYSQL_VERSION_ID > 50710 && !defined(MARIADB_BASE_VERSION)
if(db_mysql_opt_ssl_mode!=0) {
+ unsigned int optuint = 0;
if(db_mysql_opt_ssl_mode==1) {
if(db_mysql_opt_ssl_mode!=SSL_MODE_DISABLED) {
LM_WARN("ssl mode disabled is not 1 (value %u) - enforcing\n",
@@ -88,16 +87,8 @@ int my_con_connect(db_con_t* con)
}
#else
if(db_mysql_opt_ssl_mode!=0) {
- optuint = (unsigned int)db_mysql_opt_ssl_mode;
LM_WARN("ssl mode not supported by mysql version (value %u) - ignoring\n",
- optuint);
- }
-#endif
-#else
- if(db_mysql_opt_ssl_mode!=0) {
- optuint = (unsigned int)db_mysql_opt_ssl_mode;
- LM_WARN("ssl mode not supported by mariadb (value %u) - ignoring\n",
- optuint);
+ (unsigned int)db_mysql_opt_ssl_mode);
}
#endif