You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, please add support for socket only listeners
Currently 'socket' configuration option takes effect only with enabled 'port' or 'tls_port' and if there is no socket file already exists in filesystem
POC patch:
+++ b/src/server.c
@@ -407,6 +407,10 @@ static int dm_bind_and_listen(int sock, struct sockaddr *saddr, socklen_t len, i
err = errno;
TRACE(TRACE_EMERG, "setsockopt::error [%s]", strerror(err));
}
+ if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &so_reuseaddress, sizeof(so_reuseaddress)) == -1) {
+ err = errno;
+ TRACE(TRACE_EMERG, "setsockopt::error [%s]", strerror(err));
+ }
/* bind the address */
if ((bind(sock, saddr, len)) == -1) {
err = errno;
@@ -442,6 +446,7 @@ static int create_unix_socket(ServerConfig_T * conf)
TRACE(TRACE_DEBUG, "create socket [%s] backlog [%d]", conf->socket, conf->backlog);
+ unlink(conf->socket);
// any error in dm_bind_and_listen is fatal
dm_bind_and_listen(sock, (struct sockaddr *)&un, sizeof(un), conf->backlog, FALSE);
@@ -796,7 +801,7 @@ int server_run(ServerConfig_T *conf)
if (server_setup(conf))
return -1;
- if (strlen(conf->port) || strlen(conf->ssl_port)) {
+ if (strlen(conf->port) || strlen(conf->ssl_port) || strlen(conf->socket)) {
if (MATCH(conf->service_name, "HTTP")) {
int port = atoi(conf->port);
The text was updated successfully, but these errors were encountered:
I'm confused as to your use case and what you are trying to accomplish. Clients using DBMail services expect ip:port based connections.
Although your patch doesn't apply using the current branch, setsockopt (@@ -407,6 +407,10) appears to duplicate the same four lines, and unlink (@@ -442,6 +446,7) is already in server_close_sockets so I'm unsure why you would add it to create_unix_socket.
Hi Alan-hicks,
I'm trying to use socket-only setup for dbmail-lmtpd service togehter with postfix (mailbox_transport = lmtp:unix:/dbmail/lmtp.sock) running on the same host. Listening inet port via dbmail-lmtpd is not required in this sittuation))
As I can see current implementation of dm_bind_and_listen uses setsockopt only for SO_REUSEADDR
and (@@ -407,6 +407,10) adds SO_REUSEPORT property
You are right that server_close_sockets already has unlink, but problem still appers if effective_user and effective_group used in configuration
socket file created with uid 0, while server_close_sockets executes with unprivilated user configured in effective_user and unlink failes to remove socket file in my setup
We can change uid/gid just after file creation in tail of create_unix_socket but this will not cover some scenarios when server_close_sockets can't be executed (killall -9 dbmail-lmtpd, server power failure , etc)
Hi, please add support for socket only listeners
Currently 'socket' configuration option takes effect only with enabled 'port' or 'tls_port' and if there is no socket file already exists in filesystem
POC patch:
The text was updated successfully, but these errors were encountered: