[pacman-dev] Fwd: [PATCH 1/1] libalpm: check for valid public key algorithm

Allan McRae allan at archlinux.org
Sat Jun 28 20:34:53 EDT 2014


Forwarding to list.


-------- Original Message --------
Subject: [PATCH 1/1] libalpm: check for valid public key algorithm
Date: Tue, 24 Jun 2014 09:38:19 +0200
From: Christian Hesse <mail at eworm.de>
To: Allan McRae <allan at archlinux.org>
CC: Christian Hesse <mail at eworm.de>

---
 lib/libalpm/signing.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
index c6b748e..e46fa2e 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));
-- 
2.0.0







More information about the pacman-dev mailing list