1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-05-31 22:18:03 +02:00

Also let GENKEY and PKDECRYPT send the INQUIRE_MAXLEN status message.

* agent/command.c (cmd_pkdecrypt): Send the INQUIRE_MAXLEN status
message before doing the inquire.
(cmd_genkey): Ditto.
This commit is contained in:
Ben Kibbey 2012-02-03 17:50:22 -05:00
parent 3f7788f2e0
commit ecda65498a

View File

@ -855,12 +855,16 @@ cmd_pkdecrypt (assuan_context_t ctx, char *line)
unsigned char *value; unsigned char *value;
size_t valuelen; size_t valuelen;
membuf_t outbuf; membuf_t outbuf;
char buf[50];
(void)line; (void)line;
/* First inquire the data to decrypt */ /* First inquire the data to decrypt */
rc = assuan_inquire (ctx, "CIPHERTEXT", snprintf (buf, sizeof (buf), "%u", MAXLEN_CIPHERTEXT);
&value, &valuelen, MAXLEN_CIPHERTEXT); rc = assuan_write_status (ctx, "INQUIRE_MAXLEN", buf);
if (!rc)
rc = assuan_inquire (ctx, "CIPHERTEXT",
&value, &valuelen, MAXLEN_CIPHERTEXT);
if (rc) if (rc)
return rc; return rc;
@ -908,6 +912,7 @@ cmd_genkey (assuan_context_t ctx, char *line)
char *cache_nonce = NULL; char *cache_nonce = NULL;
int opt_preset; int opt_preset;
char *p; char *p;
char buf[50];
opt_preset = has_option (line, "--preset"); opt_preset = has_option (line, "--preset");
no_protection = has_option (line, "--no-protection"); no_protection = has_option (line, "--no-protection");
@ -921,7 +926,10 @@ cmd_genkey (assuan_context_t ctx, char *line)
cache_nonce = xtrystrdup (line); cache_nonce = xtrystrdup (line);
/* First inquire the parameters */ /* First inquire the parameters */
rc = assuan_inquire (ctx, "KEYPARAM", &value, &valuelen, MAXLEN_KEYPARAM); snprintf (buf, sizeof (buf), "%u", MAXLEN_KEYPARAM);
rc = assuan_write_status (ctx, "INQUIRE_MAXLEN", buf);
if (!rc)
rc = assuan_inquire (ctx, "KEYPARAM", &value, &valuelen, MAXLEN_KEYPARAM);
if (rc) if (rc)
return rc; return rc;