From: Timo Sirainen Date: Tue, 28 Apr 2026 16:22:04 +0000 (+0000) Subject: anvil: Use fifo flag to detect shared FIFO connections from master X-Git-Tag: 2.4.4~37 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=f73a8ca5fdff613d0e5ba2a799c10ca50f4b05c8;p=thirdparty%2Fdovecot%2Fcore.git anvil: Use fifo flag to detect shared FIFO connections from master 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. --- diff --git a/src/anvil/main.c b/src/anvil/main.c index 5c08f39c47..a4c72b2c21 100644 --- a/src/anvil/main.c +++ b/src/anvil/main.c @@ -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);