diff options
author | Volker Lendecke <vl@samba.org> | 2008-05-20 18:25:42 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-05-21 23:35:26 +0200 |
commit | 36e94197d0653fe98518ce5813bfe3f9f13d13f0 (patch) | |
tree | 67ccfdff990e6f7c71b9eeac05f78318e7568136 /source3 | |
parent | e8d25443c17c7c52627e7addd3a35f0646d60d38 (diff) | |
download | samba-36e94197d0653fe98518ce5813bfe3f9f13d13f0.tar.gz samba-36e94197d0653fe98518ce5813bfe3f9f13d13f0.tar.bz2 samba-36e94197d0653fe98518ce5813bfe3f9f13d13f0.zip |
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)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpc_client/cli_pipe.c | 10 |
1 files changed, 10 insertions, 0 deletions
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; |