diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 02ec62e9..54814de2 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -1074,8 +1074,10 @@ typedef struct _alpm_question_import_key_t { alpm_question_type_t type; /** Answer: whether or not to import key */ int import; - /** The key to import */ - alpm_pgpkey_t *key; + /** UID of the key to import */ + const char *uid; + /** Fingerprint the key to import */ + const char *fingerprint; } alpm_question_import_key_t; /** diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index 973bd661..443682b5 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -495,7 +495,7 @@ static int email_from_uid(const char *uid, char **email) int _alpm_key_import(alpm_handle_t *handle, const char *uid, const char *fpr) { int ret = -1; - alpm_pgpkey_t fetch_key = {0}; + alpm_pgpkey_t fetch_key; char *email; if(_alpm_access(handle, handle->gpgdir, "pubring.gpg", W_OK)) { @@ -504,19 +504,15 @@ int _alpm_key_import(alpm_handle_t *handle, const char *uid, const char *fpr) return -1; } - STRDUP(fetch_key.uid, uid, return -1); - STRDUP(fetch_key.fingerprint, fpr, free(fetch_key.uid); return -1); alpm_question_import_key_t question = { .type = ALPM_QUESTION_IMPORT_KEY, .import = 0, - .key = &fetch_key + .uid = uid, + .fingerprint = fpr }; QUESTION(handle, &question); - free(fetch_key.uid); - free(fetch_key.fingerprint); - if(question.import) { /* Try to import the key from a WKD first */ if(email_from_uid(uid, &email) == 0) { diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 75c74f8b..2579b98a 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -541,12 +541,12 @@ void cb_question(void *ctx, alpm_question_t *question) { alpm_question_import_key_t *q = &question->import_key; /* the uid is unknown with db signatures */ - if (q->key->uid == NULL) { + if (q->uid == NULL) { q->import = yesno(_("Import PGP key %s?"), - q->key->fingerprint); + q->fingerprint); } else { q->import = yesno(_("Import PGP key %s, \"%s\"?"), - q->key->fingerprint, q->key->uid); + q->fingerprint, q->uid); } } break;