On 03/15/2012 03:05 PM, Timo Sirainen wrote:
On Thu, 2012-03-15 at 14:34 +0100, Michal Hlavinka wrote:
What exactly should happen when dovecot.conf does not match dovecot.socket configuration?
Dovecot's systemd code was written by one of you Redhat guys. I had some similar thoughts when I applied the patch, but didn't really know what to do about it, so I didn't do anything. So: I don't know. Maybe some other project has solved this somehow already?
Seems other projects did not solve this yet. Most projects provide just one service. In that case, they serve any connection they get, because they know what to do.
I've discussed this with systemd upstream and we've decided that the best solution is to log error message and close that socket.
Dovecot anyway needs its own internal UNIX listeners. Should all internal inet listeners be disabled? Could Dovecot somehow talk to systemd and ask what listeners it's using for Dovecot and log warnings if they don't match?
I don't understand this question completely. What it does already is that during start up, when dovecot creates sockets, it checks what sockets already exist and creates only the missing ones.
Systemd provides following functions: sd_is_fifo (3) - Check the type of a file descriptor sd_is_mq (3) - Check the type of a file descriptor sd_is_socket (3) - Check the type of a file descriptor sd_is_socket_inet (3) - Check the type of a file descriptor sd_is_socket_unix (3) - Check the type of a file descriptor sd_listen_fds (3) - Check for file descriptors passed by the init system.
http://0pointer.de/public/systemd-man/sd_listen_fds.html
I wrote simple patch that close the extra sockets. It's tested and works fine. You'll maybe want to move that function to different place and/or change wording of error messages.
Michal