[gmime] Fixed the build



commit 1d1196aa0a187e4e3974f255795b442d50fb30dc
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date:   Sun Feb 5 17:45:41 2017 -0500

    Fixed the build

 gmime/gmime-pkcs7-context.c |   10 +++++++++-
 tests/test-pgp.c            |    2 +-
 tests/test-pgpmime.c        |    2 +-
 tests/test-pkcs7.c          |    2 +-
 tests/test-smime.c          |    2 +-
 5 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/gmime/gmime-pkcs7-context.c b/gmime/gmime-pkcs7-context.c
index 571b4ed..0a9829f 100644
--- a/gmime/gmime-pkcs7-context.c
+++ b/gmime/gmime-pkcs7-context.c
@@ -169,6 +169,8 @@ g_mime_pkcs7_context_class_init (GMimePkcs7ContextClass *klass)
        crypto_class->get_signature_protocol = pkcs7_get_signature_protocol;
        crypto_class->get_encryption_protocol = pkcs7_get_encryption_protocol;
        crypto_class->get_key_exchange_protocol = pkcs7_get_key_exchange_protocol;
+       crypto_class->get_always_trust = pkcs7_get_always_trust;
+       crypto_class->set_always_trust = pkcs7_set_always_trust;
 }
 
 static void
@@ -894,20 +896,26 @@ pkcs7_export_keys (GMimeCryptoContext *context, GPtrArray *keys, GMimeStream *os
 static gboolean
 pkcs7_get_always_trust (GMimeCryptoContext *context)
 {
+#ifdef ENABLE_CRYPTO
        GMimePkcs7Context *pkcs7 = (GMimePkcs7Context *) context;
        
        return (pkcs7->encrypt_flags & GPGME_ENCRYPT_ALWAYS_TRUST) != 0;
+#else
+       return FALSE;
+#endif /* ENABLE_CRYPTO */
 }
 
 static void
-pkcs7_set_always_trust (GMimeCryptoContext *ctx, gboolean always_trust)
+pkcs7_set_always_trust (GMimeCryptoContext *context, gboolean always_trust)
 {
+#ifdef ENABLE_CRYPTO
        GMimePkcs7Context *pkcs7 = (GMimePkcs7Context *) context;
        
        if (always_trust)
                pkcs7->encrypt_flags |= GPGME_ENCRYPT_ALWAYS_TRUST;
        else
                pkcs7->encrypt_flags &= ~GPGME_ENCRYPT_ALWAYS_TRUST;
+#endif /* ENABLE_CRYPTO */
 }
 
 
diff --git a/tests/test-pgp.c b/tests/test-pgp.c
index d5e732c..d6bcfb9 100644
--- a/tests/test-pgp.c
+++ b/tests/test-pgp.c
@@ -306,7 +306,7 @@ int main (int argc, char **argv)
        testsuite_start ("GnuPG crypto context");
        
        ctx = g_mime_gpg_context_new (request_passwd, GPG_PATH);
-       g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) ctx, TRUE);
+       g_mime_crypto_context_set_always_trust (ctx, TRUE);
        
        testsuite_check ("GMimeGpgContext::import");
        try {
diff --git a/tests/test-pgpmime.c b/tests/test-pgpmime.c
index fdf65bb..ade6f3b 100644
--- a/tests/test-pgpmime.c
+++ b/tests/test-pgpmime.c
@@ -494,7 +494,7 @@ int main (int argc, char *argv[])
        testsuite_start ("PGP/MIME implementation");
        
        ctx = g_mime_gpg_context_new (request_passwd, GPG_PATH);
-       g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) ctx, TRUE);
+       g_mime_crypto_context_set_always_trust (ctx, TRUE);
        if (g_mime_crypto_context_set_retrieve_session_key (ctx, TRUE, &err) != 0) {
                fprintf (stderr, "Failed to set retrieve_session_key on GMimeGpgContext: %s\n",
                         err ? err->message : "no error info returned" );
diff --git a/tests/test-pkcs7.c b/tests/test-pkcs7.c
index 82ae86b..003e323 100644
--- a/tests/test-pkcs7.c
+++ b/tests/test-pkcs7.c
@@ -307,7 +307,7 @@ int main (int argc, char **argv)
        testsuite_start ("Pkcs7 crypto context");
        
        ctx = g_mime_pkcs7_context_new (request_passwd);
-       g_mime_pkcs7_context_set_always_trust ((GMimePkcs7Context *) ctx, TRUE);
+       g_mime_crypto_context_set_always_trust (ctx, TRUE);
        
        testsuite_check ("GMimePkcs7Context::import");
        try {
diff --git a/tests/test-smime.c b/tests/test-smime.c
index 07a1c34..ecaddf4 100644
--- a/tests/test-smime.c
+++ b/tests/test-smime.c
@@ -464,7 +464,7 @@ int main (int argc, char *argv[])
        testsuite_start ("S/MIME implementation");
        
        ctx = g_mime_pkcs7_context_new (request_passwd);
-       g_mime_pkcs7_context_set_always_trust ((GMimePkcs7Context *) ctx, TRUE);
+       g_mime_crypto_context_set_always_trust (ctx, TRUE);
        
        if (g_mime_crypto_context_set_retrieve_session_key (ctx, TRUE, NULL) == 0) {
                fprintf (stderr, "GMimePkcs7Context should not have allowed us to set retrieve_session_key to 
TRUE, since it is not implemented.\n");


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