From: Klas Lindfors Date: Wed, 8 Jan 2014 11:23:58 +0000 (+0100) Subject: pass a reference to the salt to args_to_config() X-Git-Tag: v1.15.0~21 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca87f9c84cb33696e7e032262a50efc57318cb38;p=yubikey-personalization pass a reference to the salt to args_to_config() otherwise we won't get a salt back even when we ask for it --- diff --git a/tests/test_args_to_config.c b/tests/test_args_to_config.c index b742844..eb8b5d3 100644 --- a/tests/test_args_to_config.c +++ b/tests/test_args_to_config.c @@ -143,7 +143,7 @@ int _test_config (YKP_CONFIG *cfg, YK_STATUS *st, int argc, char **argv) rc = args_to_config(argc, argv, cfg, yk, &infname, &outfname, &data_format, - &autocommit, salt, + &autocommit, &salt, st, &verbose, &dry_run, access_code, &use_access_code, &aesviahash, &ndef_type, ndef, &usb_mode, &zap, @@ -342,7 +342,7 @@ int _test_non_config_args(void) rc = args_to_config(argc, argv, cfg, yk, &infname, &outfname, &data_format, - &autocommit, salt, + &autocommit, &salt, st, &verbose, &dry_run, access_code, &use_access_code, &aesviahash, &ndef_type, ndef, &usb_mode, &zap, diff --git a/ykpers-args.c b/ykpers-args.c index 66ea07e..a6d1096 100644 --- a/ykpers-args.c +++ b/ykpers-args.c @@ -229,7 +229,7 @@ void report_yk_error(void) int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, YK_KEY *yk, const char **infname, const char **outfname, int *data_format, - bool *autocommit, char *salt, + bool *autocommit, char **salt, YK_STATUS *st, bool *verbose, bool *dry_run, unsigned char *access_code, bool *use_access_code, bool *aesviahash, char *ndef_type, char *ndef, @@ -494,7 +494,7 @@ int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, YK_KEY *yk, return 0; } if (strncmp(optarg, "salt=", 5) == 0) - salt = strdup(optarg+5); + *salt = strdup(optarg+5); else if (strncmp(optarg, "fixed=", 6) == 0) { if (_set_fixed(optarg + 6, cfg) != 1) { fprintf(stderr, diff --git a/ykpers-args.h b/ykpers-args.h index 235a6cf..2d3b542 100644 --- a/ykpers-args.h +++ b/ykpers-args.h @@ -36,7 +36,7 @@ const char *usage; int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, YK_KEY *yk, const char **infname, const char **outfname, int *data_format, - bool *autocommit, char *salt, + bool *autocommit, char **salt, YK_STATUS *st, bool *verbose, bool *dry_run, unsigned char *access_code, bool *use_access_code, bool *aesviahash, char *ndef_type, char *ndef, unsigned char *usb_mode, diff --git a/ykpersonalize.c b/ykpersonalize.c index 8ad1682..9985930 100644 --- a/ykpersonalize.c +++ b/ykpersonalize.c @@ -124,7 +124,7 @@ int main(int argc, char **argv) if (! args_to_config(argc, argv, cfg, yk, &infname, &outfname, &data_format, - &autocommit, salt, + &autocommit, &salt, st, &verbose, &dry_run, access_code, &use_access_code, &aesviahash, &ndef_type, ndef_string,