From 32a53be1a4587a72ffe35d8cfd3a97c425a36470 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 10 Aug 2011 16:13:42 -0400 Subject: s3-rpc_server: Use rpc_service_mode() in np_open() Signed-off-by: Andreas Schneider Signed-off-by: Simo Sorce --- source3/rpc_server/srv_pipe_hnd.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'source3') diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 5c906561c0..3616922b9b 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -27,6 +27,7 @@ #include "rpc_server/srv_pipe_hnd.h" #include "rpc_server/srv_pipe.h" #include "rpc_server/rpc_server.h" +#include "rpc_server/rpc_config.h" #include "../lib/tsocket/tsocket.h" #include "../lib/util/tevent_ntstatus.h" @@ -415,10 +416,10 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name, struct messaging_context *msg_ctx, struct fake_file_handle **phandle) { - const char *rpcsrv_type; + enum rpc_service_mode_e pipe_mode; const char **proxy_list; struct fake_file_handle *handle; - bool external = false; + struct ndr_syntax_id syntax; proxy_list = lp_parm_string_list(-1, "np", "proxy", NULL); @@ -429,43 +430,42 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name, /* Check what is the server type for this pipe. Defaults to "embedded" */ - rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM, - "rpc_server", name, - "embedded"); - if (strcasecmp_m(rpcsrv_type, "external") == 0 || - strcasecmp_m(rpcsrv_type, "daemon") == 0) { - external = true; - } + pipe_mode = rpc_service_mode(name); /* Still support the old method for defining external servers */ if ((proxy_list != NULL) && str_list_check_ci(proxy_list, name)) { - external = true; + pipe_mode = RPC_SERVICE_MODE_EXTERNAL; } - if (external) { - struct np_proxy_state *p; + switch (pipe_mode) { + case RPC_SERVICE_MODE_EXTERNAL: - p = make_external_rpc_pipe_p(handle, name, + handle->private_data = (void *)make_external_rpc_pipe_p( + handle, name, local_address, remote_address, session_info); handle->type = FAKE_FILE_TYPE_NAMED_PIPE_PROXY; - handle->private_data = p; - } else { - struct pipes_struct *p; - struct ndr_syntax_id syntax; + break; + + case RPC_SERVICE_MODE_EMBEDDED: if (!is_known_pipename(name, &syntax)) { TALLOC_FREE(handle); return NT_STATUS_OBJECT_NAME_NOT_FOUND; } - p = make_internal_rpc_pipe_p(handle, &syntax, remote_address, + handle->private_data = (void *)make_internal_rpc_pipe_p( + handle, &syntax, remote_address, session_info, msg_ctx); handle->type = FAKE_FILE_TYPE_NAMED_PIPE; - handle->private_data = p; + break; + + case RPC_SERVICE_MODE_DISABLED: + handle->private_data = NULL; + break; } if (handle->private_data == NULL) { -- cgit