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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2025-12-05T09:16:08+01:00

ndb_redis: warnings on tls related params when module is not compiled with such 
support

---

Modified: src/modules/ndb_redis/ndb_redis_mod.c
Modified: src/modules/ndb_redis/redis_client.c

---

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

---

diff --git a/src/modules/ndb_redis/ndb_redis_mod.c 
b/src/modules/ndb_redis/ndb_redis_mod.c
index c3ac9eb3cfa..3e5c8aa371c 100644
--- a/src/modules/ndb_redis/ndb_redis_mod.c
+++ b/src/modules/ndb_redis/ndb_redis_mod.c
@@ -56,9 +56,7 @@ int redis_allowed_timeouts_param = -1;
 int redis_flush_on_reconnect_param = 0;
 int redis_allow_dynamic_nodes_param = 0;
 int ndb_redis_debug = L_DBG;
-#ifdef WITH_SSL
 char *ndb_redis_ca_path = 0;
-#endif
 
 static int w_redis_cmd3(
                struct sip_msg *msg, char *ssrv, char *scmd, char *sres);
@@ -142,9 +140,8 @@ static param_export_t params[] = {
        {"flush_on_reconnect", PARAM_INT, &redis_flush_on_reconnect_param},
        {"allow_dynamic_nodes", PARAM_INT, &redis_allow_dynamic_nodes_param},
        {"debug", PARAM_INT, &ndb_redis_debug},
-#ifdef WITH_SSL
        {"ca_path", PARAM_STRING, &ndb_redis_ca_path},
-#endif
+
        {0, 0, 0}
 };
 
@@ -172,6 +169,12 @@ static int mod_init(void)
         * with the special rank PROC_POSTCHILDINIT by main attendant
         */
        ksr_module_set_flag(KSRMOD_FLAG_POSTCHILDINIT);
+#ifndef WITH_SSL
+       if(ndb_redis_ca_path != NULL) {
+               LM_WARN("CA path parameter is set, but the module is not 
compiled with "
+                               "SSL/TLS support\n");
+       }
+#endif
        return 0;
 }
 
diff --git a/src/modules/ndb_redis/redis_client.c 
b/src/modules/ndb_redis/redis_client.c
index aab2db2a09a..78a00cff6c5 100644
--- a/src/modules/ndb_redis/redis_client.c
+++ b/src/modules/ndb_redis/redis_client.c
@@ -64,12 +64,10 @@ extern int redis_allowed_timeouts_param;
 extern int redis_flush_on_reconnect_param;
 extern int redis_allow_dynamic_nodes_param;
 extern int ndb_redis_debug;
-#ifdef WITH_SSL
 extern char *ndb_redis_ca_path;
-#endif
 
 /* backwards compatibility with hiredis < 0.12 */
-#if (HIREDIS_MAJOR == 0) && (HIREDIS_MINOR < 12)
+#if(HIREDIS_MAJOR == 0) && (HIREDIS_MINOR < 12)
 typedef char *sds;
 sds sdscatlen(sds s, const void *t, size_t len);
 int redis_append_formatted_command(
@@ -103,9 +101,7 @@ int redisc_init(void)
        char addr[256], pass[256], unix_sock_path[256], sentinel_group[256];
 
        unsigned int port, db, sock = 0, haspass = 0, sentinel_master = 1;
-#ifdef WITH_SSL
        unsigned int enable_ssl = 0;
-#endif
        int i, row;
        redisc_server_t *rsrv = NULL;
        param_t *pit = NULL;
@@ -167,12 +163,17 @@ int redisc_init(void)
                                snprintf(pass, sizeof(pass) - 1, "%.*s", 
pit->body.len,
                                                pit->body.s);
                                haspass = 1;
-#ifdef WITH_SSL
                        } else if(pit->name.len == 3
                                          && strncmp(pit->name.s, "tls", 3) == 
0) {
                                /* parse tls flag only; do not overwrite 
password buffer */
-                               if(str2int(&pit->body, &enable_ssl) < 0)
+                               if(str2int(&pit->body, &enable_ssl) < 0) {
                                        enable_ssl = 0;
+                               }
+#ifndef WITH_SSL
+                               if(enable_ssl) {
+                                       LM_WARN("tls connection set, but the 
module is not "
+                                                       "compiled with SSL/TLS 
support\n");
+                               }
 #endif
                        } else if(pit->name.len == 14
                                          && strncmp(pit->name.s, 
"sentinel_group", 14) == 0) {
@@ -1387,7 +1388,7 @@ int redisc_check_auth(redisc_server_t *rsrv, char *pass)
 }
 
 /* backwards compatibility with hiredis < 0.12 */
-#if (HIREDIS_MAJOR == 0) && (HIREDIS_MINOR < 12)
+#if(HIREDIS_MAJOR == 0) && (HIREDIS_MINOR < 12)
 int redis_append_formatted_command(redisContext *c, const char *cmd, size_t 
len)
 {
        sds newbuf;

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to