diff options
author | Ben Kibbey <[email protected]> | 2012-02-02 02:38:13 +0000 |
---|---|---|
committer | Ben Kibbey <[email protected]> | 2012-02-02 02:38:13 +0000 |
commit | 3f7788f2e035eb939abb27b3a53854ec0fc6178c (patch) | |
tree | f2155bb97e8330c2a3249533dc75ff293d7ee7da /agent/command.c | |
parent | Honor --cert-digest-algo when recreating a cert. (diff) | |
download | gnupg-3f7788f2e035eb939abb27b3a53854ec0fc6178c.tar.gz gnupg-3f7788f2e035eb939abb27b3a53854ec0fc6178c.zip |
Inform the client of the preset passphrase length.
* agent/command.c (cmd_preset_passphrase): Send the INQUIRE_MAXLEN
status message before inquiring the passphrase.
Diffstat (limited to 'agent/command.c')
-rw-r--r-- | agent/command.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/agent/command.c b/agent/command.c index 5fa8bceaf..732046ce3 100644 --- a/agent/command.c +++ b/agent/command.c @@ -1696,7 +1696,13 @@ cmd_preset_passphrase (assuan_context_t ctx, char *line) { /* Note that the passphrase will be truncated at any null byte and the * limit is 480 characters. */ - rc = assuan_inquire (ctx, "PASSPHRASE", &passphrase, &len, 480); + char buf[50]; + size_t maxlen = 480; + + snprintf (buf, sizeof (buf), "%u", maxlen); + rc = assuan_write_status (ctx, "INQUIRE_MAXLEN", buf); + if (!rc) + rc = assuan_inquire (ctx, "PASSPHRASE", &passphrase, &len, maxlen); } else rc = set_error (GPG_ERR_NOT_IMPLEMENTED, "passphrase is required"); |