diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2021-02-05 13:49:10 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2021-02-05 13:49:10 +0900 |
commit | 390f597868a5b5934f21f81ebf6ff110b6792283 (patch) | |
tree | ecf94e4ea8d23f5b71454c02508d157241ae04aa | |
parent | 7f3ce66ec56a5aea6170b7eb1bda5626eb208c83 (diff) | |
download | gnupg-390f597868a5b5934f21f81ebf6ff110b6792283.tar.gz |
gpg: Fix selection of key.
* g10/getkey.c (pubkey_cmp): Handle the case of TRUST_EXPIRED.
--
GnuPG-bug-id: 4713
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r-- | g10/getkey.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/g10/getkey.c b/g10/getkey.c index d4c991f85..bc9e82638 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1359,7 +1359,9 @@ pubkey_cmp (ctrl_t ctrl, const char *name, struct pubkey_cmp_cookie *old, if (! uid_is_ok (&old->key, old->uid) && uid_is_ok (&new->key, uid)) return -1; /* Validity of the NEW key is better. */ - if (old->validity < new->validity) + if (new->validity != TRUST_EXPIRED && old->validity < new->validity) + return -1; /* Validity of the NEW key is better. */ + if (old->validity == TRUST_EXPIRED && new->validity != TRUST_EXPIRED) return -1; /* Validity of the NEW key is better. */ if (old->validity == new->validity && uid_is_ok (&new->key, uid) |