From: Jonathan McDowell Date: Mon, 31 May 2004 23:47:12 +0000 (+0000) Subject: cscvs to tla changeset 35 X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/commitdiff_plain/d43d055372a663f85055bf255356271fdfe105e1 cscvs to tla changeset 35 Author: noodles Date: 2002/11/15 15:29:40 Make getfullkeyid in keydb.c not assert if the key isn't found. --- diff --git a/keydb.c b/keydb.c index c5b07c6..3acf711 100644 --- a/keydb.c +++ b/keydb.c @@ -89,7 +89,7 @@ struct ll *getkeysigs(uint64_t keyid) * @keyid: The 32bit keyid. * * This function maps a 32bit key id to the full 64bit one. It returns the - * full keyid. + * full keyid. If the key isn't found a keyid of 0 is returned. */ uint64_t getfullkeyid(uint64_t keyid) { @@ -97,8 +97,13 @@ uint64_t getfullkeyid(uint64_t keyid) if (keyid < 0x100000000LL) { fetch_key(keyid, &publickey, false); - keyid = get_keyid(publickey); - free_publickey(publickey); + if (publickey != NULL) { + keyid = get_keyid(publickey); + free_publickey(publickey); + publickey = NULL; + } else { + keyid = 0; + } } return keyid; diff --git a/keydb.h b/keydb.h index e9bcb67..4ad761b 100644 --- a/keydb.h +++ b/keydb.h @@ -120,7 +120,7 @@ struct ll *getkeysigs(uint64_t keyid); * @keyid: The 32bit keyid. * * This function maps a 32bit key id to the full 64bit one. It returns the - * full keyid. + * full keyid. If the key isn't found a keyid of 0 is returned. */ uint64_t getfullkeyid(uint64_t keyid);