commit f41b2776f7e203e86681e3dc4b1f8db2048ad201
parent 4dac4378cfbf1e033cf0ffff249dc97101d86a94
Author: Colin Leroy <colin@colino.net>
Date: Wed, 5 Sep 2012 11:38:44 +0000
2012-09-05 [colin] 3.8.1cvs43
* src/plugins/pgpcore/select-keys.c
Fix bug #2390, "Non-fully-trusted-key-warning appears
based on primary UID rather than recipient e-mail"
Diffstat:
4 files changed, 42 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,9 @@
+2012-09-05 [colin] 3.8.1cvs43
+
+ * src/plugins/pgpcore/select-keys.c
+ Fix bug #2390, "Non-fully-trusted-key-warning appears
+ based on primary UID rather than recipient e-mail"
+
2012-08-29 [colin] 3.8.1cvs42
* src/gtk/gtkaspell.c
diff --git a/PATCHSETS b/PATCHSETS
@@ -4417,3 +4417,4 @@
( cvs diff -u -r 1.274.2.348 -r 1.274.2.349 src/mainwindow.c; cvs diff -u -r 1.94.2.237 -r 1.94.2.238 src/messageview.c; cvs diff -u -r 1.83.2.192 -r 1.83.2.193 src/mimeview.c; cvs diff -u -r 1.20.2.37 -r 1.20.2.38 src/mimeview.h; cvs diff -u -r 1.395.2.450 -r 1.395.2.451 src/summaryview.c; cvs diff -u -r 1.96.2.244 -r 1.96.2.245 src/textview.c; cvs diff -u -r 1.5.2.46 -r 1.5.2.47 src/gtk/menu.c; cvs diff -u -r 1.4.2.26 -r 1.4.2.27 src/gtk/menu.h; ) > 3.8.1cvs40.patchset
( cvs diff -u -r 1.1.2.72 -r 1.1.2.73 src/plugins/pgpcore/sgpgme.c; ) > 3.8.1cvs41.patchset
( cvs diff -u -r 1.9.2.79 -r 1.9.2.80 src/gtk/gtkaspell.c; ) > 3.8.1cvs42.patchset
+( cvs diff -u -r 1.1.2.31 -r 1.1.2.32 src/plugins/pgpcore/select-keys.c; ) > 3.8.1cvs43.patchset
diff --git a/configure.ac b/configure.ac
@@ -12,7 +12,7 @@ MINOR_VERSION=8
MICRO_VERSION=1
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=42
+EXTRA_VERSION=43
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/src/plugins/pgpcore/select-keys.c b/src/plugins/pgpcore/select-keys.c
@@ -83,7 +83,7 @@ static void sort_keys (struct select_keys_s *sk, enum col_titles column);
static void sort_keys_name (GtkWidget *widget, gpointer data);
static void sort_keys_email (GtkWidget *widget, gpointer data);
-static gboolean use_untrusted (gpgme_key_t, gpgme_protocol_t proto);
+static gboolean use_untrusted (gpgme_key_t, gpgme_user_id_t uid, gpgme_protocol_t proto);
static void
update_progress (struct select_keys_s *sk, int running, const char *pattern)
@@ -274,6 +274,7 @@ fill_clist (struct select_keys_s *sk, const char *pattern, gpgme_protocol_t prot
int num_results = 0;
gboolean exact_match = FALSE;
gpgme_key_t last_key = NULL;
+ gpgme_user_id_t last_uid = NULL;
cm_return_val_if_fail (sk, NULL);
clist = sk->clist;
cm_return_val_if_fail (clist, NULL);
@@ -315,6 +316,7 @@ fill_clist (struct select_keys_s *sk, const char *pattern, gpgme_protocol_t prot
extract_address(raw_mail);
if (!strcasecmp(pattern, raw_mail)) {
exact_match = TRUE;
+ last_uid = uid;
g_free(raw_mail);
break;
}
@@ -330,7 +332,7 @@ fill_clist (struct select_keys_s *sk, const char *pattern, gpgme_protocol_t prot
if (exact_match == TRUE && num_results == 1) {
if (last_key->uids->validity < GPGME_VALIDITY_FULL &&
- !use_untrusted(last_key, proto))
+ !use_untrusted(last_key, last_uid, proto))
exact_match = FALSE;
}
@@ -511,8 +513,25 @@ select_btn_cb (GtkWidget *widget, gpointer data)
row = GPOINTER_TO_INT(sk->clist->selection->data);
key = gtk_cmclist_get_row_data(sk->clist, row);
if (key) {
- if ( key->uids->validity < GPGME_VALIDITY_FULL ) {
- use_key = use_untrusted(key, sk->proto);
+ gpgme_user_id_t uid;
+ for (uid = key->uids; uid; uid = uid->next) {
+ gchar *raw_mail = NULL;
+
+ if (!uid->email)
+ continue;
+ raw_mail = g_strdup(uid->email);
+ extract_address(raw_mail);
+ if (sk->pattern && !strcasecmp(sk->pattern, raw_mail)) {
+ g_free(raw_mail);
+ break;
+ }
+ g_free(raw_mail);
+ }
+ if (!uid)
+ uid = key->uids;
+
+ if ( uid->validity < GPGME_VALIDITY_FULL ) {
+ use_key = use_untrusted(key, uid, sk->proto);
if (!use_key) {
debug_print ("** Key untrusted, will not encrypt");
return;
@@ -578,23 +597,26 @@ other_btn_cb (GtkWidget *widget, gpointer data)
static gboolean
-use_untrusted (gpgme_key_t key, gpgme_protocol_t proto)
+use_untrusted (gpgme_key_t key, gpgme_user_id_t uid, gpgme_protocol_t proto)
{
AlertValue aval;
gchar *buf = NULL;
-
+ gchar *title = NULL;
if (proto != GPGME_PROTOCOL_OpenPGP)
return TRUE;
- buf = g_strdup_printf(_("The key of '%s' is not fully trusted.\n"
- "If you choose to encrypt the message with this key you don't\n"
- "know for sure that it will go to the person you mean it to.\n"
- "Do you trust it enough to use it anyway?"), key->uids->email);
+ title = g_strdup_printf(_("Encrypt to %s <%s>"), uid->name, uid->email);
+ buf = g_strdup_printf(_("This encryption key is not fully trusted.\n"
+ "If you choose to encrypt the message with this key, you don't\n"
+ "know for sure that it will go to the person you mean it to.\n\n"
+ "Key details: ID %s, primary identity %s <%s>\n\n"
+ "Do you trust this key enough to use it anyway?"),
+ key->subkeys->keyid, key->uids->name, key->uids->email);
aval = alertpanel
- (_("Trust key"),
- buf,
+ (title, buf,
GTK_STOCK_NO, GTK_STOCK_YES, NULL);
g_free(buf);
+ g_free(title);
if (aval == G_ALERTALTERNATE)
return TRUE;
else