diff options
author | Dan McGee <dan@archlinux.org> | 2011-09-21 12:59:04 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-09-22 10:32:39 -0500 |
commit | 69694edd2cd282b513426cced5d885cec35f612e (patch) | |
tree | f18540ea75731065b2182fdfc5a39c8405a69f8d | |
parent | d36d70d2947b1c6a161f6bf55ddd19445f2c81cb (diff) |
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>
-rw-r--r-- | src/pacman/conf.c | 13 |
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; } |