]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Do not call gnutls_x509_crt_check_hostname() if hostname eq NULL. Reported by Matthew...
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 28 Feb 2012 09:00:15 +0000 (10:00 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 28 Feb 2012 09:24:30 +0000 (10:24 +0100)
THANKS
src/common.c

diff --git a/THANKS b/THANKS
index 32d6bc4de10067a9407e4b2d050a4cca5edc79b7..123c733709042a66b1ad6fbc0d42bb709678b65a 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -127,6 +127,7 @@ Joseph Graham                   *joe [at] t67.eu*
 Eli Zaretskii                   *eliz [at] gnu.org*
 Patrick Pelletier               *code [at] funwithsoftware.org*
 Sean Buckheister                *s_buckhe [at] cs.uni-kl.de*
+Matthew Hall                    *mhall [at] mhcomputing.net*
 
 ----------------------------------------------------------------------
 Copying and distribution of this file, with or without modification,
index 65e9c721b7b1318798d351284de66b37c3d72e98..48f56bdcc75e5ad94379b2b260b3dff64a931bb9 100644 (file)
@@ -218,18 +218,21 @@ verify_x509_hostname (gnutls_session_t session, const char *hostname)
   /* Check the hostname of the first certificate if it matches
    * the name of the host we connected to.
    */
-  if (gnutls_x509_crt_check_hostname (crt, hostname) == 0)
+  if (hostname != NULL)
     {
-      printf
+      if (gnutls_x509_crt_check_hostname (crt, hostname) == 0)
+        {
+          printf
              ("- The hostname in the certificate does NOT match '%s'\n",
               hostname);
-      ret = 0;
-    }
-  else
-    {
-      printf ("- The hostname in the certificate matches '%s'.\n",
-              hostname);
-      ret = 1;
+          ret = 0;
+        }
+      else
+        {
+          printf ("- The hostname in the certificate matches '%s'.\n",
+                  hostname);
+          ret = 1;
+        }
     }
 
   gnutls_x509_crt_deinit (crt);