]> err.no Git - yubikey-personalization/commitdiff
check version for SLOT_NDEF, copy the data to the ndef pointer
authorKlas Lindfors <klas@yubico.com>
Wed, 25 Apr 2012 12:11:21 +0000 (14:11 +0200)
committerKlas Lindfors <klas@yubico.com>
Wed, 25 Apr 2012 12:11:21 +0000 (14:11 +0200)
ykpers-args.c
ykpers.c

index 249a24f2e6e262764a61bcb054ff67bb849b6f3e..1cae7f1a83fcf01927473a978fb1efe5dd17b842 100644 (file)
@@ -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);
index e67f96038ea4903c6b9f6233e0894f762ea49f37..59b345448a98813b4d6d2abbdf5adca8fc556a3e 100644 (file)
--- 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;