Module: kamailio
Branch: master
Commit: 5b727447df9f5476c2ef818a8926f62525d0c349
URL:
https://github.com/kamailio/kamailio/commit/5b727447df9f5476c2ef818a8926f62…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-06-14T12:15:00+02:00
db_mysql: mariadb client library does not support ssl mode option
---
Modified: src/modules/db_mysql/km_my_con.c
Modified: src/modules/db_mysql/my_con.c
---
Diff:
https://github.com/kamailio/kamailio/commit/5b727447df9f5476c2ef818a8926f62…
Patch:
https://github.com/kamailio/kamailio/commit/5b727447df9f5476c2ef818a8926f62…
---
diff --git a/src/modules/db_mysql/km_my_con.c b/src/modules/db_mysql/km_my_con.c
index 324e707e5b..edfbb58caf 100644
--- a/src/modules/db_mysql/km_my_con.c
+++ b/src/modules/db_mysql/km_my_con.c
@@ -116,6 +116,7 @@ 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(db_mysql_opt_ssl_mode!=0) {
if(db_mysql_opt_ssl_mode==1) {
@@ -129,6 +130,19 @@ struct my_con* db_mysql_new_connection(const struct db_id* id)
}
mysql_options(ptr->con, MYSQL_OPT_SSL_MODE, (const void*)&optuint);
}
+#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);
+ }
#endif
#if MYSQL_VERSION_ID > 50012
/* set reconnect flag if enabled */
diff --git a/src/modules/db_mysql/my_con.c b/src/modules/db_mysql/my_con.c
index 349595ee8f..df4d2df9db 100644
--- a/src/modules/db_mysql/my_con.c
+++ b/src/modules/db_mysql/my_con.c
@@ -72,6 +72,7 @@ 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(db_mysql_opt_ssl_mode!=0) {
if(db_mysql_opt_ssl_mode==1) {
@@ -85,6 +86,19 @@ int my_con_connect(db_con_t* con)
}
mysql_options(mcon->con, MYSQL_OPT_SSL_MODE, (const void*)&optuint);
}
+#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);
+ }
#endif
#if MYSQL_VERSION_ID >= 40101