]> err.no Git - yubikey-personalization/commitdiff
check if update flags are allowed.
authorKlas Lindfors <klas@yubico.com>
Wed, 28 Mar 2012 05:40:32 +0000 (07:40 +0200)
committerKlas Lindfors <klas@yubico.com>
Wed, 28 Mar 2012 05:40:32 +0000 (07:40 +0200)
ykpers-args.c

index 11a74999d5cba4eef4d3d8d34a5b6c6715ac0864..5211f1fb8786e94bab433ff0118d58a63da7e07c 100644 (file)
@@ -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;