From 2f6d1b8b5a1643082d93f338b0528b861caeff80 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl@samba.org>
Date: Wed, 11 Apr 2018 10:42:21 +0200
Subject: [PATCH] rpc_server: Init local_server_* in
make_internal_rpc_pipe_socketpair
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13370
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Apr 11 15:19:19 CEST 2018 on sn-devel-144
(cherry picked from commit 212815969f4a706bc8395e2f6dbf225318ff2ad7)
---
source3/rpc_server/rpc_ncacn_np.c | 31 +++++++++++++++++++++++--------
source3/rpc_server/rpc_ncacn_np.h | 18 ++++++++++--------
source3/rpc_server/srv_pipe_hnd.c | 18 ++++++++++--------
3 files changed, 43 insertions(+), 24 deletions(-)
diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c
index 0728f54b092..d7e7785248d 100644
--- a/source3/rpc_server/rpc_ncacn_np.c
+++ b/source3/rpc_server/rpc_ncacn_np.c
@@ -69,14 +69,16 @@ fail:
return NULL;
}
-NTSTATUS make_internal_rpc_pipe_socketpair(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev_ctx,
- struct messaging_context *msg_ctx,
- const char *pipe_name,
- const struct ndr_syntax_id *syntax,
- const struct tsocket_address *remote_address,
- const struct auth_session_info *session_info,
- struct npa_state **pnpa)
+NTSTATUS make_internal_rpc_pipe_socketpair(
+ TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
+ const char *pipe_name,
+ const struct ndr_syntax_id *syntax,
+ const struct tsocket_address *remote_address,
+ const struct tsocket_address *local_address,
+ const struct auth_session_info *session_info,
+ struct npa_state **pnpa)
{
TALLOC_CTX *tmp_ctx = talloc_stackframe();
struct named_pipe_client *npc;
@@ -136,6 +138,19 @@ NTSTATUS make_internal_rpc_pipe_socketpair(TALLOC_CTX *mem_ctx,
goto out;
}
+ npc->local_server_addr = tsocket_address_copy(local_address, npc);
+ if (npc->local_server_addr == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto out;
+ }
+
+ npc->local_server_name = tsocket_address_inet_addr_string(
+ npc->local_server_addr, npc);
+ if (npc->local_server_name == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto out;
+ }
+
npc->session_info = copy_session_info(npc, session_info);
if (npc->session_info == NULL) {
status = NT_STATUS_NO_MEMORY;
diff --git a/source3/rpc_server/rpc_ncacn_np.h b/source3/rpc_server/rpc_ncacn_np.h
index 03bbd3f8af9..9ba58644ec0 100644
--- a/source3/rpc_server/rpc_ncacn_np.h
+++ b/source3/rpc_server/rpc_ncacn_np.h
@@ -44,14 +44,16 @@ NTSTATUS make_external_rpc_pipe(TALLOC_CTX *mem_ctx,
const struct auth_session_info *session_info,
struct npa_state **pnpa);
-NTSTATUS make_internal_rpc_pipe_socketpair(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev_ctx,
- struct messaging_context *msg_ctx,
- const char *pipe_name,
- const struct ndr_syntax_id *syntax,
- const struct tsocket_address *remote_address,
- const struct auth_session_info *session_info,
- struct npa_state **pnpa);
+NTSTATUS make_internal_rpc_pipe_socketpair(
+ TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
+ const char *pipe_name,
+ const struct ndr_syntax_id *syntax,
+ const struct tsocket_address *remote_address,
+ const struct tsocket_address *local_address,
+ const struct auth_session_info *session_info,
+ struct npa_state **pnpa);
struct np_proxy_state {
uint16_t file_type;
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index f9b7855b40f..baa4ce96334 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -106,14 +106,16 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
- status = make_internal_rpc_pipe_socketpair(handle,
- ev_ctx,
- msg_ctx,
- name,
- &syntax,
- remote_client_address,
- session_info,
- &npa);
+ status = make_internal_rpc_pipe_socketpair(
+ handle,
+ ev_ctx,
+ msg_ctx,
+ name,
+ &syntax,
+ remote_client_address,
+ local_server_address,
+ session_info,
+ &npa);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(handle);
return status;
--
2.11.0