]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
anvil: Use fifo flag to detect shared FIFO connections from master
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 28 Apr 2026 16:22:04 +0000 (16:22 +0000)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Thu, 30 Apr 2026 06:41:03 +0000 (06:41 +0000)
The master process passes two pipes to anvil as listen fds: nonblocking_fd
for KILL notifications from the master itself, and blocking_fd shared by
all service processes for CONNECT/DISCONNECT/KILL. Only the first one was
detected as the master FIFO via listen_fd == MASTER_LISTEN_FD_FIRST, so
connections from service processes arriving via blocking_fd were
classified as regular admin connections.

This had no visible effect previously, but later commits restrict
CONNECT/DISCONNECT/KILL to the shared FIFO connection type, which would
reject these commands from service processes.

Use conn->fifo instead, which is TRUE for both master pipes and never
set for unix listeners that anvil currently has.

src/anvil/main.c

index 5c08f39c475d23a22bc15b4b2ff8ce2e5e707234..a4c72b2c216c66ca9d0a19287fbe77231257f2ad 100644 (file)
@@ -92,12 +92,13 @@ void admin_cmd_send(const char *service, pid_t pid, const char *cmd,
 
 static void client_connected(struct master_service_connection *conn)
 {
-       /* The first listen_fd is a pipe connected directly to the master
-          process. It's not actually the first configured listener in the
-          service settings. */
+       /* The master process passes two pipes to anvil as the first listen
+          fds: one for KILL notifications from the master itself, and one
+          shared by all service processes for CONNECT/DISCONNECT/KILL. Both
+          arrive here as fifo connections and use the same connection type. */
        enum anvil_connection_type type;
 
-       if (conn->listen_fd == MASTER_LISTEN_FD_FIRST)
+       if (conn->fifo)
                type = ANVIL_CONNECTION_TYPE_MASTER;
        else {
                const char *type_str = master_service_connection_get_type(conn);