[glib-networking] openssl: use int to max protocol version



commit 1a91a8af28deaf9b2246449aa33850026e004807
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Fri Jun 4 08:20:18 2021 -0500

    openssl: use int to max protocol version
    
    We can't use G_GINT64_FORMAT here because the format string is
    translated, so there's no correct way to print a gint64. In general,
    this seems like a pretty serious problem for gettext, but in this case
    we can just use int instead, since that's what we pass to OpenSSL
    anyway.

 tls/openssl/gtlsclientconnection-openssl.c | 8 ++++----
 tls/openssl/gtlsserverconnection-openssl.c | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/tls/openssl/gtlsclientconnection-openssl.c b/tls/openssl/gtlsclientconnection-openssl.c
index aad011f..36c2dbf 100644
--- a/tls/openssl/gtlsclientconnection-openssl.c
+++ b/tls/openssl/gtlsclientconnection-openssl.c
@@ -326,14 +326,14 @@ set_max_protocol (GTlsClientConnectionOpenssl  *client,
   proto = g_getenv ("G_TLS_OPENSSL_MAX_PROTO");
   if (proto)
     {
-      gint64 version = g_ascii_strtoll (proto, NULL, 0);
+      int version = g_ascii_strtoll (proto, NULL, 0);
 
-      if (version > 0 && version < G_MAXINT64)
+      if (version > 0 && version < G_MAXINT)
         {
-          if (!SSL_CTX_set_max_proto_version (client->ssl_ctx, (int)version))
+          if (!SSL_CTX_set_max_proto_version (client->ssl_ctx, version))
             {
               g_set_error (error, G_TLS_ERROR, G_TLS_ERROR_MISC,
-                           _("Could not set MAX protocol to %ld: %s"),
+                           _("Could not set MAX protocol to %d: %s"),
                            version, ERR_error_string (ERR_get_error (), NULL));
               return FALSE;
             }
diff --git a/tls/openssl/gtlsserverconnection-openssl.c b/tls/openssl/gtlsserverconnection-openssl.c
index a809f60..440b90b 100644
--- a/tls/openssl/gtlsserverconnection-openssl.c
+++ b/tls/openssl/gtlsserverconnection-openssl.c
@@ -362,14 +362,14 @@ set_max_protocol (GTlsServerConnectionOpenssl  *server,
   proto = g_getenv ("G_TLS_OPENSSL_MAX_PROTO");
   if (proto)
     {
-      gint64 version = g_ascii_strtoll (proto, NULL, 0);
+      int version = g_ascii_strtoll (proto, NULL, 0);
 
-      if (version > 0 && version < G_MAXINT64)
+      if (version > 0 && version < G_MAXINT)
         {
-          if (!SSL_CTX_set_max_proto_version (server->ssl_ctx, (int)version))
+          if (!SSL_CTX_set_max_proto_version (server->ssl_ctx, version))
             {
               g_set_error (error, G_TLS_ERROR, G_TLS_ERROR_MISC,
-                           _("Could not set MAX protocol to %ld: %s"),
+                           _("Could not set MAX protocol to %d: %s"),
                            version, ERR_error_string (ERR_get_error (), NULL));
               return FALSE;
             }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]