From: Mark Wooding Date: Sat, 26 Oct 2019 14:38:25 +0000 (+0100) Subject: key/key-misc.c (key_bytag): Don't give up because a by-id search fails. X-Git-Tag: 2.4.5~21 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb/commitdiff_plain/dd284d763651378656c408ec7bc589e8270166a3 key/key-misc.c (key_bytag): Don't give up because a by-id search fails. This came to my attention when searching for a key of type `ec' didn't work because it looks like a hex number. This obviously sucks. --- diff --git a/key/key-misc.c b/key/key-misc.c index c3442f28..0d969a87 100644 --- a/key/key-misc.c +++ b/key/key-misc.c @@ -160,12 +160,12 @@ key *key_bytag(key_file *f, const char *tag) char *p; uint32 id; key_ref *kr = sym_find(&f->bytag, tag, -1, 0, 0); + key *k; if (kr && !(KEY_EXPIRED(t, kr->k->exp) && KEY_EXPIRED(t, kr->k->del))) return (kr->k); id = strtoul(tag, &p, 16); - if (!*p) - return (key_byid(f, id)); + if (!*p && (k = key_byid(f, id)) != 0) return (k); return (key_bytype(f, tag)); }