index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2011-09-19 21:51:30 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-09-20 10:23:11 -0500 |
commit | 994cb4da4f6bc8efbb6a649cb7d99d95bce5c37a (patch) | |
tree | 9cec25c9312ce01792d259141d786813bf7776da /lib/libalpm/signing.c | |
parent | a27f993600a518ef6a15bd7fb29575b218b58a0a (diff) |
-rw-r--r-- | lib/libalpm/signing.c | 24 |
diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index bcc91046..7e05a237 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -435,15 +435,17 @@ char *_alpm_sigpath(alpm_handle_t *handle, const char *path) } int _alpm_check_pgp_helper(alpm_handle_t *handle, const char *path, - const char *base64_sig, int optional, int marginal, int unknown) + const char *base64_sig, int optional, int marginal, int unknown, + alpm_siglist_t **sigdata) { - alpm_siglist_t siglist; + alpm_siglist_t *siglist; int ret; - memset(&siglist, 0, sizeof(alpm_siglist_t)); + CALLOC(siglist, 1, sizeof(alpm_siglist_t), + RET_ERR(handle, ALPM_ERR_MEMORY, -1)); _alpm_log(handle, ALPM_LOG_DEBUG, "checking signatures for %s\n", path); - ret = _alpm_gpgme_checksig(handle, path, base64_sig, &siglist); + ret = _alpm_gpgme_checksig(handle, path, base64_sig, siglist); if(ret && handle->pm_errno == ALPM_ERR_SIG_MISSING) { if(optional) { _alpm_log(handle, ALPM_LOG_DEBUG, "missing optional signature\n"); @@ -458,12 +460,12 @@ int _alpm_check_pgp_helper(alpm_handle_t *handle, const char *path, /* ret will already be -1 */ } else { size_t num; - for(num = 0; !ret && num < siglist.count; num++) { - switch(siglist.results[num].status) { + for(num = 0; !ret && num < siglist->count; num++) { + switch(siglist->results[num].status) { case ALPM_SIGSTATUS_VALID: case ALPM_SIGSTATUS_KEY_EXPIRED: _alpm_log(handle, ALPM_LOG_DEBUG, "signature is valid\n"); - switch(siglist.results[num].validity) { + switch(siglist->results[num].validity) { case ALPM_SIGVALIDITY_FULL: _alpm_log(handle, ALPM_LOG_DEBUG, "signature is fully trusted\n"); break; @@ -495,7 +497,13 @@ int _alpm_check_pgp_helper(alpm_handle_t *handle, const char *path, } } - alpm_siglist_cleanup(&siglist); + if(sigdata) { + *sigdata = siglist; + } else { + alpm_siglist_cleanup(siglist); + free(siglist); + } + return ret; } |