aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2015-06-29 10:50:16 +0000
committerWerner Koch <[email protected]>2015-06-29 10:50:16 +0000
commit9bca96dbc5c32bdd00196462fde8c9ab94aeb28d (patch)
tree601edec2c949643bd073db438f73e6d722e86058 /agent/command.c
parentagent,w32: Do not create a useless socket with --enable-putty-support. (diff)
downloadgnupg-9bca96dbc5c32bdd00196462fde8c9ab94aeb28d.tar.gz
gnupg-9bca96dbc5c32bdd00196462fde8c9ab94aeb28d.zip
agent: Add --verify to the PASSWD command.
* agent/command.c (cmd_passwd): Add option --verify. -- GnuPG-bug-id: 1951 Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rw-r--r--agent/command.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/agent/command.c b/agent/command.c
index ccd51069b..a4932eff6 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -1691,10 +1691,13 @@ cmd_learn (assuan_context_t ctx, char *line)
static const char hlp_passwd[] =
- "PASSWD [--cache-nonce=<c>] [--passwd-nonce=<s>] [--preset] <hexkeygrip>\n"
+ "PASSWD [--cache-nonce=<c>] [--passwd-nonce=<s>] [--preset]\n"
+ " [--verify] <hexkeygrip>\n"
"\n"
- "Change the passphrase/PIN for the key identified by keygrip in LINE. When\n"
- "--preset is used then the new passphrase will be added to the cache.\n";
+ "Change the passphrase/PIN for the key identified by keygrip in LINE. If\n"
+ "--preset is used then the new passphrase will be added to the cache.\n"
+ "If --verify is used the command asks for the passphrase and verifies\n"
+ "that the passphrase valid.\n";
static gpg_error_t
cmd_passwd (assuan_context_t ctx, char *line)
{
@@ -1708,13 +1711,14 @@ cmd_passwd (assuan_context_t ctx, char *line)
unsigned char *shadow_info = NULL;
char *passphrase = NULL;
char *pend;
- int opt_preset;
+ int opt_preset, opt_verify;
if (ctrl->restricted)
return leave_cmd (ctx, gpg_error (GPG_ERR_FORBIDDEN));
opt_preset = has_option (line, "--preset");
cache_nonce = option_value (line, "--cache-nonce");
+ opt_verify = has_option (line, "--verify");
if (cache_nonce)
{
for (pend = cache_nonce; *pend && !spacep (pend); pend++)
@@ -1753,7 +1757,9 @@ cmd_passwd (assuan_context_t ctx, char *line)
goto leave;
ctrl->in_passwd++;
- err = agent_key_from_file (ctrl, cache_nonce, ctrl->server_local->keydesc,
+ err = agent_key_from_file (ctrl,
+ opt_verify? NULL : cache_nonce,
+ ctrl->server_local->keydesc,
grip, &shadow_info, CACHE_MODE_IGNORE, NULL,
&s_skey, &passphrase);
if (err)
@@ -1763,6 +1769,10 @@ cmd_passwd (assuan_context_t ctx, char *line)
log_error ("changing a smartcard PIN is not yet supported\n");
err = gpg_error (GPG_ERR_NOT_IMPLEMENTED);
}
+ else if (opt_verify)
+ {
+ /* All done. */
+ }
else
{
char *newpass = NULL;