From 36e94197d0653fe98518ce5813bfe3f9f13d13f0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 20 May 2008 18:25:42 +0200 Subject: rpc_client: add a destructor to close the socket for pipes over tcp. used in rpc_pipe_open_tcp() and rpc_pipe_open_ncalrpc(). (This used to be commit a0bdd56c75ca6f6c6068995647c0dc1ba89aef12) --- source3/rpc_client/cli_pipe.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/rpc_client/cli_pipe.c') diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 6bd240dd81..9908c69674 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -2503,6 +2503,12 @@ NTSTATUS rpccli_kerberos_bind_data(TALLOC_CTX *mem_ctx, #endif } +static int rpc_pipe_sock_destructor(struct rpc_pipe_client *p) +{ + close(p->trans.sock.fd); + return 0; +} + /******************************************************************** Create a rpc pipe client struct, connecting to a tcp port ********************************************************************/ @@ -2547,6 +2553,8 @@ NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host, goto fail; } + talloc_set_destructor(result, rpc_pipe_sock_destructor); + *presult = result; return NT_STATUS_OK; @@ -2593,6 +2601,8 @@ NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path, goto fail; } + talloc_set_destructor(result, rpc_pipe_sock_destructor); + result->dc = TALLOC_ZERO_P(result, struct dcinfo); if (result->dc == NULL) { status = NT_STATUS_NO_MEMORY; -- cgit