[Freeswitch-svn] [commit] r7292 - freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport

Freeswitch SVN stkn at freeswitch.org
Fri Jan 18 19:20:31 EST 2008


Author: stkn
Date: Fri Jan 18 19:20:31 2008
New Revision: 7292

Modified:
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c

Log:
Silence openssl messages, part 2 of 2. Changed to TPORT_DEBUG=1 (thanks MikeJ). This one converts all ERR_print_errors() calls

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c	Fri Jan 18 19:20:31 2008
@@ -50,7 +50,6 @@
 #include <sofia-sip/su_types.h>
 #include <sofia-sip/su.h>
 #include <sofia-sip/su_wait.h>
-#include <sofia-sip/su_debug.h>
 
 #include <assert.h>
 #include <stdio.h>
@@ -62,6 +61,7 @@
 #endif
 
 #include "tport_tls.h"
+#include "tport_internal.h"
 
 char const tls_version[] = OPENSSL_VERSION_TEXT;
 
@@ -71,7 +71,6 @@
   SSL_CTX *ctx;
   SSL *con;
   BIO *bio_con;
-  BIO *bio_err;
   int type;
   int verified;
 
@@ -92,6 +91,13 @@
 enum { tls_buffer_size = 16384 };
 
 static
+int tls_print_errors(const char *str, size_t len, void *u)
+{
+	SU_DEBUG_1((str));
+	return 0;
+}
+
+static
 tls_t *tls_create(int type)
 {
   tls_t *tls = calloc(1, sizeof(*tls));
@@ -159,7 +165,7 @@
       if (ti->configured > 1) {
 	SU_DEBUG_1(("%s: cannot open randFile %s\n", 
 		   "tls_init_context", ti->randFile));
-	ERR_print_errors(tls->bio_err);
+	ERR_print_errors_cb(&tls_print_errors, NULL);
       }
       /* errno = EIO; */
       /* return -1; */
@@ -171,9 +177,6 @@
   signal(SIGPIPE, SIG_IGN);
 #endif
 
-  if (tls->bio_err == NULL)
-    tls->bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
   if (tls->ctx == NULL) {
     SSL_METHOD *meth;
 
@@ -189,7 +192,7 @@
   }
 
   if (tls->ctx == NULL) {
-    ERR_print_errors(tls->bio_err);
+    ERR_print_errors_cb(&tls_print_errors, NULL);
     errno = EIO;
     return -1;
   }
@@ -200,7 +203,7 @@
     if (ti->configured > 0) {
       SU_DEBUG_1(("%s: invalid certificate: %s\n",
 		 "tls_init_context", ti->cert));
-      ERR_print_errors(tls->bio_err);
+      ERR_print_errors_cb(&tls_print_errors, NULL);
 #if require_client_certificate
       errno = EIO;
       return -1;
@@ -212,7 +215,7 @@
                                    ti->key, 
                                    SSL_FILETYPE_PEM)) {
     if (ti->configured > 0) {
-      ERR_print_errors(tls->bio_err);
+      ERR_print_errors_cb(&tls_print_errors, NULL);
 #if require_client_certificate
       errno = EIO;
       return -1;
@@ -234,7 +237,7 @@
                                      ti->CAfile, 
                                      ti->CApath)) {
     if (ti->configured > 0)
-      ERR_print_errors(tls->bio_err);
+      ERR_print_errors_cb(&tls_print_errors, NULL);
     errno = EIO;
     return -1;
   }
@@ -248,7 +251,7 @@
 
   if (!SSL_CTX_set_cipher_list(tls->ctx, ti->cipher)) {
     SU_DEBUG_1(("error setting cipher list\n"));
-    ERR_print_errors(tls->bio_err);
+    ERR_print_errors_cb(&tls_print_errors, NULL);
     errno = EIO;
     return -1;
   }
@@ -275,9 +278,6 @@
   if (tls->bio_con != NULL)
     BIO_free(tls->bio_con);
 
-  if (tls->bio_err != NULL && tls->type != tls_slave)
-    BIO_free(tls->bio_err);
-
   for (k = 0; k < TLS_MAX_HOSTS; k++)
     free(tls->hosts[k]), tls->hosts[k] = NULL;
 
@@ -332,7 +332,7 @@
 
     if (tls->bio_con == NULL) {
       SU_DEBUG_1(("tls_init_master: BIO_new_socket failed\n"));
-      ERR_print_errors(tls->bio_err);
+      ERR_print_errors_cb(&tls_print_errors, NULL);
       tls_free(tls);
       errno = EIO;
       return NULL;
@@ -364,7 +364,7 @@
       SU_DEBUG_1(("SSL_connect failed: %d %s\n", 
                  err,
                  ERR_error_string(err, NULL)));
-      ERR_print_errors(tls->bio_err);
+      ERR_print_errors_cb(&tls_print_errors, NULL);
       return -1;
     }
   }
@@ -399,7 +399,6 @@
 
   if (tls) {
     tls->ctx = master->ctx;
-    tls->bio_err = master->bio_err;
 
     if (!(tls->read_buffer = malloc(tls_buffer_size)))
       free(tls), tls = NULL;
@@ -414,7 +413,7 @@
 
   if (tls->con == NULL) {
     SU_DEBUG_1(("tls_clone: SSL_new failed\n"));
-    ERR_print_errors(tls->bio_err);
+    ERR_print_errors_cb(&tls_print_errors, NULL);
     tls_free(tls);
     errno = EIO;
     return NULL;
@@ -596,7 +595,7 @@
   default:
     SU_DEBUG_1(("%s: %s failed (%d): %s\n", 
 	       who, operation, err, ERR_error_string(err, errorbuf)));
-    ERR_print_errors(tls->bio_err);
+    ERR_print_errors_cb(&tls_print_errors, NULL);
     errno = EIO;
     return -1;
   }



More information about the Freeswitch-svn mailing list