summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2019-02-19 05:12:07 +0100
committerNIIBE Yutaka <gniibe@fsij.org>2019-02-19 06:28:04 +0100
commit99aa54323f97937613e02d8c2da91544e1fe7bcf (patch)
treeb4775d33f2777831355ce16ce594e84668bc98ae /agent
parentagent: Factor out the getpin interaction. (diff)
downloadgnupg2-99aa54323f97937613e02d8c2da91544e1fe7bcf.tar.xz
gnupg2-99aa54323f97937613e02d8c2da91544e1fe7bcf.zip
agent: Minor change for pinentry status handling.
* agent/call-pinentry.c (struct entry_parm_s): Add status. (do_getpin): Use param->status. (agent_askpin): Copy param->status. to pininfo. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'agent')
-rw-r--r--agent/call-pinentry.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index c7ff70a4f..0c8f7dc0e 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -85,6 +85,7 @@ struct entry_parm_s
int lines;
size_t size;
unsigned char *buffer;
+ int status;
};
@@ -945,19 +946,16 @@ build_cmd_setdesc (char *line, size_t linelen, const char *desc)
* FIXME: Support EOF detection of the socket: ctrl->thread_startup.fd
*/
static gpg_error_t
-do_getpin (ctrl_t ctrl, struct entry_parm_s *parm,
- struct pin_entry_info_s *pininfo)
+do_getpin (ctrl_t ctrl, struct entry_parm_s *parm)
{
int rc;
- unsigned int pinentry_status;
int saveflag = assuan_get_flag (entry_ctx, ASSUAN_CONFIDENTIAL);
(void)ctrl;
assuan_begin_confidential (entry_ctx);
- pinentry_status = 0;
rc = assuan_transact (entry_ctx, "GETPIN", getpin_cb, parm,
inq_quality, entry_ctx,
- pinentry_status_cb, &pinentry_status);
+ pinentry_status_cb, &parm->status);
assuan_set_flag (entry_ctx, ASSUAN_CONFIDENTIAL, saveflag);
/* Most pinentries out in the wild return the old Assuan error code
for canceled which gets translated to an assuan Cancel error and
@@ -966,13 +964,10 @@ do_getpin (ctrl_t ctrl, struct entry_parm_s *parm,
rc = gpg_err_make (gpg_err_source (rc), GPG_ERR_CANCELED);
/* Change error code in case the window close button was clicked
to cancel the operation. */
- if ((pinentry_status & PINENTRY_STATUS_CLOSE_BUTTON)
+ if ((parm->status & PINENTRY_STATUS_CLOSE_BUTTON)
&& gpg_err_code (rc) == GPG_ERR_CANCELED)
rc = gpg_err_make (gpg_err_source (rc), GPG_ERR_FULLY_CANCELED);
- if (pininfo)
- pininfo->status = pinentry_status;
-
return rc;
}
@@ -1134,7 +1129,8 @@ agent_askpin (ctrl_t ctrl,
return unlock_pinentry (ctrl, rc);
}
- rc = do_getpin (ctrl, &parm, pininfo);
+ rc = do_getpin (ctrl, &parm);
+ pininfo->status = parm.status;
if (gpg_err_code (rc) == GPG_ERR_ASS_TOO_MUCH_DATA)
errtext = is_pin? L_("PIN too long")
: L_("Passphrase too long");
@@ -1289,7 +1285,7 @@ agent_get_passphrase (ctrl_t ctrl,
if (!parm.buffer)
return unlock_pinentry (ctrl, out_of_core ());
- rc = do_getpin (ctrl, &parm, NULL);
+ rc = do_getpin (ctrl, &parm);
if (rc)
xfree (parm.buffer);
else