Fix segfault when failing to import keys
Avoid a segfault when a search of the keyserver returns that the key is found but returns no primary IDs. We are then likely going to fail the import, but attempt anyway because no-one know what a keyserver will do! Fixes FS#73534. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
e1246baddd
commit
6b37d99431
1 changed files with 9 additions and 5 deletions
|
@ -359,14 +359,18 @@ static int key_search_keyserver(alpm_handle_t *handle, const char *fpr,
|
||||||
} else {
|
} else {
|
||||||
pgpkey->fingerprint = key->subkeys->keyid;
|
pgpkey->fingerprint = key->subkeys->keyid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* we are probably going to fail importing, but continue anyway... */
|
||||||
|
if(key->uids != NULL) {
|
||||||
pgpkey->uid = key->uids->uid;
|
pgpkey->uid = key->uids->uid;
|
||||||
pgpkey->name = key->uids->name;
|
pgpkey->name = key->uids->name;
|
||||||
pgpkey->email = key->uids->email;
|
pgpkey->email = key->uids->email;
|
||||||
|
}
|
||||||
|
|
||||||
pgpkey->created = key->subkeys->timestamp;
|
pgpkey->created = key->subkeys->timestamp;
|
||||||
pgpkey->expires = key->subkeys->expires;
|
pgpkey->expires = key->subkeys->expires;
|
||||||
pgpkey->length = key->subkeys->length;
|
pgpkey->length = key->subkeys->length;
|
||||||
pgpkey->revoked = key->subkeys->revoked;
|
pgpkey->revoked = key->subkeys->revoked;
|
||||||
|
|
||||||
/* Initialize with '?', this is overwritten unless public key
|
/* Initialize with '?', this is overwritten unless public key
|
||||||
* algorithm is unknown. */
|
* algorithm is unknown. */
|
||||||
pgpkey->pubkey_algo = '?';
|
pgpkey->pubkey_algo = '?';
|
||||||
|
@ -535,7 +539,7 @@ int _alpm_key_import(alpm_handle_t *handle, const char *uid, const char *fpr)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
_("key \"%s\" could not be imported\n"), fetch_key.uid);
|
_("key \"%s\" could not be imported\n"), fpr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
|
|
Loading…
Add table
Reference in a new issue