Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/signing.c
diff options
context:
space:
mode:
authorChristian Hesse <mail@eworm.de>2014-06-24 09:38:19 +0200
committerAllan McRae <allan@archlinux.org>2014-06-29 11:12:36 +1000
commite05fd5e060cf5a4a71d5d8a65db7b39876d67726 (patch)
tree1c9162510367757a643b9a200b4491bccbd883f2 /lib/libalpm/signing.c
parent357b9a24a96478b7bcaaea8633f8f6a519f8903c (diff)
libalpm: check for valid public key algorithm
Diffstat (limited to 'lib/libalpm/signing.c')
-rw-r--r--lib/libalpm/signing.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
index c6b748e3..e46fa2ea 100644
--- a/lib/libalpm/signing.c
+++ b/lib/libalpm/signing.c
@@ -327,6 +327,10 @@ static int key_search(alpm_handle_t *handle, const char *fpr,
pgpkey->length = key->subkeys->length;
pgpkey->revoked = key->subkeys->revoked;
+ /* Initialize with '?', this is overwritten unless public key
+ * algorithm is unknown. */
+ pgpkey->pubkey_algo = '?';
+
switch(key->subkeys->pubkey_algo) {
case GPGME_PK_RSA:
case GPGME_PK_RSA_E:
@@ -352,6 +356,14 @@ static int key_search(alpm_handle_t *handle, const char *fpr,
ret = 1;
+ /* We do not want to add a default switch case above to receive
+ * compiler error on new public key algorithm in gpgme. So check
+ * here if we have a valid pubkey_algo. */
+ if (pgpkey->pubkey_algo == '?') {
+ _alpm_log(handle, ALPM_LOG_DEBUG,
+ "unknown public key algorithm: %d\n", key->subkeys->pubkey_algo);
+ }
+
gpg_error:
if(ret != 1) {
_alpm_log(handle, ALPM_LOG_DEBUG, "gpg error: %s\n", gpgme_strerror(gpg_err));