[sr-dev] git:master:f04dec82: db_postgress: disable initialization of libssl if tls is loaded

Daniel-Constantin Mierla miconda at gmail.com
Sun Jan 25 11:06:42 CET 2015


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-01-25T11:00:28+01:00

db_postgress: disable initialization of libssl if tls is loaded

- based on the note from docs to avoid double attempt to init the ssl
  library
- http://www.postgresql.org/docs/9.4/static/libpq-ssl.html

---

Modified: modules/db_postgres/km_pg_con.c

---

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

---

diff --git a/modules/db_postgres/km_pg_con.c b/modules/db_postgres/km_pg_con.c
index 77998d8..d053c55 100644
--- a/modules/db_postgres/km_pg_con.c
+++ b/modules/db_postgres/km_pg_con.c
@@ -30,6 +30,7 @@
 #include "../../mem/mem.h"
 #include "../../dprint.h"
 #include "../../ut.h"
+#include "../../tls_hooks_init.h" 
 #include <string.h>
 #include <time.h>
 #include <netinet/in.h>
@@ -98,6 +99,9 @@ struct pg_con* db_postgres_new_connection(struct db_id* id)
 
 	keywords[i] = values[i] = NULL;
 
+	/* don't attempt to re-init openssl if done already */
+	if(tls_loaded()) PQinitSSL(0);
+
 	ptr->con = PQconnectdbParams(keywords, values, 1);
 	LM_DBG("PQconnectdbParams(%p)\n", ptr->con);
 




More information about the sr-dev mailing list