summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-09-07 22:02:52 +0200
committerDan McGee <dan@archlinux.org>2011-09-08 03:51:35 +0200
commit3e08614fda144393ab1ca23dcf08f2cd2f604cf9 (patch)
tree57f5f04265023bb533284648c331c79687e38fe9 /lib
parent0e79802c0ac8453376d8c0f99629f5a3b499f571 (diff)
downloadpacman-3e08614fda144393ab1ca23dcf08f2cd2f604cf9.tar.gz
pacman-3e08614fda144393ab1ca23dcf08f2cd2f604cf9.tar.xz
Ensure PackageRequired works as expected
Changes in commit dc3336c277 caused this to stop working as expected for sync packages, due to the way the logic is structured. Ensure we always enter the signature code if the bitflag is flipped on to check signatures for packages. Rename 'use_sig' to 'has_sig' for clarity. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/be_package.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 98a1240a..8b035cac 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -286,7 +286,7 @@ static alpm_file_t *files_msort(alpm_file_t *files, size_t n)
alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
alpm_pkg_t *syncpkg, int full, alpm_siglevel_t level)
{
- int ret, use_sig, config = 0;
+ int ret, has_sig, config = 0;
struct archive *archive;
struct archive_entry *entry;
alpm_pkg_t *newpkg = NULL;
@@ -312,20 +312,20 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
}
/* can we get away with skipping checksums? */
- use_sig = 0;
+ has_sig = 0;
if(level & ALPM_SIG_PACKAGE) {
if(syncpkg && syncpkg->base64_sig) {
- use_sig = 1;
+ has_sig = 1;
} else {
char *sigpath = _alpm_sigpath(handle, pkgfile);
if(sigpath && !_alpm_access(handle, NULL, sigpath, R_OK)) {
- use_sig = 1;
+ has_sig = 1;
}
free(sigpath);
}
}
- if(syncpkg && !use_sig) {
+ if(syncpkg && !has_sig) {
if(syncpkg->md5sum && !syncpkg->sha256sum) {
_alpm_log(handle, ALPM_LOG_DEBUG, "md5sum: %s\n", syncpkg->md5sum);
_alpm_log(handle, ALPM_LOG_DEBUG, "checking md5sum for %s\n", pkgfile);
@@ -345,7 +345,8 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
}
}
- if(use_sig) {
+ /* even if we don't have a sig, run the check code if level tells us to */
+ if(has_sig || level & ALPM_SIG_PACKAGE) {
const char *sig = syncpkg ? syncpkg->base64_sig : NULL;
_alpm_log(handle, ALPM_LOG_DEBUG, "sig data: %s\n", sig ? sig : "<from .sig>");
if(_alpm_check_pgp_helper(handle, pkgfile, sig,