From bd8346f7abdd6c163d563a2ed5059b514beb7c01 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 18 Dec 2023 16:23:19 +0100 Subject: 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 --- sm/keydb.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'sm') diff --git a/sm/keydb.c b/sm/keydb.c index 38737c96a..411720513 100644 --- a/sm/keydb.c +++ b/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. */ 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", NULL, NULL, store_inq_cb, &parm, - NULL, NULL); + keydb_default_status_cb, hd); goto leave; } @@ -1327,7 +1344,7 @@ keydb_delete (KEYDB_HANDLE hd) err = assuan_transact (hd->kbl->ctx, line, NULL, NULL, NULL, NULL, - NULL, NULL); + keydb_default_status_cb, hd); goto leave; } @@ -1555,6 +1572,8 @@ search_status_cb (void *opaque, const char *line) } } } + else + err = keydb_default_status_cb (opaque, line); return err; } -- cgit v1.2.3