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

Allan McRae allan at archlinux.org
Mon Jun 23 08:18:18 EDT 2014


Accidentally replied off-list.

On 23/06/14 22:08, Allan McRae wrote:
> On 12/06/14 16:48, Christian Hesse wrote:
>> ---
>>  lib/libalpm/signing.c | 9 ++++++++-
>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
>> index 8fb909d..f657110 100644
>> --- a/lib/libalpm/signing.c
>> +++ b/lib/libalpm/signing.c
>> @@ -350,7 +350,14 @@ static int key_search(alpm_handle_t *handle, const char *fpr,
>>  			break;
>>  	}
>>  
>> -	ret = 1;
>> +	/* We do not want to add a default case above to receive compiler
>> +	 * error on new public key algorithm in gpgme. So check here if we
>> +	 * have a valid pubkey_algo, should have been initialize with 0. */
>> +	if (pgpkey->pubkey_algo != 0) {
>> +		ret = 1;
>> +	} else {
>> +		_alpm_log(handle, ALPM_LOG_DEBUG, "unknown public key algorithm\n");
>> +	}
>>  
> 
> If we set ret=1 here, at gpg_error: we try printing the error...
> 
>>  gpg_error:
>>  	if(ret != 1) {
>>
> 
> How about adding "cleanup:" after the if(ret != 1) block and using this
> after your comment:
> 
> if (pgpkey->pubkey_algo == 0) {
> 	_alpm_log(handle, ALPM_LOG_DEBUG, "unknown public key algorithm\n");
> 	ret = 1;
> 	goto cleanup;
> }
> 



More information about the pacman-dev mailing list