From 69694edd2cd282b513426cced5d885cec35f612e Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 21 Sep 2011 12:59:04 -0500 Subject: Check capabilities in SigLevel option parsing Only allow turning it on if the backend library has support for it. Signed-off-by: Dan McGee --- src/pacman/conf.c | 13 +++++++++++-- 1 file 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; } -- cgit v1.2.3-24-g4f1b