aboutsummaryrefslogtreecommitdiffstats
path: root/kbx/kbxserver.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2024-08-02 11:29:28 +0000
committerWerner Koch <[email protected]>2024-08-02 11:29:53 +0000
commitfa2c15634ca2c5f1c3f0483f1c74c76374e52da4 (patch)
tree8f52575d46f24bb149e683a6cd1dd9cc2cc16cf4 /kbx/kbxserver.c
parentdoc: Fix URL to the OpenPGP card specs (diff)
downloadgnupg-fa2c15634ca2c5f1c3f0483f1c74c76374e52da4.tar.gz
gnupg-fa2c15634ca2c5f1c3f0483f1c74c76374e52da4.zip
keyboxd: New getinfo subcommand "connections".
* kbx/kbxserver.c (cmd_getinfo): Add subcommand.
Diffstat (limited to 'kbx/kbxserver.c')
-rw-r--r--kbx/kbxserver.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kbx/kbxserver.c b/kbx/kbxserver.c
index 3e68bfc26..fc79209eb 100644
--- a/kbx/kbxserver.c
+++ b/kbx/kbxserver.c
@@ -745,6 +745,7 @@ static const char hlp_getinfo[] =
"pid - Return the process id of the server.\n"
"socket_name - Return the name of the socket.\n"
"session_id - Return the current session_id.\n"
+ "connections - Return number of active connections.\n"
"getenv NAME - Return value of envvar NAME\n";
static gpg_error_t
cmd_getinfo (assuan_context_t ctx, char *line)
@@ -792,6 +793,12 @@ cmd_getinfo (assuan_context_t ctx, char *line)
err = assuan_send_data (ctx, s, strlen (s));
}
}
+ else if (!strcmp (line, "connections"))
+ {
+ snprintf (numbuf, sizeof numbuf, "%d",
+ get_kbxd_active_connection_count ());
+ err = assuan_send_data (ctx, numbuf, strlen (numbuf));
+ }
else
err = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT");