summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-09-21 12:59:04 -0500
committerDan McGee <dan@archlinux.org>2011-09-22 10:32:39 -0500
commit69694edd2cd282b513426cced5d885cec35f612e (patch)
treef18540ea75731065b2182fdfc5a39c8405a69f8d /src
parentd36d70d2947b1c6a161f6bf55ddd19445f2c81cb (diff)
downloadpacman-69694edd2cd282b513426cced5d885cec35f612e.tar.xz
Check capabilities in SigLevel option parsing
Only allow turning it on if the backend library has support for it. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/conf.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index cc1fb724..54fd5c15 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -54,8 +54,10 @@ config_t *config_new(void)
newconfig->op = PM_OP_MAIN;
newconfig->logmask = ALPM_LOG_ERROR | ALPM_LOG_WARNING;
newconfig->configfile = strdup(CONFFILE);
- newconfig->siglevel = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL |
- ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
+ if(alpm_capabilities() & ALPM_CAPABILITY_SIGNATURES) {
+ newconfig->siglevel = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL |
+ ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
+ }
return newconfig;
}
@@ -315,6 +317,13 @@ static int process_siglevel(alpm_list_t *values, alpm_siglevel_t *storage)
level &= ~ALPM_SIG_USE_DEFAULT;
}
+ /* ensure we have sig checking ability and are actually turning it on */
+ if(!(alpm_capabilities() & ALPM_CAPABILITY_SIGNATURES) &&
+ level & (ALPM_SIG_PACKAGE | ALPM_SIG_DATABASE)) {
+ pm_printf(ALPM_LOG_ERROR, _("'SigLevel' option invalid, no signature support\n"));
+ ret = 1;
+ }
+
if(!ret) {
*storage = level;
}