From d01a5a0d2052db3ee5d71c772abf98fc20bfccc6 Mon Sep 17 00:00:00 2001 From: "levitte@gmail.com" Date: Fri, 18 Sep 2009 10:51:18 +0000 Subject: [PATCH] The return code from hex_modhex_decode() was incorrectly treated. new_access_code was improperly set. git-svn-id: https://yubikey-personalization.googlecode.com/svn/trunk@205 b62f149e-849f-11dd-9899-c7ba65f7c4c7 --- ykpersonalize.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ykpersonalize.c b/ykpersonalize.c index aa637a7..46f9944 100644 --- a/ykpersonalize.c +++ b/ykpersonalize.c @@ -245,7 +245,7 @@ int main(int argc, char **argv) int rc = hex_modhex_decode(access_code, &access_code_len, optarg, strlen(optarg), 12, 12, false); - if (rc < 0) { + if (rc <= 0) { fprintf(stderr, "Invalid access code string: %s\n", optarg); @@ -270,7 +270,7 @@ int main(int argc, char **argv) int rc = hex_modhex_decode(fixedbin, &fixedbinlen, fixed, fixedlen, 0, 16, true); - if (rc < 0) { + if (rc <= 0) { fprintf(stderr, "Invalid fixed string: %s\n", fixed); @@ -278,7 +278,6 @@ int main(int argc, char **argv) goto err; } ykp_set_fixed(cfg, fixedbin, fixedbinlen); - new_access_code = true; } else if (strncmp(optarg, "uid=", 4) == 0) { const char *uid = optarg+4; @@ -288,7 +287,7 @@ int main(int argc, char **argv) int rc = hex_modhex_decode(uidbin, &uidbinlen, uid, uidlen, 12, 12, false); - if (rc < 0) { + if (rc <= 0) { fprintf(stderr, "Invalid uid string: %s\n", uid); @@ -305,7 +304,7 @@ int main(int argc, char **argv) int rc = hex_modhex_decode (accbin, &accbinlen, acc, acclen, 12, 12, false); - if (rc < 0) { + if (rc <= 0) { fprintf(stderr, "Invalid access code string: %s\n", acc); @@ -313,6 +312,7 @@ int main(int argc, char **argv) goto err; } ykp_set_access_code(cfg, accbin, accbinlen); + new_access_code = true; } else if (strcmp(optarg, "tab-first") == 0) ykp_set_tktflag_TAB_FIRST(cfg, true); -- 2.39.5