rpc_server: Init local_server_* in make_internal_rpc_pipe_socketpair
authorVolker Lendecke <vl@samba.org>
Wed, 11 Apr 2018 08:42:21 +0000 (10:42 +0200)
committerVolker Lendecke <vl@samba.org>
Wed, 11 Apr 2018 13:19:19 +0000 (15:19 +0200)
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

source3/rpc_server/rpc_ncacn_np.c
source3/rpc_server/rpc_ncacn_np.h
source3/rpc_server/srv_pipe_hnd.c

index 0728f54b092593679558ba89680e5834b226b9af..d7e7785248db415bfbeabd0bbbc4aa65d08f5afa 100644 (file)
@@ -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;
index 03bbd3f8af997ba778c317943236a22da1f792df..9ba58644ec0588343bf62a369fd46b67c321992a 100644 (file)
@@ -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;
index f9b7855b40fc511bdc76c766a65fa0d7990ce430..baa4ce96334d5cc826f2079a8da14f684d26a18d 100644 (file)
@@ -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;