From: Fredrik Thulin Date: Wed, 23 May 2012 18:58:10 +0000 (+0200) Subject: Pass YK_KEY to args_to_config(). X-Git-Tag: v1.6.4~7 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8b3fcde50080f5634f51f505ea1e8c4426810f8;p=yubikey-personalization Pass YK_KEY to args_to_config(). Upcoming option -ooath-id needs this to read the serial number from the YubiKey we are about to program. --- diff --git a/tests/test_args_to_config.c b/tests/test_args_to_config.c index e33c9d0..6787c93 100644 --- a/tests/test_args_to_config.c +++ b/tests/test_args_to_config.c @@ -42,6 +42,7 @@ #include #include */ +#include /* duplicated from ykpers.c */ struct ykp_config_t { @@ -120,8 +121,8 @@ int _test_config (YKP_CONFIG *cfg, YK_STATUS *st, int argc, char **argv) /* copy version number from st into cfg */ assert(ykp_configure_for(cfg, 1, st) == 1); - /* call args_to_config from ykpersonalize.c with a fake set of program arguments */ - rc = args_to_config(argc, argv, cfg, + /* call args_to_config from ykpers-args.c with a fake set of program arguments */ + rc = args_to_config(argc, argv, cfg, yk, &infname, &outfname, &autocommit, salt, st, &verbose, @@ -299,8 +300,8 @@ int _test_non_config_args(void) /* copy version number from st into cfg */ assert(ykp_configure_for(cfg, 1, st) == 1); - /* call args_to_config from ykpersonalize.c with a fake set of program arguments */ - rc = args_to_config(argc, argv, cfg, + /* call args_to_config from ykpers-args.c with a fake set of program arguments */ + rc = args_to_config(argc, argv, cfg, yk, &infname, &outfname, &autocommit, salt, st, &verbose, diff --git a/ykpers-args.c b/ykpers-args.c index 6617de2..3117b33 100644 --- a/ykpers-args.c +++ b/ykpers-args.c @@ -189,7 +189,7 @@ void report_yk_error() * * Done in this way to be testable (see tests/test_args_to_config.c). */ -int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, +int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, YK_KEY *yk, const char **infname, const char **outfname, bool *autocommit, char *salt, YK_STATUS *st, bool *verbose, diff --git a/ykpers-args.h b/ykpers-args.h index d45caf6..07b026d 100644 --- a/ykpers-args.h +++ b/ykpers-args.h @@ -33,7 +33,7 @@ const char *usage; -int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, +int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, YK_KEY *yk, const char **infname, const char **outfname, bool *autocommit, char *salt, YK_STATUS *st, bool *verbose, diff --git a/ykpersonalize.c b/ykpersonalize.c index 57490e9..aa93f7c 100644 --- a/ykpersonalize.c +++ b/ykpersonalize.c @@ -122,7 +122,7 @@ int main(int argc, char **argv) goto err; /* Parse all arguments in a testable way */ - if (! args_to_config(argc, argv, cfg, + if (! args_to_config(argc, argv, cfg, yk, &infname, &outfname, &autocommit, salt, st, &verbose,