From: Klas Lindfors Date: Wed, 11 Apr 2012 08:41:51 +0000 (+0200) Subject: args stuff for setting ndef uri X-Git-Tag: v1.7.0~1^2~39 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87f9b34cea0a055a2a008ce7a6f877bba0caae5a;p=yubikey-personalization args stuff for setting ndef uri --- diff --git a/ykpers-args.c b/ykpers-args.c index f2053d0..5e8f373 100644 --- a/ykpers-args.c +++ b/ykpers-args.c @@ -65,6 +65,8 @@ const char *usage = " char hex value (not modhex)\n" "-cXXX.. A 12 char hex value (not modhex) to use as access code for programming\n" " (this does NOT SET the access code, that's done with -oaccess=)\n" +"-nXXX.. The url to prepend to the OTP when sending OTP over NFC as ndef-type2\n" +" smart-tag. Only available with the YubiKey NEO.\n" "-oOPTION change configuration option. Possible OPTION arguments are:\n" " salt=ssssssss Salt to be used when deriving key from a\n" " password. If none is given, a unique random\n" @@ -138,7 +140,7 @@ const char *usage = "-v verbose\n" "-h help (this text)\n" ; -const char *optstring = "u12xa:c:hi:o:s:vy"; +const char *optstring = "u12xa:c:n:hi:o:s:vy"; static const YK_CONFIG default_config1 = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fixed */ @@ -247,7 +249,7 @@ int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, bool *autocommit, char *salt, YK_STATUS *st, bool *verbose, unsigned char *access_code, bool *use_access_code, - bool *aesviahash, + bool *aesviahash, char *ndef, int *exit_code) { int c; @@ -258,6 +260,7 @@ int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, bool option_seen = false; bool swap_seen = false; bool update_seen = false; + bool ndef_seen = false; ykp_configure_version(cfg, st); @@ -397,6 +400,14 @@ int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, *use_access_code = true; break; } + case 'n': + if (slot_chosen || swap_seen || update_seen) { + fprintf(stderr, "Ndef (-n) must be used on it's own.\n"); + *exit_code = 1; + return 0; + } + ndef = optarg; + ndef_seen = true; case 'o': if (strncmp(optarg, "salt=", 5) == 0) salt = strdup(optarg+5);