Parse INQUIRE_MAXLEN in the passphrase callback.
* src/passphrase.c (_gpgme_passphrase_status_handler): Parse GPGME_STATUS_INQUIRE_MAXLEN. * src/passphrase.c (_gpgme_passphrase_command_handler): Send the INQUIRE_MAXLEN status message. -- Fixes passing this status message along when decrypting symmetric data from gpg.
This commit is contained in:
parent
70b3e5964e
commit
ccbaccbf2e
@ -41,6 +41,7 @@ typedef struct
|
|||||||
char *uid_hint;
|
char *uid_hint;
|
||||||
char *passphrase_info;
|
char *passphrase_info;
|
||||||
int bad_passphrase;
|
int bad_passphrase;
|
||||||
|
char *maxlen;
|
||||||
} *op_data_t;
|
} *op_data_t;
|
||||||
|
|
||||||
|
|
||||||
@ -53,6 +54,7 @@ release_op_data (void *hook)
|
|||||||
free (opd->passphrase_info);
|
free (opd->passphrase_info);
|
||||||
if (opd->uid_hint)
|
if (opd->uid_hint)
|
||||||
free (opd->uid_hint);
|
free (opd->uid_hint);
|
||||||
|
free (opd->maxlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -73,6 +75,11 @@ _gpgme_passphrase_status_handler (void *priv, gpgme_status_code_t code,
|
|||||||
|
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
|
case GPGME_STATUS_INQUIRE_MAXLEN:
|
||||||
|
free (opd->maxlen);
|
||||||
|
if (!(opd->maxlen = strdup (args)))
|
||||||
|
return gpg_error_from_syserror ();
|
||||||
|
break;
|
||||||
case GPGME_STATUS_USERID_HINT:
|
case GPGME_STATUS_USERID_HINT:
|
||||||
if (opd->uid_hint)
|
if (opd->uid_hint)
|
||||||
free (opd->uid_hint);
|
free (opd->uid_hint);
|
||||||
@ -141,9 +148,14 @@ _gpgme_passphrase_command_handler (void *priv, gpgme_status_code_t code,
|
|||||||
if (processed)
|
if (processed)
|
||||||
*processed = 1;
|
*processed = 1;
|
||||||
|
|
||||||
err = ctx->passphrase_cb (ctx->passphrase_cb_value,
|
if (ctx->status_cb && opd->maxlen)
|
||||||
opd->uid_hint, opd->passphrase_info,
|
err = ctx->status_cb (ctx->status_cb_value, "INQUIRE_MAXLEN",
|
||||||
opd->bad_passphrase, fd);
|
opd->maxlen);
|
||||||
|
|
||||||
|
if (!err)
|
||||||
|
err = ctx->passphrase_cb (ctx->passphrase_cb_value,
|
||||||
|
opd->uid_hint, opd->passphrase_info,
|
||||||
|
opd->bad_passphrase, fd);
|
||||||
|
|
||||||
/* Reset bad passphrase flag, in case it is correct now. */
|
/* Reset bad passphrase flag, in case it is correct now. */
|
||||||
opd->bad_passphrase = 0;
|
opd->bad_passphrase = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user