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

Daniel-Constantin Mierla miconda at gmail.com
Wed Jan 28 13:46:45 CET 2015


Module: kamailio
Branch: 4.2
Commit: eeae005fb3d5239dd6e3af727504fc829ea5a0fb
URL: https://github.com/kamailio/kamailio/commit/eeae005fb3d5239dd6e3af727504fc829ea5a0fb

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-01-28T13:44:21+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

(cherry picked from commit f04dec82e90ec7a3e6aea4ea8e9ed23b06b165c6)

Conflicts:
	modules/db_postgres/km_pg_con.c

---

Modified: modules/db_postgres/km_pg_con.c

---

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

---

diff --git a/modules/db_postgres/km_pg_con.c b/modules/db_postgres/km_pg_con.c
index de89d85..a8e0494 100644
--- a/modules/db_postgres/km_pg_con.c
+++ b/modules/db_postgres/km_pg_con.c
@@ -29,6 +29,7 @@
 #include "../../mem/mem.h"
 #include "../../dprint.h"
 #include "../../ut.h"
+#include "../../tls_hooks_init.h" 
 #include <string.h>
 #include <time.h>
 
@@ -74,6 +75,9 @@ struct pg_con* db_postgres_new_connection(struct db_id* id)
 			ZSW(id->database));
 	}
 
+	/* don't attempt to re-init openssl if done already */
+	if(tls_loaded()) PQinitSSL(0);
+
  	ptr->con = PQsetdbLogin(id->host, ports, NULL, NULL, id->database, id->username, id->password);
 	LM_DBG("PQsetdbLogin(%p)\n", ptr->con);
 




More information about the sr-dev mailing list