[pkg-opensc-commit] [opensc] 162/295: pkcs15-init, pkcs15-tool: reword --no-prompt to --use-pinpad (close #944) (#957)
Eric Dorland
eric at moszumanska.debian.org
Sat Jun 24 21:11:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository opensc.
commit 68f8f0bfa7f71ef6bc36688e1d59b35692873b34
Author: Nuno Goncalves <nunojpg at gmail.com>
Date: Fri Feb 3 17:01:52 2017 +0100
pkcs15-init,pkcs15-tool: reword --no-prompt to --use-pinpad (close #944) (#957)
* pkcs15-init,pkcs15-tool: reword --no-prompt to --use-pinpad (close #944)
Wording was confusing for a novice user. Old option is mantained as an alias,
but will print to stderr a deprecation warning.
Deprecation related code is all marked with deprecated word to easy future removal.
Signed-off-by: Nuno Goncalves <nunojpg at gmail.com>
* pkcs15-init,pkcs15-tool: document --use-pinpad
Signed-off-by: Nuno Goncalves <nunojpg at gmail.com>
---
doc/tools/pkcs15-init.1.xml | 7 +++++++
doc/tools/pkcs15-tool.1.xml | 7 +++++++
src/tools/pkcs15-init.c | 39 ++++++++++++++++++++++-----------------
src/tools/pkcs15-tool.c | 17 +++++++++++------
4 files changed, 47 insertions(+), 23 deletions(-)
diff --git a/doc/tools/pkcs15-init.1.xml b/doc/tools/pkcs15-init.1.xml
index 8f396c2..7b28af6 100644
--- a/doc/tools/pkcs15-init.1.xml
+++ b/doc/tools/pkcs15-init.1.xml
@@ -483,6 +483,13 @@
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ <option>--use-pinpad</option>
+ </term>
+ <listitem><para>Do not prompt the user; if no PINs supplied, pinpad will be used.</para></listitem>
+ </varlistentry>
+
</variablelist>
</para>
</refsect1>
diff --git a/doc/tools/pkcs15-tool.1.xml b/doc/tools/pkcs15-tool.1.xml
index ae471f8..2d8a62c 100644
--- a/doc/tools/pkcs15-tool.1.xml
+++ b/doc/tools/pkcs15-tool.1.xml
@@ -267,6 +267,13 @@
(without 'auth-id' the first non-SO, non-Unblock PIN will be verified)</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ <option>--use-pinpad</option>
+ </term>
+ <listitem><para>Do not prompt the user; if no PINs supplied, pinpad will be used.</para></listitem>
+ </varlistentry>
+
</variablelist>
</para>
</refsect1>
diff --git a/src/tools/pkcs15-init.c b/src/tools/pkcs15-init.c
index c067345..a1b183d 100644
--- a/src/tools/pkcs15-init.c
+++ b/src/tools/pkcs15-init.c
@@ -144,13 +144,14 @@ enum {
OPT_MD_CONTAINER_GUID,
OPT_VERSION,
- OPT_PIN1 = 0x10000, /* don't touch these values */
- OPT_PUK1 = 0x10001,
- OPT_PIN2 = 0x10002,
- OPT_PUK2 = 0x10003,
- OPT_SERIAL = 0x10004,
- OPT_NO_SOPIN = 0x10005,
- OPT_NO_PROMPT= 0x10006
+ OPT_PIN1 = 0x10000, /* don't touch these values */
+ OPT_PUK1 = 0x10001,
+ OPT_PIN2 = 0x10002,
+ OPT_PUK2 = 0x10003,
+ OPT_SERIAL = 0x10004,
+ OPT_NO_SOPIN = 0x10005,
+ OPT_USE_PINPAD= 0x10006,
+ OPT_USE_PINPAD_DEPRECATED
};
const struct option options[] = {
@@ -201,7 +202,8 @@ const struct option options[] = {
{ "insecure", no_argument, NULL, OPT_INSECURE },
{ "use-default-transport-keys",
no_argument, NULL, 'T' },
- { "no-prompt", no_argument, NULL, OPT_NO_PROMPT },
+ { "use-pinpad", no_argument, NULL, OPT_USE_PINPAD },
+ { "no-prompt", no_argument, NULL, OPT_USE_PINPAD_DEPRECATED },
{ "profile", required_argument, NULL, 'p' },
{ "card-profile", required_argument, NULL, 'c' },
@@ -264,6 +266,7 @@ static const char * option_help[] = {
"Insecure mode: do not require a PIN for private key",
"Do not ask for transport keys if the driver thinks it knows the key",
"Do not prompt the user; if no PINs supplied, pinpad will be used",
+ NULL,
"Specify the general profile to use",
"Specify the card profile to use",
@@ -344,7 +347,7 @@ static unsigned int opt_actions;
static int opt_extractable = 0,
opt_insecure = 0,
opt_authority = 0,
- opt_no_prompt = 0,
+ opt_use_pinpad = 0,
opt_no_sopin = 0,
opt_use_defkeys = 0,
opt_wait = 0,
@@ -804,14 +807,14 @@ do_init_app(struct sc_profile *profile)
so_puk_disabled = 1;
- if (!opt_pins[2] && !opt_no_prompt && !opt_no_sopin) {
+ if (!opt_pins[2] && !opt_use_pinpad && !opt_no_sopin) {
r = get_new_pin(&hints, role, "pin", &pins[2]);
if (r < 0)
goto failed;
opt_pins[2] = pins[2];
}
- if (!so_puk_disabled && opt_pins[2] && !opt_pins[3] && !opt_no_prompt) {
+ if (!so_puk_disabled && opt_pins[2] && !opt_pins[3] && !opt_use_pinpad) {
sc_pkcs15init_get_pin_info(profile, SC_PKCS15INIT_SO_PUK, &info);
if (!(info.attrs.pin.flags & SC_PKCS15_PIN_FLAG_SO_PIN))
@@ -1892,7 +1895,7 @@ get_pin_callback(struct sc_profile *profile,
char prompt[128];
int r;
- if (opt_no_prompt)
+ if (opt_use_pinpad)
return SC_ERROR_OBJECT_NOT_FOUND;
snprintf(prompt, sizeof(prompt), "%s required", name);
@@ -1958,9 +1961,9 @@ get_key_callback(struct sc_profile *profile,
}
printf("Transport key (%s #%d) required.\n", kind, reference);
- if (opt_no_prompt) {
+ if (opt_use_pinpad) {
printf("\n"
- "Refusing to prompt for transport key because --no-prompt\n"
+ "Refusing to prompt for transport key because --use-pinpad\n"
"was specified on the command line. Please invoke without\n"
"--no-prompt, or specify the --use-default-transport-keys\n"
"option to use the default transport keys without being\n"
@@ -2627,8 +2630,10 @@ handle_option(const struct option *opt)
case OPT_NO_SOPIN:
opt_no_sopin = 1;
break;
- case OPT_NO_PROMPT:
- opt_no_prompt = 1;
+ case OPT_USE_PINPAD_DEPRECATED:
+ fprintf(stderr, "'--no-prompt' is deprecated , use '--use-pinpad' instead.\n");
+ case OPT_USE_PINPAD:
+ opt_use_pinpad = 1;
break;
case OPT_ASSERT_PRISTINE:
this_action = ACTION_ASSERT_PRISTINE;
@@ -2969,7 +2974,7 @@ static int verify_pin(struct sc_pkcs15_card *p15card, char *auth_id_str)
else {
sc_ui_hints_t hints;
- if (opt_no_prompt)
+ if (opt_use_pinpad)
return SC_ERROR_OBJECT_NOT_FOUND;
if (pin_obj->label[0])
diff --git a/src/tools/pkcs15-tool.c b/src/tools/pkcs15-tool.c
index 4693f21..7c4c168 100644
--- a/src/tools/pkcs15-tool.c
+++ b/src/tools/pkcs15-tool.c
@@ -76,7 +76,7 @@ static const char * opt_pin = NULL;
static const char * opt_puk = NULL;
static int compact = 0;
static int verbose = 0;
-static int opt_no_prompt = 0;
+static int opt_use_pinpad = 0;
#if defined(ENABLE_OPENSSL) && (defined(_WIN32) || defined(HAVE_INTTYPES_H))
static int opt_rfc4716 = 0;
#endif
@@ -101,7 +101,8 @@ enum {
OPT_BIND_TO_AID,
OPT_LIST_APPLICATIONS,
OPT_LIST_SKEYS,
- OPT_NO_PROMPT,
+ OPT_USE_PINPAD,
+ OPT_USE_PINPAD_DEPRECATED,
OPT_RAW,
OPT_PRINT_VERSION,
OPT_LIST_INFO,
@@ -147,7 +148,8 @@ static const struct option options[] = {
{ "aid", required_argument, NULL, OPT_BIND_TO_AID },
{ "wait", no_argument, NULL, 'w' },
{ "verbose", no_argument, NULL, 'v' },
- { "no-prompt", no_argument, NULL, OPT_NO_PROMPT },
+ { "use-pinpad", no_argument, NULL, OPT_USE_PINPAD },
+ { "no-prompt", no_argument, NULL, OPT_USE_PINPAD_DEPRECATED },
{ NULL, 0, NULL, 0 }
};
@@ -188,6 +190,7 @@ static const char *option_help[] = {
"Wait for card insertion",
"Verbose operation. Use several times to enable debug output.",
"Do not prompt the user; if no PINs supplied, pinpad will be used.",
+ NULL,
NULL
};
@@ -1174,7 +1177,7 @@ static u8 * get_pin(const char *prompt, sc_pkcs15_object_t *pin_obj)
size_t len = 0;
int r;
- if (opt_no_prompt) {
+ if (opt_use_pinpad) {
// defer entry of the PIN to the readers pinpad.
if (verbose)
printf("%s [%.*s]: entry deferred to the reader keypad\n", prompt, (int) sizeof pin_obj->label, pin_obj->label);
@@ -2092,8 +2095,10 @@ int main(int argc, char * const argv[])
case 'w':
opt_wait = 1;
break;
- case OPT_NO_PROMPT:
- opt_no_prompt = 1;
+ case OPT_USE_PINPAD_DEPRECATED:
+ fprintf(stderr, "'--no-prompt' is deprecated , use '--use-pinpad' instead.\n");
+ case OPT_USE_PINPAD:
+ opt_use_pinpad = 1;
break;
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/opensc.git
More information about the pkg-opensc-commit
mailing list