[glib/wip/danw/poodle: 1/2] gio/tests/tls-certificates: fix



commit 582aa039020610d0ba1d89bfc71acff19073ca9e
Author: Dan Winship <danw gnome org>
Date:   Wed Oct 15 17:49:09 2014 -0400

    gio/tests/tls-certificates: fix
    
    da053e34 broke the tls-certificates test by requiring the backend to
    implement g_tls_certificate_verify() (which the test TLS backend
    didn't). Add a trivial implementation to make the test pass again;
    we'll need something more complicated when we add tests that are
    supposed to get errors.

 gio/tests/gtesttlsbackend.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gio/tests/gtesttlsbackend.c b/gio/tests/gtesttlsbackend.c
index d08e2aa..d5417fd 100644
--- a/gio/tests/gtesttlsbackend.c
+++ b/gio/tests/gtesttlsbackend.c
@@ -92,6 +92,15 @@ G_DEFINE_TYPE_WITH_CODE (GTestTlsCertificate, g_test_tls_certificate, G_TYPE_TLS
                         G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
                                                g_test_tls_certificate_initable_iface_init);)
 
+static GTlsCertificateFlags
+g_test_tls_certificate_verify (GTlsCertificate     *cert,
+                               GSocketConnectable  *identity,
+                               GTlsCertificate     *trusted_ca)
+{
+  /* For now, all of the tests expect the certificate to verify */
+  return 0;
+}
+
 static void
 g_test_tls_certificate_get_property (GObject    *object,
                                      guint       prop_id,
@@ -151,14 +160,17 @@ g_test_tls_certificate_finalize (GObject *object)
 }
 
 static void
-g_test_tls_certificate_class_init (GTestTlsCertificateClass *certificate_class)
+g_test_tls_certificate_class_init (GTestTlsCertificateClass *test_class)
 {
-  GObjectClass *gobject_class = G_OBJECT_CLASS (certificate_class);
+  GObjectClass *gobject_class = G_OBJECT_CLASS (test_class);
+  GTlsCertificateClass *certificate_class = G_TLS_CERTIFICATE_CLASS (test_class);
 
   gobject_class->get_property = g_test_tls_certificate_get_property;
   gobject_class->set_property = g_test_tls_certificate_set_property;
   gobject_class->finalize = g_test_tls_certificate_finalize;
 
+  certificate_class->verify = g_test_tls_certificate_verify;
+
   g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE, "certificate");
   g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE_PEM, "certificate-pem");
   g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY, "private-key");


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