From: Günther Deschner Date: Mon, 26 Sep 2016 18:22:04 +0000 (+0200) Subject: s3-rpc_server: setup secondary address for tcp transport in bind_ack packet. X-Git-Tag: talloc-2.1.9~468 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=567465546f112fda90f59bbeeba0bff3d4985bcd;p=thirdparty%2Fsamba.git s3-rpc_server: setup secondary address for tcp transport in bind_ack packet. Guenther Signed-off-by: Guenther Deschner Reviewed-by: Andreas Schneider --- diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index bf8988b2a76..407d8d70583 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -679,6 +679,7 @@ static bool api_pipe_bind_req(struct pipes_struct *p, DATA_BLOB auth_resp = data_blob_null; DATA_BLOB auth_blob = data_blob_null; const struct ndr_interface_table *table; + const char *secondary_address = NULL; if (!p->allow_bind) { DEBUG(2,("Pipe not in allow bind state\n")); @@ -826,14 +827,26 @@ static bool api_pipe_bind_req(struct pipes_struct *p, u.bind_ack.max_recv_frag = RPC_MAX_PDU_FRAG_LEN; u.bind_ack.assoc_group_id = assoc_gid; - /* name has to be \PIPE\xxxxx */ - u.bind_ack.secondary_address = - talloc_asprintf(pkt, "\\PIPE\\%s", - rpc_srv_get_pipe_srv_name(&id)); - if (!u.bind_ack.secondary_address) { + switch (p->transport) { + case NCACN_IP_TCP: + secondary_address = talloc_asprintf(pkt, "%d", + tsocket_address_inet_port(p->local_address)); + break; + case NCACN_NP: + default: + /* name has to be \PIPE\xxxxx */ + secondary_address = + talloc_asprintf(pkt, "\\PIPE\\%s", + rpc_srv_get_pipe_srv_name(&id)); + break; + } + + if (secondary_address == NULL) { DEBUG(0, ("Out of memory!\n")); goto err_exit; } + + u.bind_ack.secondary_address = secondary_address; u.bind_ack.secondary_address_size = strlen(u.bind_ack.secondary_address) + 1;