s4:librpc/rpc: remember the target_hostname on ncacn_http connections
authorStefan Metzmacher <metze@samba.org>
Thu, 20 Jul 2017 21:05:53 +0000 (23:05 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 7 Aug 2017 13:20:02 +0000 (15:20 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/librpc/rpc/dcerpc_connect.c

index 8ed12578e212f37425ad8bb870052a303ef41197..bec7022f4d2e032e98aaadeb673611a43a9d00ce 100644 (file)
@@ -422,6 +422,7 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_ip_tcp_recv(struct composite_context *
 struct pipe_http_state {
        struct dcerpc_pipe_connect io;
        const char *localaddr;
+       const char *target_hostname;
        const char *rpc_server;
        uint32_t rpc_server_port;
        char *rpc_proxy;
@@ -457,6 +458,8 @@ static void continue_pipe_open_ncacn_http(struct tevent_req *subreq)
        s->io.conn->transport.stream = stream;
        s->io.conn->transport.write_queue = queue;
        s->io.conn->transport.pending_reads = 0;
+       s->io.conn->server_name = strupper_talloc(s->io.conn,
+                                                 s->target_hostname);
 
        composite_done(c);
 }
@@ -493,6 +496,8 @@ static struct composite_context* dcerpc_pipe_connect_ncacn_http_send(
                                                        "localaddress");
        /* RPC server and port (the endpoint) */
        s->rpc_server = dcerpc_binding_get_string_option(io->binding, "host");
+       s->target_hostname = dcerpc_binding_get_string_option(io->binding,
+                                                             "target_hostname");
        endpoint = dcerpc_binding_get_string_option(io->binding, "endpoint");
        if (endpoint == NULL) {
                composite_error(c, NT_STATUS_INVALID_PARAMETER_MIX);