[glib-networking/wip/tingping/pkcs11-2: 11/11] Support building against pre-pkcs11 glib



commit 7ac1e6d0f1190f71d9619c0b36ac824e90f17d01
Author: Patrick Griffis <tingping tingping se>
Date:   Thu Oct 3 13:14:42 2019 -0700

    Support building against pre-pkcs11 glib
    
    This should be reverted once once GLib 2.64.0 is released.

 tls/gnutls/gtlscertificate-gnutls.c | 6 ++++++
 tls/tests/certificate.c             | 4 +++-
 tls/tests/connection.c              | 4 +++-
 3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/tls/gnutls/gtlscertificate-gnutls.c b/tls/gnutls/gtlscertificate-gnutls.c
index 3fe961f..0692fec 100644
--- a/tls/gnutls/gtlscertificate-gnutls.c
+++ b/tls/gnutls/gtlscertificate-gnutls.c
@@ -148,6 +148,7 @@ g_tls_certificate_gnutls_get_property (GObject    *object,
       g_value_set_object (value, gnutls->issuer);
       break;
 
+#if GLIB_CHECK_VERSION (2, 63, 0)
     case PROP_PKCS11_URI:
       g_value_set_string (value, gnutls->pkcs11_uri);
       break;
@@ -155,6 +156,7 @@ g_tls_certificate_gnutls_get_property (GObject    *object,
     case PROP_PRIVATE_KEY_PKCS11_URI:
       g_value_set_string (value, gnutls->private_key_pkcs11_uri);
       break;
+#endif
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -266,6 +268,7 @@ g_tls_certificate_gnutls_set_property (GObject      *object,
       gnutls->issuer = g_value_dup_object (value);
       break;
 
+#if GLIB_CHECK_VERSION (2, 63, 0)
     case PROP_PKCS11_URI:
       string = g_value_get_string (value);
       if (!string)
@@ -298,6 +301,7 @@ g_tls_certificate_gnutls_set_property (GObject      *object,
 
       gnutls->private_key_pkcs11_uri = g_strdup (string);
       break;
+#endif
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -408,8 +412,10 @@ g_tls_certificate_gnutls_class_init (GTlsCertificateGnutlsClass *klass)
   g_object_class_override_property (gobject_class, PROP_PRIVATE_KEY, "private-key");
   g_object_class_override_property (gobject_class, PROP_PRIVATE_KEY_PEM, "private-key-pem");
   g_object_class_override_property (gobject_class, PROP_ISSUER, "issuer");
+#if GLIB_CHECK_VERSION (2, 63, 0)
   g_object_class_override_property (gobject_class, PROP_PKCS11_URI, "pkcs11-uri");
   g_object_class_override_property (gobject_class, PROP_PRIVATE_KEY_PKCS11_URI, "private-key-pkcs11-uri");
+#endif
 }
 
 static void
diff --git a/tls/tests/certificate.c b/tls/tests/certificate.c
index f7517bb..6c64595 100644
--- a/tls/tests/certificate.c
+++ b/tls/tests/certificate.c
@@ -252,7 +252,9 @@ static void
 test_create_certificate_pkcs11 (TestCertificate *test,
                                 gconstpointer data)
 {
-#ifndef BACKEND_IS_GNUTLS
+#if !GLIB_CHECK_VERSION (2, 63, 0)
+  g_test_skip ("glib-networking built against too old GLib");
+#elif defined (BACKEND_IS_GNUTLS)
   g_test_skip ("This backend does not support PKCS #11");
 #else
   GTlsCertificate *cert;
diff --git a/tls/tests/connection.c b/tls/tests/connection.c
index 15b4f46..3676104 100644
--- a/tls/tests/connection.c
+++ b/tls/tests/connection.c
@@ -1063,7 +1063,9 @@ static void
 test_client_auth_pkcs11_connection (TestConnection *test,
                                     gconstpointer   data)
 {
-#ifndef BACKEND_IS_GNUTLS
+#if !GLIB_CHECK_VERSION (2, 63, 0)
+  g_test_skip ("glib-networking built against too old GLib");
+#elif defined (BACKEND_IS_GNUTLS)
   g_test_skip ("This backend does not support PKCS #11");
 #else
   GIOStream *connection;


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