Module: kamailio
Branch: master
Commit: f0e73eabee3be198dbad2e50752d9889e4aa8e5f
URL: 
https://github.com/kamailio/kamailio/commit/f0e73eabee3be198dbad2e50752d9889e4aa8e5f

Author: Victor Seva <linuxman...@torreviejawireless.org>
Committer: Victor Seva <linuxman...@torreviejawireless.org>
Date: 2024-02-02T15:21:39+01:00

db_mysql: fix build for older releases

> km_my_con.c: In function 'db_mysql_new_connection':
> km_my_con.c:132:4: warning: implicit declaration of function 'mysql_optionsv' 
> [-Wimplicit-function-declaration]
>      mysql_optionsv(ptr->con, MYSQL_OPT_SSL_ENFORCE, (void *)&(int){1});
>      ^~~~~~~~~~~~~~
> km_my_con.c:132:29: error: 'MYSQL_OPT_SSL_ENFORCE' undeclared (first use in 
> this function)
>     mysql_optionsv(ptr->con, MYSQL_OPT_SSL_ENFORCE, (void *)&(int){1});
>                              ^~~~~~~~~~~~~~~~~~~~~
> km_my_con.c:132:29: note: each undeclared identifier is reported only once 
> for each function it appears in
> ../../Makefile.rules:100: recipe for target 'km_my_con.o' failed

---

Modified: src/modules/db_mysql/km_my_con.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/f0e73eabee3be198dbad2e50752d9889e4aa8e5f.diff
Patch: 
https://github.com/kamailio/kamailio/commit/f0e73eabee3be198dbad2e50752d9889e4aa8e5f.patch

---

diff --git a/src/modules/db_mysql/km_my_con.c b/src/modules/db_mysql/km_my_con.c
index 88c950417a6..7a5d090352d 100644
--- a/src/modules/db_mysql/km_my_con.c
+++ b/src/modules/db_mysql/km_my_con.c
@@ -117,6 +117,7 @@ struct my_con *db_mysql_new_connection(const struct db_id 
*id)
        mysql_options(ptr->con, MYSQL_OPT_WRITE_TIMEOUT,
                        (const void *)&db_mysql_timeout_interval);
 
+#if MYSQL_VERSION_ID > 50710
 #ifdef MARIADB_BASE_VERSION
        /*
         * emulate SSL_MODE_XXXX from MySQL
@@ -141,7 +142,6 @@ struct my_con *db_mysql_new_connection(const struct db_id 
*id)
                        break;
        }
 #else
-#if MYSQL_VERSION_ID > 50710
        if(db_mysql_opt_ssl_mode != 0) {
                unsigned int optuint = 0;
                if(db_mysql_opt_ssl_mode == 1) {
@@ -155,6 +155,7 @@ struct my_con *db_mysql_new_connection(const struct db_id 
*id)
                }
                mysql_options(ptr->con, MYSQL_OPT_SSL_MODE, (const void 
*)&optuint);
        }
+#endif /* MARIADB_BASE_VERSION */
 #else
        if(db_mysql_opt_ssl_mode != 0) {
                LM_WARN("ssl mode not supported by mysql version (value %u) - "
@@ -162,7 +163,6 @@ struct my_con *db_mysql_new_connection(const struct db_id 
*id)
                                (unsigned int)db_mysql_opt_ssl_mode);
        }
 #endif /* MYSQL_VERSION_ID */
-#endif /* MARIADB_BASE_VERSION */
 
 #if MYSQL_VERSION_ID > 50012
        /* set reconnect flag if enabled */

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to