diff options
author | Marcus Brinkmann <[email protected]> | 2006-07-29 16:40:54 +0000 |
---|---|---|
committer | Marcus Brinkmann <[email protected]> | 2006-07-29 16:40:54 +0000 |
commit | 6d77c76ef2de1b944141f9b5fbcd9392aaf1a4e7 (patch) | |
tree | 49d596d702cfec2b8cc42ccaf8c90c82d5200ac5 /agent/command.c | |
parent | 2006-07-29 Marcus Brinkmann <[email protected]> (diff) | |
download | gnupg-6d77c76ef2de1b944141f9b5fbcd9392aaf1a4e7.tar.gz gnupg-6d77c76ef2de1b944141f9b5fbcd9392aaf1a4e7.zip |
2006-07-29 Marcus Brinkmann <[email protected]>GNUPG-1-9-BRANCH
* preset-passphrase.c (preset_passphrase): Do not strip off last
character of passphrase.
(make_hexstring): New function.
* command.c (cmd_preset_passphrase): Use parse_hexstring to syntax
check passphrase argument. Truncate passphrase at delimiter.
Diffstat (limited to 'agent/command.c')
-rw-r--r-- | agent/command.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/agent/command.c b/agent/command.c index 12770dac8..1f3923522 100644 --- a/agent/command.c +++ b/agent/command.c @@ -794,7 +794,7 @@ cmd_passwd (ASSUAN_CONTEXT ctx, char *line) return map_to_assuan_status (rc); } -/* PRESET_PASSPHRASE <hexstring_with_keygrip> <timeout> <passwd> +/* PRESET_PASSPHRASE <hexstring_with_keygrip> <timeout> <hexstring> Set the cached passphrase/PIN for the key identified by the keygrip to passwd for the given time, where -1 means infinite and 0 means @@ -809,6 +809,7 @@ cmd_preset_passphrase (ASSUAN_CONTEXT ctx, char *line) char *grip_clear = NULL; char *passphrase = NULL; int ttl; + size_t len; if (!opt.allow_preset_passphrase) return gpg_error (GPG_ERR_NOT_SUPPORTED); @@ -837,6 +838,12 @@ cmd_preset_passphrase (ASSUAN_CONTEXT ctx, char *line) while (!(*line != ' ' && *line != '\t')) line++; + /* Syntax check the hexstring. */ + rc = parse_hexstring (ctx, line, &len); + if (rc) + return rc; + line[len] = '\0'; + /* If there is a passphrase, use it. Currently, a passphrase is required. */ if (*line) |