Browse code

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

(cherry picked from commit eeae005fb3d5239dd6e3af727504fc829ea5a0fb)

Daniel-Constantin Mierla authored on 25/01/2015 10:00:28
Showing 1 changed files
... ...
@@ -29,6 +29,7 @@
29 29
 #include "../../mem/mem.h"
30 30
 #include "../../dprint.h"
31 31
 #include "../../ut.h"
32
+#include "../../tls_hooks_init.h" 
32 33
 #include <string.h>
33 34
 #include <time.h>
34 35
 
... ...
@@ -74,6 +75,9 @@ struct pg_con* db_postgres_new_connection(struct db_id* id)
74 75
 			ZSW(id->database));
75 76
 	}
76 77
 
78
+	/* don't attempt to re-init openssl if done already */
79
+	if(tls_loaded()) PQinitSSL(0);
80
+
77 81
  	ptr->con = PQsetdbLogin(id->host, ports, NULL, NULL, id->database, id->username, id->password);
78 82
 	LM_DBG("PQsetdbLogin(%p)\n", ptr->con);
79 83