mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
keyboxd: Pass lock info back to gpg and gpgsm.
* g10/call-keyboxd.c (keydb_default_status_cb): New. (keydb_update_keyblock): Add new status callback. (keydb_insert_keyblock): Ditto. (keydb_delete_keyblock): Ditto. (search_status_cb): Also try the new status callback. * sm/keydb.c (keydb_default_status_cb): New. (keydb_insert_cert): Add new status callback. (keydb_delete): Ditto (search_status_cb): Also try the new status callback. -- GnuPG-bug-id: 6838
This commit is contained in:
parent
c99282fc78
commit
bd8346f7ab
@ -385,6 +385,23 @@ keydb_get_keyblock (KEYDB_HANDLE hd, kbnode_t *ret_kb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Default status callback used to show diagnostics from the keyboxd */
|
||||||
|
static gpg_error_t
|
||||||
|
keydb_default_status_cb (void *opaque, const char *line)
|
||||||
|
{
|
||||||
|
const char *s;
|
||||||
|
|
||||||
|
(void)opaque;
|
||||||
|
|
||||||
|
if ((s = has_leading_keyword (line, "NOTE")))
|
||||||
|
log_info (_("Note: %s\n"), s);
|
||||||
|
else if ((s = has_leading_keyword (line, "WARNING")))
|
||||||
|
log_info (_("WARNING: %s\n"), s);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Communication object for STORE commands. */
|
/* Communication object for STORE commands. */
|
||||||
struct store_parm_s
|
struct store_parm_s
|
||||||
@ -464,7 +481,8 @@ keydb_update_keyblock (ctrl_t ctrl, KEYDB_HANDLE hd, kbnode_t kb)
|
|||||||
err = assuan_transact (hd->kbl->ctx, "STORE --update",
|
err = assuan_transact (hd->kbl->ctx, "STORE --update",
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
store_inq_cb, &parm,
|
store_inq_cb, &parm,
|
||||||
NULL, NULL);
|
keydb_default_status_cb, hd);
|
||||||
|
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
iobuf_close (iobuf);
|
iobuf_close (iobuf);
|
||||||
@ -515,7 +533,7 @@ keydb_insert_keyblock (KEYDB_HANDLE hd, kbnode_t kb)
|
|||||||
err = assuan_transact (hd->kbl->ctx, "STORE --insert",
|
err = assuan_transact (hd->kbl->ctx, "STORE --insert",
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
store_inq_cb, &parm,
|
store_inq_cb, &parm,
|
||||||
NULL, NULL);
|
keydb_default_status_cb, hd);
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
iobuf_close (iobuf);
|
iobuf_close (iobuf);
|
||||||
@ -561,7 +579,7 @@ keydb_delete_keyblock (KEYDB_HANDLE hd)
|
|||||||
err = assuan_transact (hd->kbl->ctx, line,
|
err = assuan_transact (hd->kbl->ctx, line,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
NULL, NULL);
|
keydb_default_status_cb, hd);
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
return err;
|
return err;
|
||||||
@ -648,6 +666,8 @@ search_status_cb (void *opaque, const char *line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
err = keydb_default_status_cb (opaque, line);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -399,10 +399,10 @@ kbx_client_data_cmd (kbx_client_data_t kcd, const char *command,
|
|||||||
status_cb, status_cb_value);
|
status_cb, status_cb_value);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
if (gpg_err_code (err) != GPG_ERR_NOT_FOUND
|
/* if (gpg_err_code (err) != GPG_ERR_NOT_FOUND */
|
||||||
&& gpg_err_code (err) != GPG_ERR_NOTHING_FOUND)
|
/* && gpg_err_code (err) != GPG_ERR_NOTHING_FOUND) */
|
||||||
log_debug ("%s: finished command with error: %s\n",
|
/* log_debug ("%s: finished command with error: %s\n", */
|
||||||
__func__, gpg_strerror (err));
|
/* __func__, gpg_strerror (err)); */
|
||||||
xfree (get_membuf (&mb, &len));
|
xfree (get_membuf (&mb, &len));
|
||||||
kcd->dlineerr = err;
|
kcd->dlineerr = err;
|
||||||
goto leave;
|
goto leave;
|
||||||
|
23
sm/keydb.c
23
sm/keydb.c
@ -1129,6 +1129,23 @@ keydb_set_flags (KEYDB_HANDLE hd, int which, int idx, unsigned int value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Default status callback used to show diagnostics from the keyboxd */
|
||||||
|
static gpg_error_t
|
||||||
|
keydb_default_status_cb (void *opaque, const char *line)
|
||||||
|
{
|
||||||
|
const char *s;
|
||||||
|
|
||||||
|
(void)opaque;
|
||||||
|
|
||||||
|
if ((s = has_leading_keyword (line, "NOTE")))
|
||||||
|
log_info (_("Note: %s\n"), s);
|
||||||
|
else if ((s = has_leading_keyword (line, "WARNING")))
|
||||||
|
log_info (_("WARNING: %s\n"), s);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Communication object for Keyboxd STORE commands. */
|
/* Communication object for Keyboxd STORE commands. */
|
||||||
struct store_parm_s
|
struct store_parm_s
|
||||||
@ -1192,7 +1209,7 @@ keydb_insert_cert (KEYDB_HANDLE hd, ksba_cert_t cert)
|
|||||||
err = assuan_transact (hd->kbl->ctx, "STORE --insert",
|
err = assuan_transact (hd->kbl->ctx, "STORE --insert",
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
store_inq_cb, &parm,
|
store_inq_cb, &parm,
|
||||||
NULL, NULL);
|
keydb_default_status_cb, hd);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1327,7 +1344,7 @@ keydb_delete (KEYDB_HANDLE hd)
|
|||||||
err = assuan_transact (hd->kbl->ctx, line,
|
err = assuan_transact (hd->kbl->ctx, line,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
NULL, NULL);
|
keydb_default_status_cb, hd);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1555,6 +1572,8 @@ search_status_cb (void *opaque, const char *line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
err = keydb_default_status_cb (opaque, line);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user