aboutsummaryrefslogtreecommitdiffstats
path: root/scd/command.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2008-06-24 16:00:29 +0000
committerWerner Koch <[email protected]>2008-06-24 16:00:29 +0000
commit4817ff652827d3b715315655c2272f774c20f42c (patch)
tree417ea337575f4e85c3bd9ca8cca822f10f548e1e /scd/command.c
parentCode cleanup. (diff)
downloadgnupg-4817ff652827d3b715315655c2272f774c20f42c.tar.gz
gnupg-4817ff652827d3b715315655c2272f774c20f42c.zip
Add support for the TCOS NullPIN feature.
Diffstat (limited to 'scd/command.c')
-rw-r--r--scd/command.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/scd/command.c b/scd/command.c
index 361b13f51..6a5241275 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -1273,17 +1273,23 @@ cmd_random (assuan_context_t ctx, char *line)
}
-/* PASSWD [--reset] <chvno>
+/* PASSWD [--reset] [--nullpin] <chvno>
Change the PIN or reset the retry counter of the card holder
- verfication vector CHVNO. */
+ verfication vector CHVNO. The option --nullpin is used for TCOS
+ cards to set the initial PIN. */
static int
cmd_passwd (assuan_context_t ctx, char *line)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
int rc;
char *chvnostr;
- int reset_mode = has_option (line, "--reset");
+ unsigned int flags = 0;
+
+ if (has_option (line, "--reset"))
+ flags |= APP_CHANGE_FLAG_RESET;
+ if (has_option (line, "--nullpin"))
+ flags |= APP_CHANGE_FLAG_NULLPIN;
if ( IS_LOCKED (ctrl) )
return gpg_error (GPG_ERR_LOCKED);
@@ -1312,7 +1318,7 @@ cmd_passwd (assuan_context_t ctx, char *line)
chvnostr = xtrystrdup (chvnostr);
if (!chvnostr)
return out_of_core ();
- rc = app_change_pin (ctrl->app_ctx, ctrl, chvnostr, reset_mode, pin_cb, ctx);
+ rc = app_change_pin (ctrl->app_ctx, ctrl, chvnostr, flags, pin_cb, ctx);
if (rc)
log_error ("command passwd failed: %s\n", gpg_strerror (rc));
xfree (chvnostr);