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>
This commit is contained in:
parent
d36d70d294
commit
69694edd2c
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue