1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-09-20 14:51:42 +02:00

keyboxd: New getinfo subcommand "connections".

* kbx/kbxserver.c (cmd_getinfo): Add subcommand.
This commit is contained in:
Werner Koch 2024-08-02 13:29:28 +02:00
parent c16604246a
commit fa2c15634c
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
2 changed files with 7 additions and 1 deletions

View File

@ -745,6 +745,7 @@ static const char hlp_getinfo[] =
"pid - Return the process id of the server.\n" "pid - Return the process id of the server.\n"
"socket_name - Return the name of the socket.\n" "socket_name - Return the name of the socket.\n"
"session_id - Return the current session_id.\n" "session_id - Return the current session_id.\n"
"connections - Return number of active connections.\n"
"getenv NAME - Return value of envvar NAME\n"; "getenv NAME - Return value of envvar NAME\n";
static gpg_error_t static gpg_error_t
cmd_getinfo (assuan_context_t ctx, char *line) 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)); 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 else
err = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT"); err = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT");

View File

@ -28,7 +28,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <assert.h>
#include <time.h> #include <time.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>