[balsa: 1/4] Bug fix: S/MIME cert chain broken
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa: 1/4] Bug fix: S/MIME cert chain broken
- Date: Thu, 23 Jan 2020 19:57:08 +0000 (UTC)
commit f635d4af571714db071b96d7bb51a4a1ca58c290
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Jan 23 14:32:45 2020 -0500
Bug fix: S/MIME cert chain broken
Bug fix: S/MIME cert chain broken in identity key selection
* libbalsa/libbalsa-gpgme-widgets.c: libbalsa_gpgme_key(): fall back
to the cert fingerprint for cb smime_show_chain() if the passed one is NULL
* libbalsa/x509-cert-widget.c: x509_cert_chain_smime(): display message
if the cert fingerprint is NULL, requires a litte refactoring
ChangeLog | 9 +++++++++
libbalsa/libbalsa-gpgme-widgets.c | 8 +++++++-
libbalsa/x509-cert-widget.c | 41 +++++++++++++++++++++------------------
3 files changed, 38 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a81dd7f4c..d46f56c11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-01-23 Albrecht Dreß <albrecht dress arcor de>
+
+ Bug fix: S/MIME cert chain broken in identity key selection
+
+ * libbalsa/libbalsa-gpgme-widgets.c: libbalsa_gpgme_key(): fall back
+ to the cert fingerprint for cb smime_show_chain() if the passed one is NULL
+ * libbalsa/x509-cert-widget.c: x509_cert_chain_smime(): display message
+ if the cert fingerprint is NULL, requires a litte refactoring
+
2020-01-19 Peter Bloomfield <pbloomfield bellsouth net>
balsa-index: improve ensure-visible
diff --git a/libbalsa/libbalsa-gpgme-widgets.c b/libbalsa/libbalsa-gpgme-widgets.c
index 70112e80b..964aa4a85 100644
--- a/libbalsa/libbalsa-gpgme-widgets.c
+++ b/libbalsa/libbalsa-gpgme-widgets.c
@@ -162,12 +162,18 @@ libbalsa_gpgme_key(const gpgme_key_t key,
}
if (key->chain_id != NULL) {
GtkWidget *chain_btn;
+ gchar *chain_fpr;
issuer_row = create_key_grid_row(GTK_GRID(issuer_grid), issuer_row, _("Chain ID:"),
key->chain_id, FALSE);
/* add button to show the full chain - copy the fingerprint as the key may be
unref'ed... */
chain_btn = gtk_button_new_with_label(_("view certificate chain…"));
- g_object_set_data_full(G_OBJECT(chain_btn), "certid", g_strdup(fingerprint), g_free);
+ if (fingerprint != NULL) {
+ chain_fpr = g_strdup(fingerprint);
+ } else {
+ chain_fpr = (key->subkeys != NULL) ? g_strdup(key->subkeys->fpr) : NULL;
+ }
+ g_object_set_data_full(G_OBJECT(chain_btn), "certid", chain_fpr, g_free);
g_signal_connect(chain_btn, "clicked", G_CALLBACK(smime_show_chain), NULL);
gtk_grid_attach(GTK_GRID(issuer_grid), chain_btn, 0, issuer_row, 2, 1);
}
diff --git a/libbalsa/x509-cert-widget.c b/libbalsa/x509-cert-widget.c
index 52aeb748c..9afa60ef0 100644
--- a/libbalsa/x509-cert-widget.c
+++ b/libbalsa/x509-cert-widget.c
@@ -108,28 +108,31 @@ x509_cert_chain_smime(const gchar *fingerprint)
gpgme_ctx_t ctx;
GtkWidget *widget = NULL;
- g_return_val_if_fail(fingerprint != NULL, NULL);
-
- ctx = libbalsa_gpgme_new_with_proto(GPGME_PROTOCOL_CMS, NULL, NULL, NULL);
- if (ctx != NULL) {
- GList *chain = NULL;
- gchar *keyid;
-
- keyid = g_strdup(fingerprint);
- while (keyid != NULL) {
- chain = g_list_prepend(chain, cert_data_smime(ctx, &keyid));
- }
- gpgme_release(ctx);
- if (chain != NULL) {
- if (chain->next != NULL) {
- widget = create_chain_widget(chain);
- } else {
- widget = ((cert_data_t *) chain->data)->widget;
+ if (fingerprint != NULL) {
+ ctx = libbalsa_gpgme_new_with_proto(GPGME_PROTOCOL_CMS, NULL, NULL, NULL);
+ if (ctx != NULL) {
+ GList *chain = NULL;
+ gchar *keyid;
+
+ keyid = g_strdup(fingerprint);
+ while (keyid != NULL) {
+ chain = g_list_prepend(chain, cert_data_smime(ctx, &keyid));
}
- g_list_free_full(chain, (GDestroyNotify) cert_data_free);
- }
+ gpgme_release(ctx);
+ if (chain != NULL) {
+ if (chain->next != NULL) {
+ widget = create_chain_widget(chain);
+ } else {
+ widget = ((cert_data_t *) chain->data)->widget;
+ }
+ g_list_free_full(chain, (GDestroyNotify) cert_data_free);
+ }
+ }
}
+ if (widget == NULL) {
+ widget = gtk_label_new(_("Broken key, cannot identify certificate chain."));
+ }
return widget;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]