Blame SOURCES/mutt-1.5.21-testcert.patch

903f6e
diff -up mutt-1.5.21/mutt_ssl_gnutls.c.old mutt-1.5.21/mutt_ssl_gnutls.c
903f6e
--- mutt-1.5.21/mutt_ssl_gnutls.c.old	2011-03-23 11:46:28.760386765 +0100
903f6e
+++ mutt-1.5.21/mutt_ssl_gnutls.c	2011-03-23 14:34:45.839456449 +0100
903f6e
@@ -978,6 +978,7 @@ static int tls_check_certificate (CONNEC
903f6e
   unsigned int cert_list_size = 0;
903f6e
   gnutls_certificate_status certstat;
903f6e
   int certerr, i, preauthrc, savedcert, rc = 0;
903f6e
+  int rcpeer;
903f6e
 
903f6e
   if (gnutls_auth_get_type (state) != GNUTLS_CRD_CERTIFICATE)
903f6e
   {
903f6e
@@ -1003,6 +1004,9 @@ static int tls_check_certificate (CONNEC
903f6e
   for (i = 0; i < cert_list_size; i++) {
903f6e
     rc = tls_check_preauth(&cert_list[i], certstat, conn->account.host, i,
903f6e
                            &certerr, &savedcert);
903f6e
+    if (i == 0)
903f6e
+      rcpeer = rc;
903f6e
+
903f6e
     preauthrc += rc;
903f6e
 
903f6e
     if (savedcert)
903f6e
@@ -1028,7 +1032,7 @@ static int tls_check_certificate (CONNEC
903f6e
         dprint (1, (debugfile, "error trusting certificate %d: %d\n", i, rc));
903f6e
 
903f6e
       certstat = tls_verify_peers (state);
903f6e
-      if (!certstat)
903f6e
+      if (!certstat && !rcpeer)
903f6e
         return 1;
903f6e
     }
903f6e
   }