[gmime] Disable CRL checks in gpgsm.conf for unit tests



commit e455df40424daa109d6a5d8f6ef2e68af83bbd68
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Tue Mar 7 20:37:58 2017 -0500

    Disable CRL checks in gpgsm.conf for unit tests

 tests/test-pkcs7.c |    1 +
 tests/testsuite.c  |   16 ++++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/tests/test-pkcs7.c b/tests/test-pkcs7.c
index 4d655e1..d330f9a 100644
--- a/tests/test-pkcs7.c
+++ b/tests/test-pkcs7.c
@@ -17,6 +17,7 @@
  *  Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
diff --git a/tests/testsuite.c b/tests/testsuite.c
index 374ec61..a437d41 100644
--- a/tests/testsuite.c
+++ b/tests/testsuite.c
@@ -23,6 +23,8 @@
 #endif
 
 #include <glib.h>
+#include <glib/gstdio.h>
+
 #include <stdlib.h>
 #ifdef ENABLE_THREADS
 #include <pthread.h>
@@ -421,7 +423,6 @@ testsuite_can_safely_override_session_key (const char *gpg)
 int
 testsuite_setup_gpghome (const char *gpg)
 {
-       const char directive[] = "pinentry-mode loopback\n";
        char *command;
        FILE *fp;
        
@@ -450,7 +451,7 @@ testsuite_setup_gpghome (const char *gpg)
                if (!(fp = fopen ("./tmp/.gnupg/gpg.conf", "a")))
                        return EXIT_FAILURE;
                
-               if (fwrite (directive, sizeof (directive) - 1, 1, fp) != 1) {
+               if (fprintf (fp, "pinentry-mode loopback\n") == -1) {
                        fclose (fp);
                        return EXIT_FAILURE;
                }
@@ -459,6 +460,17 @@ testsuite_setup_gpghome (const char *gpg)
                        return EXIT_FAILURE;
        }
        
+       if (!(fp = fopen ("./tmp/.gnupg/gpgsm.conf", "a")))
+               return EXIT_FAILURE;
+       
+       if (fprintf (fp, "disable-crl-checks\n") == -1) {
+               fclose (fp);
+               return EXIT_FAILURE;
+       }
+       
+       if (fclose (fp))
+               return EXIT_FAILURE;
+       
        return EXIT_SUCCESS;
 }
 


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