diff options
author | Ben Kibbey <[email protected]> | 2011-04-10 20:06:18 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2011-04-12 16:04:53 +0000 |
commit | a9edbfb3a316e8c1bfa0373c39ad69a1e1c29080 (patch) | |
tree | f24c5063c3acbf78cad179c9466c32a69c6102b6 | |
parent | Added GENKEY --preset to add the passphrase of the generated key to the cache. (diff) | |
download | gnupg-a9edbfb3a316e8c1bfa0373c39ad69a1e1c29080.tar.gz gnupg-a9edbfb3a316e8c1bfa0373c39ad69a1e1c29080.zip |
Added PASSWD --preset.
Diffstat (limited to '')
-rw-r--r-- | agent/ChangeLog | 4 | ||||
-rw-r--r-- | agent/command.c | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog index 83ad65178..d4cea792c 100644 --- a/agent/ChangeLog +++ b/agent/ChangeLog @@ -1,5 +1,9 @@ 2011-04-10 Ben Kibbey <[email protected]> + * command.c: (cmd_passwd): Add option --preset. + +2011-04-10 Ben Kibbey <[email protected]> + * command.c: (cmd_genkey): Add option --preset. * genkey.c: (agent_genkey): Add parameter preset. diff --git a/agent/command.c b/agent/command.c index 0121a20de..8655c9998 100644 --- a/agent/command.c +++ b/agent/command.c @@ -1411,9 +1411,10 @@ cmd_learn (assuan_context_t ctx, char *line) static const char hlp_passwd[] = - "PASSWD [--cache-nonce=<c>] [--passwd-nonce=<s>] <hexstring_with_keygrip>\n" + "PASSWD [--cache-nonce=<c>] [--passwd-nonce=<s>] [--preset] <hexstring_with_keygrip>\n" "\n" - "Change the passphrase/PIN for the key identified by keygrip in LINE."; + "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"; static gpg_error_t cmd_passwd (assuan_context_t ctx, char *line) { @@ -1427,7 +1428,9 @@ cmd_passwd (assuan_context_t ctx, char *line) unsigned char *shadow_info = NULL; char *passphrase = NULL; char *pend; + int opt_preset; + opt_preset = has_option (line, "--preset"); cache_nonce = option_value (line, "--cache-nonce"); if (cache_nonce) { @@ -1525,6 +1528,12 @@ cmd_passwd (assuan_context_t ctx, char *line) ctrl->server_local->last_passwd_nonce = passwd_nonce; passwd_nonce = NULL; } + if (opt_preset) + { + char hexgrip[40+1]; + bin2hex(grip, 20, hexgrip); + err = agent_put_cache (hexgrip, CACHE_MODE_ANY, newpass, 900); + } } } xfree (newpass); |