From: Klas Lindfors Date: Wed, 28 Mar 2012 05:40:32 +0000 (+0200) Subject: check if update flags are allowed. X-Git-Tag: v1.7.0~1^2~49 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62870c73bdda16814ffe2c062b76679da5dbb164;p=yubikey-personalization check if update flags are allowed. --- diff --git a/ykpers-args.c b/ykpers-args.c index 11a7499..5211f1f 100644 --- a/ykpers-args.c +++ b/ykpers-args.c @@ -531,6 +531,25 @@ int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, } } + if (update_seen) { + struct config_st *core_config = (struct config_st *) ykp_core_config(cfg); + if ((core_config->tktFlags & TKTFLAG_UPDATE_MASK) != core_config->tktFlags) { + fprintf(stderr, "Unallowed ticket flags with update.\n"); + *exit_code = 1; + return 0; + } + if ((core_config->cfgFlags & CFGFLAG_UPDATE_MASK) != core_config->cfgFlags) { + fprintf(stderr, "Unallowed cfg flags with update.\n"); + *exit_code = 1; + return 0; + } + if ((core_config->extFlags & EXTFLAG_UPDATE_MASK) != core_config->extFlags) { + fprintf(stderr, "Unallowed ext flags with update.\n"); + *exit_code = 1; + return 0; + } + } + if (*aesviahash) { bool long_key_valid = false; int res = 0;