summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2023-05-02 17:45:02 +0200
committerMilan Crha <mcrha@redhat.com>2023-05-02 17:45:02 +0200
commit52d89442525815c7ee1a092477c8756e662a3243 (patch)
tree7e1481f1679e02e549ec8ef4cb35ed9f138c1248
parentd62a9403ab504896461568f96c819fab2166e94d (diff)
downloadevolution-52d89442525815c7ee1a092477c8756e662a3243.tar.gz
I#2340 - Inconsistent S/MIME signature validation results
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/2340
-rw-r--r--src/smime/gui/cert-trust-dialog.c55
-rw-r--r--src/smime/gui/smime-ui.ui4
2 files changed, 40 insertions, 19 deletions
diff --git a/src/smime/gui/cert-trust-dialog.c b/src/smime/gui/cert-trust-dialog.c
index 82358fa54a..a19ad3215e 100644
--- a/src/smime/gui/cert-trust-dialog.c
+++ b/src/smime/gui/cert-trust-dialog.c
@@ -57,6 +57,39 @@ free_data (gpointer data)
}
static void
+cert_trust_dialog_refresh (CertTrustDialogData *ctd_data)
+{
+ CERTCertificate *icert;
+
+ icert = e_cert_get_internal_cert (ctd_data->cert);
+ if (e_cert_trust_has_peer (icert->trust, FALSE, TRUE, FALSE)) {
+ if (e_cert_trust_has_trusted_peer (icert->trust, FALSE, TRUE, FALSE))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctd_data->trust_button), TRUE);
+ else
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctd_data->notrust_button), TRUE);
+ } else {
+ /* when the trust is not set, it's inherited from the certificate authority trust */
+ icert = e_cert_get_internal_cert (ctd_data->cacert);
+ if (e_cert_trust_has_trusted_ca (icert->trust, FALSE, TRUE, FALSE))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctd_data->trust_button), TRUE);
+ else
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctd_data->notrust_button), TRUE);
+ }
+
+ icert = e_cert_get_internal_cert (ctd_data->cacert);
+ if (e_cert_trust_has_trusted_ca (icert->trust, FALSE, TRUE, FALSE))
+ gtk_label_set_text (
+ (GtkLabel *) ctd_data->label,
+ _("Because you trust the certificate authority that issued this certificate, "
+ "then you trust the authenticity of this certificate unless otherwise indicated here"));
+ else
+ gtk_label_set_text (
+ (GtkLabel *) ctd_data->label,
+ _("Because you do not trust the certificate authority that issued this certificate, "
+ "then you do not trust the authenticity of this certificate unless otherwise indicated here"));
+}
+
+static void
ctd_response (GtkWidget *w,
guint id,
CertTrustDialogData *data)
@@ -105,6 +138,8 @@ ctd_response (GtkWidget *w,
trust_objsign);
e_cert_db_change_cert_trust (icert, &trust);
+
+ cert_trust_dialog_refresh (data);
}
gtk_widget_destroy (dialog);
@@ -116,7 +151,6 @@ GtkWidget *
cert_trust_dialog_show (ECert *cert)
{
CertTrustDialogData *ctd_data;
- CERTCertificate *icert;
ctd_data = g_new0 (CertTrustDialogData, 1);
@@ -128,7 +162,6 @@ cert_trust_dialog_show (ECert *cert)
ctd_data->cacert = e_cert_get_ca_cert (cert);
ctd_data->trust_button = e_builder_get_widget (ctd_data->builder, "cert-trust");
ctd_data->notrust_button = e_builder_get_widget (ctd_data->builder, "cert-notrust");
-
ctd_data->label = e_builder_get_widget (ctd_data->builder, "trust-label");
g_signal_connect (
@@ -137,23 +170,7 @@ cert_trust_dialog_show (ECert *cert)
g_object_set_data_full (G_OBJECT (ctd_data->dialog), "CertTrustDialogData", ctd_data, free_data);
- icert = e_cert_get_internal_cert (cert);
- if (e_cert_trust_has_trusted_peer (icert->trust, FALSE, TRUE, FALSE))
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctd_data->trust_button), TRUE);
- else
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctd_data->notrust_button), TRUE);
-
- icert = e_cert_get_internal_cert (ctd_data->cacert);
- if (e_cert_trust_has_trusted_ca (icert->trust, FALSE, TRUE, FALSE))
- gtk_label_set_text (
- (GtkLabel *) ctd_data->label,
- _("Because you trust the certificate authority that issued this certificate, "
- "then you trust the authenticity of this certificate unless otherwise indicated here"));
- else
- gtk_label_set_text (
- (GtkLabel *) ctd_data->label,
- _("Because you do not trust the certificate authority that issued this certificate, "
- "then you do not trust the authenticity of this certificate unless otherwise indicated here"));
+ cert_trust_dialog_refresh (ctd_data);
return ctd_data->dialog;
}
diff --git a/src/smime/gui/smime-ui.ui b/src/smime/gui/smime-ui.ui
index 259543facb..b23e45b9f1 100644
--- a/src/smime/gui/smime-ui.ui
+++ b/src/smime/gui/smime-ui.ui
@@ -699,7 +699,11 @@
<object class="GtkLabel" id="trust-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="margin-bottom">12</property>
+ <property name="width-chars">60</property>
+ <property name="max-width-chars">60</property>
<property name="wrap">True</property>
+ <property name="xalign">0.0</property>
</object>
<packing>
<property name="expand">False</property>