diff options
author | Dan McGee <dan@archlinux.org> | 2011-09-07 15:02:52 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-09-07 20:51:35 -0500 |
commit | 3e08614fda144393ab1ca23dcf08f2cd2f604cf9 (patch) | |
tree | 57f5f04265023bb533284648c331c79687e38fe9 /lib | |
parent | 0e79802c0ac8453376d8c0f99629f5a3b499f571 (diff) | |
download | 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.c | 13 |
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, |