aboutsummaryrefslogtreecommitdiffstats
path: root/g10/call-keyboxd.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-12-18 15:23:19 +0000
committerWerner Koch <[email protected]>2023-12-18 15:23:19 +0000
commitbd8346f7abdd6c163d563a2ed5059b514beb7c01 (patch)
treeb7efadff46cd6739f4742951c8820c75c99d28a7 /g10/call-keyboxd.c
parentkeyboxd: Timeout on failure to get the database lock. (diff)
downloadgnupg-bd8346f7abdd6c163d563a2ed5059b514beb7c01.tar.gz
gnupg-bd8346f7abdd6c163d563a2ed5059b514beb7c01.zip
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
Diffstat (limited to 'g10/call-keyboxd.c')
-rw-r--r--g10/call-keyboxd.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/g10/call-keyboxd.c b/g10/call-keyboxd.c
index 7f4d5f493..121b7aa2a 100644
--- a/g10/call-keyboxd.c
+++ b/g10/call-keyboxd.c
@@ -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. */
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",
NULL, NULL,
store_inq_cb, &parm,
- NULL, NULL);
+ keydb_default_status_cb, hd);
+
leave:
iobuf_close (iobuf);
@@ -515,7 +533,7 @@ keydb_insert_keyblock (KEYDB_HANDLE hd, kbnode_t kb)
err = assuan_transact (hd->kbl->ctx, "STORE --insert",
NULL, NULL,
store_inq_cb, &parm,
- NULL, NULL);
+ keydb_default_status_cb, hd);
leave:
iobuf_close (iobuf);
@@ -561,7 +579,7 @@ keydb_delete_keyblock (KEYDB_HANDLE hd)
err = assuan_transact (hd->kbl->ctx, line,
NULL, NULL,
NULL, NULL,
- NULL, NULL);
+ keydb_default_status_cb, hd);
leave:
return err;
@@ -648,6 +666,8 @@ search_status_cb (void *opaque, const char *line)
}
}
}
+ else
+ err = keydb_default_status_cb (opaque, line);
return err;
}