[geary/cherry-pick-13f56024] Merge branch 'mjog/991-gcr-critical' into 'mainline'




commit 3bc8d890b76f00494aef0c08f80cae0e2b3d5de5
Author: Michael Gratton <mike vee net>
Date:   Thu Sep 24 22:59:08 2020 +0000

    Merge branch 'mjog/991-gcr-critical' into 'mainline'
    
    Fix GCR critical
    
    Closes #991
    
    See merge request GNOME/geary!583
    
    (cherry picked from commit 13f56024465ffb4c0c3f34202558da3f4726196d)
    
    7f7c55e7 Application.CertificateManager: Fix critical when no GCR trust stores
    0475d29f Application.CertificateManager: Warn when GCR not able to access stores

 .../application/application-certificate-manager.vala | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/client/application/application-certificate-manager.vala 
b/src/client/application/application-certificate-manager.vala
index ff0e7785a..3add22065 100644
--- a/src/client/application/application-certificate-manager.vala
+++ b/src/client/application/application-certificate-manager.vala
@@ -68,14 +68,28 @@ public class Application.CertificateManager : GLib.Object {
                 !Geary.String.is_empty(Gcr.pkcs11_get_trust_store_uri()) &&
                 Gcr.pkcs11_get_trust_lookup_uris().length > 0
             );
-            debug("GCR slot URIs found: %s", has_uris.to_string());
+            if (has_uris) {
+                debug("GCR slot URIs found: %s", has_uris.to_string());
+            } else {
+                warning(
+                    "No GCR slot URIs found, GCR certificate pinning unavailable"
+                );
+            }
         }
 
         bool has_rw_store = false;
         if (has_uris) {
             Gck.Slot? store = Gcr.pkcs11_get_trust_store_slot();
-            has_rw_store = !store.has_flags(CKF_WRITE_PROTECTED);
-            debug("GCR store is R/W: %s", has_rw_store.to_string());
+            if (store != null) {
+                has_rw_store = !store.has_flags(CKF_WRITE_PROTECTED);
+                debug("GCR store is R/W: %s", has_rw_store.to_string());
+            } else {
+                warning("No GCR store found, GCR certificate pinning unavailable");
+            }
+
+            if (!has_rw_store) {
+                warning("GCR store is not RW, GCR certificate pinning unavailable");
+            }
         }
 
         return has_rw_store;


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