diff options
author | Andreas Schneider <asn@samba.org> | 2011-02-22 16:48:15 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-03-08 11:41:29 +0100 |
commit | 254c02041cf937a90343df760396bc6e2ac766c5 (patch) | |
tree | c4bb8d548194cc857291d3b345e24e194d1aec97 | |
parent | d14de8fd4dc1d37bfd244e62eae55555d393c9f9 (diff) | |
download | samba-254c02041cf937a90343df760396bc6e2ac766c5.tar.gz samba-254c02041cf937a90343df760396bc6e2ac766c5.tar.bz2 samba-254c02041cf937a90343df760396bc6e2ac766c5.zip |
s3-rpc_server: Added server address to pipes struct.
Signed-off-by: Günther Deschner <gd@samba.org>
-rw-r--r-- | source3/include/ntdomain.h | 1 | ||||
-rw-r--r-- | source3/rpc_server/rpc_server.c | 41 |
2 files changed, 35 insertions, 7 deletions
diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h index 48ad876e34..e1be93c4ba 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -118,6 +118,7 @@ struct pipes_struct { struct pipes_struct *next, *prev; struct client_address *client_id; + struct client_address *server_id; struct auth_serversupplied_info *session_info; struct messaging_context *msg_ctx; diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index c622de5880..0ba945a37e 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -77,6 +77,7 @@ static int make_server_pipes_struct(TALLOC_CTX *mem_ctx, const char *pipe_name, const struct ndr_syntax_id id, const char *client_address, + const char *server_address, struct auth_session_info_transport *session_info, struct pipes_struct **_p, int *perrno) @@ -186,6 +187,27 @@ static int make_server_pipes_struct(TALLOC_CTX *mem_ctx, return -1; } + if (server_address != NULL) { + p->server_id = talloc_zero(p, struct client_address); + if (p->client_id == NULL) { + TALLOC_FREE(p); + *perrno = ENOMEM; + return -1; + } + + strlcpy(p->server_id->addr, + server_address, + sizeof(p->server_id->addr)); + + p->server_id->name = talloc_strdup(p->server_id, + server_address); + if (p->server_id->name == NULL) { + TALLOC_FREE(p); + *perrno = ENOMEM; + return -1; + } + } + talloc_set_destructor(p, close_internal_rpc_pipe_hnd); *_p = p; @@ -519,7 +541,7 @@ static void named_pipe_accept_done(struct tevent_req *subreq) ret = make_server_pipes_struct(npc, npc->pipe_name, npc->pipe_id, - cli_addr, npc->session_info, + cli_addr, NULL, npc->session_info, &npc->p, &error); if (ret != 0) { DEBUG(2, ("Failed to create pipes_struct! (%s)\n", @@ -941,6 +963,7 @@ static void dcerpc_ncacn_accept(struct tevent_context *ev_ctx, struct dcerpc_ncacn_conn *ncacn_conn; struct tevent_req *subreq; const char *cli_str; + const char *srv_str = NULL; char *pipe_name; NTSTATUS status; int sys_errno; @@ -1044,16 +1067,19 @@ static void dcerpc_ncacn_accept(struct tevent_context *ev_ctx, } if (tsocket_address_is_inet(ncacn_conn->client, "ip")) { - cli_str = tsocket_address_inet_addr_string(ncacn_conn->client, - ncacn_conn); - if (cli_str == NULL) { - talloc_free(ncacn_conn); - return; - } + cli_str = ncacn_conn->client_name; } else { cli_str = ""; } + if (ncacn_conn->server != NULL) { + if (tsocket_address_is_inet(ncacn_conn->server, "ip")) { + srv_str = ncacn_conn->server_name; + } else { + srv_str = NULL; + } + } + if (ncacn_conn->session_info == NULL) { status = auth_anonymous_session_info(ncacn_conn, &ncacn_conn->session_info); @@ -1070,6 +1096,7 @@ static void dcerpc_ncacn_accept(struct tevent_context *ev_ctx, pipe_name, ncacn_conn->syntax_id, cli_str, + srv_str, ncacn_conn->session_info, &ncacn_conn->p, &sys_errno); |