]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:rpc_server: Listen in different socket for ncalrpc when role is AD DC
authorSamuel Cabrero <scabrero@samba.org>
Mon, 18 Nov 2019 11:46:04 +0000 (12:46 +0100)
committerSamuel Cabrero <scabrero@sn-devel-184>
Fri, 20 Mar 2020 15:36:34 +0000 (15:36 +0000)
If smbd and samba processes use DEFAULT as socket name they will race to
accept the NCALRPC connections.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/rpc_server/rpc_server.c

index d9777d12e9babc0fc547ef891ae6f323491f6504..e96397302d1ed15a334951ea21c7e89b937b59de 100644 (file)
@@ -486,12 +486,23 @@ NTSTATUS dcesrv_create_ncalrpc_socket(struct dcesrv_endpoint *e, int *out_fd)
                                                    "endpoint");
        if (endpoint == NULL) {
                /*
-                * No identifier specified: use DEFAULT.
+                * No identifier specified: use DEFAULT or SMBD.
+                *
+                * When role is AD DC we run two rpc server instances, the one
+                * started by 'samba' and the one embedded in 'smbd'.
+                * Avoid listening in DEFAULT socket for NCALRPC as both
+                * servers will race to accept connections. In this case smbd
+                * will listen in SMBD socket and rpcint binding handle
+                * implementation will pick the right socket to use.
                 *
                 * TODO: DO NOT hardcode this value anywhere else. Rather,
                 * specify no endpoint and let the epmapper worry about it.
                 */
-               endpoint = "DEFAULT";
+               if (lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC) {
+                       endpoint = "SMBD";
+               } else {
+                       endpoint = "DEFAULT";
+               }
                status = dcerpc_binding_set_string_option(e->ep_description,
                                                          "endpoint",
                                                          endpoint);