From: Klas Lindfors Date: Wed, 25 Apr 2012 12:11:21 +0000 (+0200) Subject: check version for SLOT_NDEF, copy the data to the ndef pointer X-Git-Tag: v1.7.0~1^2~28 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fec8cf6f68165001497215ef132326ce7fb5f923;p=yubikey-personalization check version for SLOT_NDEF, copy the data to the ndef pointer --- diff --git a/ykpers-args.c b/ykpers-args.c index 249a24f..1cae7f1 100644 --- a/ykpers-args.c +++ b/ykpers-args.c @@ -416,14 +416,17 @@ int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, break; } case 'n': - if (slot_chosen || swap_seen || update_seen || option_seen) { + if (slot_chosen || swap_seen || update_seen || option_seen) { fprintf(stderr, "Ndef (-n) must be used on it's own.\n"); *exit_code = 1; return 0; - } - ndef = strdup(optarg); - ndef_seen = true; - break; + } + if (!ykp_configure_command(cfg, SLOT_NDEF)) { + return 0; + } + ndef = strdup(optarg); + ndef_seen = true; + break; case 'o': if (strncmp(optarg, "salt=", 5) == 0) salt = strdup(optarg+5); diff --git a/ykpers.c b/ykpers.c index e67f960..59b3454 100644 --- a/ykpers.c +++ b/ykpers.c @@ -145,6 +145,12 @@ int ykp_configure_command(YKP_CONFIG *cfg, uint8_t command) return 0; } break; + case SLOT_NDEF: + /* NDEF is available for neo, thus within 2.1 from build 4 */ + if (!(cfg->yk_major_version == 2 && cfg->yk_minor_version == 1 && + cfg->yk_build_version >= 4 && cfg->yk_build_version != 9)) + ykp_errno = YKP_EYUBIKEYVER; + break; default: ykp_errno = YKP_EINVCONFNUM; return 0;