(lookup_status_cb): Send progress messages

upstream.
(isvalid_status_cb): Ditto.
(gpgsm_dirmngr_isvalid): Put CTRL into status CB parameters.
(gpgsm_dirmngr_run_command, run_command_status_cb): Pass CTRL to
status callback and handle PROGRESS.
This commit is contained in:
Werner Koch 2004-12-15 14:38:37 +00:00
parent 69967b0412
commit 4350c58757
2 changed files with 41 additions and 3 deletions

View File

@ -1,5 +1,12 @@
2004-12-15 Werner Koch <wk@g10code.com>
* call-dirmngr.c (lookup_status_cb): Send progress messages
upstream.
(isvalid_status_cb): Ditto.
(gpgsm_dirmngr_isvalid): Put CTRL into status CB parameters.
(gpgsm_dirmngr_run_command, run_command_status_cb): Pass CTRL to
status callback and handle PROGRESS.
* misc.c (setup_pinentry_env) [W32]: Don't use it.
* gpgsm.c (main) [W32]: Init Pth because we need it for the socket

View File

@ -57,6 +57,7 @@ struct inq_certificate_parm_s {
};
struct isvalid_status_parm_s {
CTRL ctrl;
int seen;
unsigned char fpr[20];
};
@ -348,7 +349,16 @@ isvalid_status_cb (void *opaque, const char *line)
{
struct isvalid_status_parm_s *parm = opaque;
if (!strncmp (line, "ONLY_VALID_IF_CERT_VALID", 24)
if (!strncmp (line, "PROGRESS", 8) && (line[8]==' ' || !line[8]))
{
if (parm->ctrl)
{
for (line += 8; *line == ' '; line++)
;
gpgsm_status (parm->ctrl, STATUS_PROGRESS, line);
}
}
else if (!strncmp (line, "ONLY_VALID_IF_CERT_VALID", 24)
&& (line[24]==' ' || !line[24]))
{
parm->seen++;
@ -413,6 +423,7 @@ gpgsm_dirmngr_isvalid (ctrl_t ctrl,
parm.cert = cert;
parm.issuer_cert = issuer_cert;
stparm.ctrl = ctrl;
stparm.seen = 0;
memset (stparm.fpr, 0, 20);
@ -608,7 +619,16 @@ lookup_status_cb (void *opaque, const char *line)
{
struct lookup_parm_s *parm = opaque;
if (!strncmp (line, "TRUNCATED", 9) && (line[9]==' ' || !line[9]))
if (!strncmp (line, "PROGRESS", 8) && (line[8]==' ' || !line[8]))
{
if (parm->ctrl)
{
for (line += 8; *line == ' '; line++)
;
gpgsm_status (parm->ctrl, STATUS_PROGRESS, line);
}
}
else if (!strncmp (line, "TRUNCATED", 9) && (line[9]==' ' || !line[9]))
{
if (parm->ctrl)
{
@ -728,10 +748,21 @@ run_command_inq_cb (void *opaque, const char *line)
static AssuanError
run_command_status_cb (void *opaque, const char *line)
{
ctrl_t ctrl = opaque;
if (opt.verbose)
{
log_info ("dirmngr status: %s\n", line);
}
if (!strncmp (line, "PROGRESS", 8) && (line[8]==' ' || !line[8]))
{
if (ctrl)
{
for (line += 8; *line == ' '; line++)
;
gpgsm_status (ctrl, STATUS_PROGRESS, line);
}
}
return 0;
}
@ -790,7 +821,7 @@ gpgsm_dirmngr_run_command (CTRL ctrl, const char *command,
rc = assuan_transact (dirmngr_ctx, line,
run_command_cb, NULL,
run_command_inq_cb, &parm,
run_command_status_cb, NULL);
run_command_status_cb, ctrl);
xfree (line);
log_info ("response of dirmngr: %s\n", rc? assuan_strerror (rc): "okay");
return map_assuan_err (rc);