diff lib/sslcommon.c @ 186:13ca1defdc75

2003-6-16 Brian Masney <masneyb@gftp.org> * lib/gftp.h src/text/gftp-text.c src/gtk/misc-gtk.c - changed 2nd parameter of logging function to be a request structure, instead of request->user_data. In the logging functions, if the string isn't in UTF-8, convert it with gftp_string_to_utf8() * lib/bookmark.c lib/cache.c lib/gftp.h lib/https.c lib/local.c lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c lib/sslcommon.c src/gtk/chmod_dialog.c src/gtk/delete_dialog.c src/gtk/gftp-gtk.h src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/mkdir_dialog.c src/gtk/rename_dialog.c src/gtk/transfer.c src/text/gftp-text.c src/gtk/gftp-gtk.h src/text/gftp-text.h - pass request structure to logging function instead of request->user_data
author masneyb
date Tue, 17 Jun 2003 10:49:16 +0000
parents 3b168fed3fde
children 75eebb3b0592
line wrap: on
line diff
--- a/lib/sslcommon.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/lib/sslcommon.c	Tue Jun 17 10:49:16 2003 +0000
@@ -90,8 +90,8 @@
 
       X509_NAME_oneline (X509_get_issuer_name (cert), issuer, sizeof (issuer));
       X509_NAME_oneline (X509_get_subject_name (cert), subject, sizeof (subject));
-      request->logging_function (gftp_logging_error, request->user_data,
-                                 "Error with certificate at depth: %i\nIssuer = %s\nSubject = %s\nError %i:%s\n", 
+      request->logging_function (gftp_logging_error, request,
+                                 _("Error with certificate at depth: %i\nIssuer = %s\nSubject = %s\nError %i:%s\n"),
                                  depth, issuer, subject, err, 
                                  X509_verify_cert_error_string (err));
     }
@@ -112,7 +112,7 @@
   ok = 0;
   if (!(cert = SSL_get_peer_certificate (request->ssl)))
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Cannot get peer certificate\n"));
       return (X509_V_ERR_APPLICATION_VERIFICATION);
     }
@@ -168,7 +168,7 @@
      data[sizeof (data) - 1] = '\0';
      if (strcasecmp (data, request->hostname) != 0)
        {
-         request->logging_function (gftp_logging_error, request->user_data,
+         request->logging_function (gftp_logging_error, request,
                                     _("The SSL certificate's host %s does not match the host %s that we connected to\n"),
                                     data, request->hostname);
          X509_free (cert);
@@ -196,7 +196,7 @@
   /* FIXME _ thread setup */
   if (!SSL_library_init ())
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Cannot initialized the OpenSSL library\n"));
       return (GFTP_EFATAL);
     }
@@ -211,7 +211,7 @@
 
   if (SSL_CTX_set_default_verify_paths (ctx) != 1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error loading default SSL certificates\n"));
       return (GFTP_EFATAL);
     }
@@ -222,7 +222,7 @@
 
   if (SSL_CTX_set_cipher_list (ctx, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH") != 1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error setting cipher list (no valid ciphers)\n"));
       return (GFTP_EFATAL);
     }
@@ -241,7 +241,7 @@
 
   if (!gftp_ssl_initialized)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: SSL engine was not initialized\n"));
       return (GFTP_EFATAL);
     }
@@ -254,7 +254,7 @@
 
   if ((bio = BIO_new (BIO_s_socket ())) == NULL)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error setting up SSL connection (BIO object)\n"));
       return (GFTP_EFATAL);
     }
@@ -263,7 +263,7 @@
 
   if ((request->ssl = SSL_new (ctx)) == NULL)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error setting up SSL connection (SSL object)\n"));
       return (GFTP_EFATAL);
     }
@@ -276,13 +276,13 @@
 
   if ((ret = gftp_ssl_post_connection_check (request)) != X509_V_OK)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error with peer certificate: %s\n"),
                                  X509_verify_cert_error_string (ret));
       return (GFTP_EFATAL);
     }
 
-  request->logging_function (gftp_logging_misc, request->user_data,
+  request->logging_function (gftp_logging_misc, request,
                              "SSL connection established using %s (%s)\n", 
                              SSL_get_cipher_version (request->ssl), 
                              SSL_get_cipher_name (request->ssl));
@@ -299,7 +299,7 @@
 
   if (!gftp_ssl_initialized)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: SSL engine was not initialized\n"));
       return (GFTP_EFATAL);
     }
@@ -322,7 +322,7 @@
  
           if (request != NULL)
             {
-              request->logging_function (gftp_logging_error, request->user_data,
+              request->logging_function (gftp_logging_error, request,
                                    _("Error: Could not read from socket: %s\n"),
                                     g_strerror (errno));
               gftp_disconnect (request);
@@ -349,7 +349,7 @@
  
   if (!gftp_ssl_initialized)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: SSL engine was not initialized\n"));
       return (GFTP_EFATAL);
     }
@@ -370,7 +370,7 @@
  
           if (request != NULL)
             {
-              request->logging_function (gftp_logging_error, request->user_data,
+              request->logging_function (gftp_logging_error, request,
                                     _("Error: Could not write to socket: %s\n"),
                                     g_strerror (errno));
               gftp_disconnect (request);