summaryrefslogtreecommitdiff
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2011-03-25 21:40:16 -0400
committerDan McGee <dan@archlinux.org>2011-04-20 19:42:01 -0500
commit6760ec2b770e65f2aae9cfd39135cefd49961195 (patch)
tree1cff3dd732c5a4e6a7c262c8163e32e52eb7f6d5 /lib/libalpm/sync.c
parent2c8c763723b43ddcb865aab325afc9c76907cb64 (diff)
downloadpacman-6760ec2b770e65f2aae9cfd39135cefd49961195.tar.xz
Allow VerifySig to act as a default verification in [options]
* add _alpm_db_get_sigverify_level * add alpm_option_{get,set}_default_sigverify And set the default verification level to OPTIONAL if not set otherwise. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index a8284987..0143eed1 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -842,6 +842,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
char *filepath = _alpm_filecache_find(filename);
const char *md5sum = alpm_pkg_get_md5sum(spkg);
const pmpgpsig_t *pgpsig = alpm_pkg_get_pgpsig(spkg);
+ pgp_verify_t check_sig;
/* check md5sum first */
if(test_md5sum(trans, filepath, md5sum) != 0) {
@@ -853,10 +854,19 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
/* check PGP signature next */
pmdb_t *sdb = alpm_pkg_get_db(spkg);
- if(sdb->pgp_verify != PM_PGP_VERIFY_NEVER) {
+ check_sig = _alpm_db_get_sigverify_level(sdb);
+
+ if(check_sig == PM_PGP_VERIFY_UNKNOWN) {
+ _alpm_log(PM_LOG_ERROR, _("failed to determine signature verification "
+ "level for database: %s\n"), sdb->treename);
+ pm_errno = PM_ERR_PKG_INVALID;
+ goto error;
+ }
+
+ if(check_sig != PM_PGP_VERIFY_NEVER) {
int ret = _alpm_gpgme_checksig(filepath, pgpsig);
- if((sdb->pgp_verify == PM_PGP_VERIFY_ALWAYS && ret != 0) ||
- (sdb->pgp_verify == PM_PGP_VERIFY_OPTIONAL && ret == 1)) {
+ if((check_sig == PM_PGP_VERIFY_ALWAYS && ret != 0) ||
+ (check_sig == PM_PGP_VERIFY_OPTIONAL && ret == 1)) {
errors++;
*data = alpm_list_add(*data, strdup(filename));
FREE(filepath);