diff -r -u samba-4.14.0rc4/ctdb/common/sock_daemon.c samba-4.14.0rc4-new/ctdb/common/sock_daemon.c
--- samba-4.14.0rc4/ctdb/common/sock_daemon.c	2021-01-21 14:20:40.000000000 +0100
+++ samba-4.14.0rc4-new/ctdb/common/sock_daemon.c	2021-03-02 10:19:13.523420000 +0100
@@ -240,7 +240,7 @@
 		return -1;
 	}
 
-	ret = listen(fd, 10);
+	ret = listen(fd, lp_socket_listen_backlog());
 	if (ret != 0) {
 		D_ERR("socket listen failed - %s\n", sockpath);
 		close(fd);
diff -r -u samba-4.14.0rc4/docs-xml/smbdotconf/misc/socketlistenbacklog.xml samba-4.14.0rc4-new/docs-xml/smbdotconf/misc/socketlistenbacklog.xml
--- samba-4.14.0rc4/docs-xml/smbdotconf/misc/socketlistenbacklog.xml	2021-03-02 10:36:34.553925000 +0100
+++ samba-4.14.0rc4-new/docs-xml/smbdotconf/misc/socketlistenbacklog.xml	2021-03-02 10:19:13.525072000 +0100
@@ -0,0 +1,14 @@
+<samba:parameter name="socket listen backlog"
+                 context="G"
+                 type="integer"
+                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+	<para>This parameter specifies the default size of the internal 
+	socket listen backlog (max number of queued TCP connections).
+	The parameter is not a hard limit and most operating systems
+	enforces a (much) smaller internal limit.
+	</para>
+</description>
+
+<value type="default">1000</value>
+</samba:parameter>
diff -r -u samba-4.14.0rc4/source3/libsmb/unexpected.c samba-4.14.0rc4-new/source3/libsmb/unexpected.c
--- samba-4.14.0rc4/source3/libsmb/unexpected.c	2021-01-21 14:20:40.000000000 +0100
+++ samba-4.14.0rc4-new/source3/libsmb/unexpected.c	2021-03-02 10:19:13.526475000 +0100
@@ -95,7 +95,7 @@
 		status = map_nt_error_from_unix(errno);
 		goto fail;
 	}
-	rc = listen(result->listen_sock, 5);
+	rc = listen(result->listen_sock, lp_socket_listen_backlog());
 	if (rc < 0) {
 		status = map_nt_error_from_unix(errno);
 		goto fail;
diff -r -u samba-4.14.0rc4/source3/param/loadparm.c samba-4.14.0rc4-new/source3/param/loadparm.c
--- samba-4.14.0rc4/source3/param/loadparm.c	2021-01-21 14:20:40.000000000 +0100
+++ samba-4.14.0rc4-new/source3/param/loadparm.c	2021-03-02 10:35:54.524182000 +0100
@@ -779,6 +779,7 @@
 
 	Globals.show_add_printer_wizard = true;
 	Globals.os_level = 20;
+	Globals.socket_listen_backlog = 50;
 	Globals.local_master = true;
 	Globals._domain_master = Auto;	/* depending on _domain_logons */
 	Globals._domain_logons = false;
diff -r -u samba-4.14.0rc4/source3/rpc_server/rpc_server.c samba-4.14.0rc4-new/source3/rpc_server/rpc_server.c
--- samba-4.14.0rc4/source3/rpc_server/rpc_server.c	2021-01-21 14:20:40.000000000 +0100
+++ samba-4.14.0rc4-new/source3/rpc_server/rpc_server.c	2021-03-02 10:20:53.490437000 +0100
@@ -277,7 +277,7 @@
 	state->termination_fn = term_fn;
 	state->termination_data = termination_data;
 
-	rc = listen(state->fd, SMBD_LISTEN_BACKLOG);
+	rc = listen(state->fd, lp_socket_listen_backlog());
 	if (rc < 0) {
 		err = errno;
 		DBG_ERR("listen(%d) failed: %s\n",
diff -r -u samba-4.14.0rc4/source3/smbd/server.c samba-4.14.0rc4-new/source3/smbd/server.c
--- samba-4.14.0rc4/source3/smbd/server.c	2021-01-21 14:20:40.000000000 +0100
+++ samba-4.14.0rc4-new/source3/smbd/server.c	2021-03-02 10:19:13.531533000 +0100
@@ -1096,7 +1096,7 @@
 	 * non-blocking for the accept. */
 	set_blocking(s->fd, False);
 
-	if (listen(s->fd, SMBD_LISTEN_BACKLOG) == -1) {
+	if (listen(s->fd, lp_socket_listen_backlog()) == -1) {
 		DEBUG(0,("smbd_open_one_socket: listen: "
 			"%s\n", strerror(errno)));
 			close(s->fd);
diff -r -u samba-4.14.0rc4/source3/utils/smbfilter.c samba-4.14.0rc4-new/source3/utils/smbfilter.c
--- samba-4.14.0rc4/source3/utils/smbfilter.c	2021-01-21 14:20:40.000000000 +0100
+++ samba-4.14.0rc4-new/source3/utils/smbfilter.c	2021-03-02 10:19:13.532179000 +0100
@@ -291,7 +291,7 @@
 		exit(1);
 	}
 
-	if (listen(s, 5) == -1) {
+	if (listen(s, lp_socket_listen_backlog()) == -1) {
 		d_printf("listen failed\n");
 	}
 
diff -r -u samba-4.14.0rc4/source3/winbindd/winbindd.c samba-4.14.0rc4-new/source3/winbindd/winbindd.c
--- samba-4.14.0rc4/source3/winbindd/winbindd.c	2021-02-04 09:24:37.000000000 +0100
+++ samba-4.14.0rc4-new/source3/winbindd/winbindd.c	2021-03-02 10:19:13.534044000 +0100
@@ -1300,6 +1300,14 @@
 	struct tevent_fd *fde;
 	int rc;
 	char *socket_path;
+	int listen_backlog = lp_winbind_max_clients();
+
+
+	if (listen_backlog < lp_socket_listen_backlog())
+	  listen_backlog = lp_socket_listen_backlog();
+
+	if (listen_backlog < 10)
+	  listen_backlog = 10;
 
 	pub_state = talloc(global_event_context(),
 			   struct winbindd_listen_state);
@@ -1313,7 +1321,7 @@
 	if (pub_state->fd == -1) {
 		goto failed;
 	}
-	rc = listen(pub_state->fd, 5);
+	rc = listen(pub_state->fd, listen_backlog);
 	if (rc < 0) {
 		goto failed;
 	}
@@ -1345,7 +1353,7 @@
 	if (priv_state->fd == -1) {
 		goto failed;
 	}
-	rc = listen(priv_state->fd, 5);
+	rc = listen(priv_state->fd, listen_backlog);
 	if (rc < 0) {
 		goto failed;
 	}
