From: Samuel Cabrero Date: Mon, 18 Nov 2019 11:46:04 +0000 (+0100) Subject: s3:rpc_server: Listen in different socket for ncalrpc when role is AD DC X-Git-Tag: ldb-2.2.0~1328 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0ff6da277b16015cf3aaa6f44c10e7cf0979994;p=thirdparty%2Fsamba.git s3:rpc_server: Listen in different socket for ncalrpc when role is AD DC If smbd and samba processes use DEFAULT as socket name they will race to accept the NCALRPC connections. Signed-off-by: Samuel Cabrero Reviewed-by: Andrew Bartlett --- diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index d9777d12e9b..e96397302d1 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -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);