1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

agent,dirmngr: Shutdown fix for supervised mode.

* agent/gpg-agent.c (handle_connections): Break if supervised.
* dirmngr/dirmngr.c (is_supervised): New.
(handle_connections): Break if supervised.

--

For supervised agent/dirmngr, 'systemctl stop' behaves just like
'gpgconf --kill', ignoring existing connections.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-05-26 15:28:13 +09:00
parent 09a96c9e1b
commit f15a643a2d
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054
2 changed files with 7 additions and 2 deletions

View File

@ -3115,7 +3115,7 @@ handle_connections (gnupg_fd_t listen_fd,
/* Shutdown test. */ /* Shutdown test. */
if (shutdown_pending) if (shutdown_pending)
{ {
if (active_connections == 0) if (active_connections == 0 || is_supervised)
break; /* ready */ break; /* ready */
/* Do not accept new connections but keep on running the /* Do not accept new connections but keep on running the

View File

@ -382,6 +382,9 @@ static enum
} tor_mode; } tor_mode;
/* Flag indicating that we are in supervised mode. */
static int is_supervised;
/* Counter for the active connections. */ /* Counter for the active connections. */
static int active_connections; static int active_connections;
@ -1303,6 +1306,8 @@ main (int argc, char **argv)
if (!opt.quiet) if (!opt.quiet)
log_info(_("WARNING: \"%s\" is a deprecated option\n"), "--supervised"); log_info(_("WARNING: \"%s\" is a deprecated option\n"), "--supervised");
is_supervised = 1;
/* In supervised mode, we expect file descriptor 3 to be an /* In supervised mode, we expect file descriptor 3 to be an
already opened, listening socket. already opened, listening socket.
@ -2362,7 +2367,7 @@ handle_connections (assuan_fd_t listen_fd)
/* Shutdown test. */ /* Shutdown test. */
if (shutdown_pending) if (shutdown_pending)
{ {
if (!active_connections) if (!active_connections || is_supervised)
break; /* ready */ break; /* ready */
/* Do not accept new connections but keep on running the /* Do not accept new connections but keep on running the