--- lib/tevent/echo_server.c.orig 2019-01-15 10:07:00 UTC +++ lib/tevent/echo_server.c @@ -633,7 +633,7 @@ int main(int argc, const char **argv) exit(1); } - ret = listen(listen_sock, 5); + ret = listen(listen_sock, DEFAULT_LISTEN_BACKLOG); if (ret == -1) { perror("listen() failed"); exit(1); --- source3/include/local.h.orig 2019-01-15 10:07:00 UTC +++ source3/include/local.h @@ -173,7 +173,18 @@ #define WINBIND_SERVER_MUTEX_WAIT_TIME (( ((NUM_CLI_AUTH_CONNECT_RETRIES) * ((CLI_AUTH_TIMEOUT)/1000)) + 5)*2) /* size of listen() backlog in smbd */ +#if defined (FREEBSD) +#define SMBD_LISTEN_BACKLOG -1 +#else #define SMBD_LISTEN_BACKLOG 50 +#endif + +/* size of listen() default backlog */ +#if defined (FREEBSD) +#define DEFAULT_LISTEN_BACKLOG -1 +#else +#define DEFAULT_LISTEN_BACKLOG 5 +#endif /* Number of microseconds to wait before a sharing violation. */ #define SHARING_VIOLATION_USEC_WAIT 950000 --- source3/libsmb/unexpected.c.orig 2019-01-15 10:07:00 UTC +++ source3/libsmb/unexpected.c @@ -95,7 +95,7 @@ NTSTATUS nb_packet_server_create(TALLOC_ status = map_nt_error_from_unix(errno); goto fail; } - rc = listen(result->listen_sock, 5); + rc = listen(result->listen_sock, DEFAULT_LISTEN_BACKLOG); if (rc < 0) { status = map_nt_error_from_unix(errno); goto fail; --- source3/rpc_server/rpc_server.c.orig 2019-01-15 10:07:00 UTC +++ source3/rpc_server/rpc_server.c @@ -158,7 +158,7 @@ bool setup_named_pipe_socket(const char goto out; } - rc = listen(state->fd, 5); + rc = listen(state->fd, DEFAULT_LISTEN_BACKLOG); if (rc < 0) { DEBUG(0, ("Failed to listen on pipe socket %s: %s\n", pipe_name, strerror(errno))); @@ -830,7 +830,7 @@ bool setup_dcerpc_ncalrpc_socket(struct goto out; } - rc = listen(state->fd, 5); + rc = listen(state->fd, DEFAULT_LISTEN_BACKLOG); if (rc < 0) { DEBUG(0, ("Failed to listen on ncalrpc socket %s: %s\n", name, strerror(errno))); --- source3/utils/smbfilter.c.orig 2019-01-15 10:07:00 UTC +++ source3/utils/smbfilter.c @@ -291,7 +291,7 @@ static void start_filter(char *desthost) exit(1); } - if (listen(s, 5) == -1) { + if (listen(s, DEFAULT_LISTEN_BACKLOG) == -1) { d_printf("listen failed\n"); } --- source3/winbindd/winbindd.c.orig 2019-01-15 10:07:00 UTC +++ source3/winbindd/winbindd.c @@ -1317,7 +1317,7 @@ static bool winbindd_setup_listeners(voi if (pub_state->fd == -1) { goto failed; } - rc = listen(pub_state->fd, 5); + rc = listen(pub_state->fd, DEFAULT_LISTEN_BACKLOG); if (rc < 0) { goto failed; } @@ -1349,7 +1349,7 @@ static bool winbindd_setup_listeners(voi if (priv_state->fd == -1) { goto failed; } - rc = listen(priv_state->fd, 5); + rc = listen(priv_state->fd, DEFAULT_LISTEN_BACKLOG); if (rc < 0) { goto failed; }