From: Thomas Roessler Date: Tue, 3 Apr 2001 17:25:58 +0000 (+0000) Subject: Add an error message in case keys can be found, but none are valid. X-Git-Tag: mutt-1-3-18-rel~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=68d637901d86f5b2b39d91e771509d83949d3b19;p=mutt Add an error message in case keys can be found, but none are valid. --- diff --git a/pgpkey.c b/pgpkey.c index 838ed7b8..648e50ff 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -434,18 +434,26 @@ static pgp_key_t *pgp_select_key (pgp_key_t *keys, pgp_uid_t *a; int (*f) (const void *, const void *); - keymax = 5; - KeyTable = safe_malloc (sizeof (pgp_key_t *) * keymax); + int unsuable = 0; + + keymax = 0; + KeyTable = NULL; for (i = 0, kp = keys; kp; kp = kp->next) { if (!option (OPTPGPSHOWUNUSABLE) && (kp->flags & KEYFLAG_CANTUSE)) + { + unusable = 1; continue; - + } + for (a = kp->address; a; a = a->next) { if (!option (OPTPGPSHOWUNUSABLE) && (a->flags & KEYFLAG_CANTUSE)) + { + unusable = 1; continue; + } if (i == keymax) { @@ -457,6 +465,12 @@ static pgp_key_t *pgp_select_key (pgp_key_t *keys, } } + if (!i && unusable) + { + mutt_error _("All matching keys are marked expired/revoked."); + return NULL; + } + switch (PgpSortKeys & SORT_MASK) { case SORT_DATE: