mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
Inform the client of the preset passphrase length.
* agent/command.c (cmd_preset_passphrase): Send the INQUIRE_MAXLEN status message before inquiring the passphrase.
This commit is contained in:
parent
2b3cb2ee94
commit
3f7788f2e0
1 changed files with 7 additions and 1 deletions
|
@ -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
|
/* Note that the passphrase will be truncated at any null byte and the
|
||||||
* limit is 480 characters. */
|
* 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
|
else
|
||||||
rc = set_error (GPG_ERR_NOT_IMPLEMENTED, "passphrase is required");
|
rc = set_error (GPG_ERR_NOT_IMPLEMENTED, "passphrase is required");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue