[evolution/gnome-3-16] Bug 540157 - Deletes personal S/MIME certificates without proper password



commit ae6c535f3adb04770b94d66d87519b3bf2fce580
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jun 11 18:24:46 2015 +0200

    Bug 540157 - Deletes personal S/MIME certificates without proper password

 smime/lib/e-cert-db.c |    8 +++++++-
 smime/lib/e-cert.c    |   10 +---------
 2 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c
index 1c702ac..237c912 100644
--- a/smime/lib/e-cert-db.c
+++ b/smime/lib/e-cert-db.c
@@ -915,11 +915,17 @@ e_cert_db_delete_cert (ECertDB *certdb,
 
        CERTCertificate *cert;
 
+       cert = e_cert_get_internal_cert (ecert);
+       if (!cert)
+               return FALSE;
+
+       if (cert->slot && !e_cert_db_login_to_slot (certdb, cert->slot))
+               return FALSE;
+
        if (!e_cert_mark_for_deletion (ecert)) {
                return FALSE;
        }
 
-       cert = e_cert_get_internal_cert (ecert);
        if (cert->slot && e_cert_get_cert_type (ecert) != E_CERT_USER) {
                /* To delete a cert of a slot (builtin, most likely), mark it as
                 * completely untrusted.  This way we keep a copy cached in the
diff --git a/smime/lib/e-cert.c b/smime/lib/e-cert.c
index fc00b58..3bc4a9b 100644
--- a/smime/lib/e-cert.c
+++ b/smime/lib/e-cert.c
@@ -470,18 +470,10 @@ e_cert_get_ca_cert (ECert *ecert)
 gboolean
 e_cert_mark_for_deletion (ECert *cert)
 {
-       /* nsNSSShutDownPreventionLock locker; */
-
-#if 0
-       /* make sure user is logged in to the token */
-       nsCOMPtr < nsIInterfaceRequestor> ctx = new PipUIContext ();
-#endif
-
        if (PK11_NeedLogin (cert->priv->cert->slot)
            && !PK11_NeedUserInit (cert->priv->cert->slot)
            && !PK11_IsInternal (cert->priv->cert->slot)) {
-               if (PK11_Authenticate (
-                       cert->priv->cert->slot, PR_TRUE, NULL) != SECSuccess) {
+               if (PK11_Authenticate (cert->priv->cert->slot, PR_TRUE, NULL) != SECSuccess) {
                        return FALSE;
                }
        }


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