gnutls: Appropriate error when server requires cert but none
authorStef Walter <stefw@gnome.org>
Thu, 29 Nov 2012 10:00:00 +0000 (11:00 +0100)
committerStef Walter <stefw@gnome.org>
Thu, 29 Nov 2012 22:03:38 +0000 (23:03 +0100)
When the server requires a certificate for auth, but none is
provider, return the appropriate G_TLS_ERROR_CERTIFICATE_REQUIRED
error.

https://bugzilla.gnome.org/show_bug.cgi?id=689260

tls/gnutls/gtlsconnection-gnutls.c

index f3602f2..2603532 100644 (file)
@@ -750,6 +750,12 @@ end_gnutls_io (GTlsConnectionGnutls  *gnutls,
       else
        return 0;
     }
+  else if (status == GNUTLS_E_NO_CERTIFICATE_FOUND)
+    {
+      g_set_error_literal (error, G_TLS_ERROR, G_TLS_ERROR_CERTIFICATE_REQUIRED,
+                           _("TLS connection peer did not send a certificate"));
+      return status;
+    }
 
   if (error)
     {