Review: Saving the pipes opened for connection and free the memory of all these pipes in cli_nt_pipes_close function.
Nagendra008
bodepu.nagendrakumar at gmail.com
Fri Apr 7 07:01:58 UTC 2017
Hi All,
Here i am trying to free the pipes one after other inside
"cli_nt_pipes_close" of all the pipes which opened for connection.
*Can anyone please review these below changes with respective samba-4.5.6.*
Without any change inside "cli_nt_pipes_close" directly freeing entire pipe
list *talloc_free(cli->pipe_list);*
- Here i am trying to Save the pipes opened for connection and free the
memory of all these pipes
"source3/rpc_client/cli_pipe.h"
NTSTATUS rpc_pipe_open_tcp(struct cli_state *cli, TALLOC_CTX *mem_ctx,
const char *host,
const struct sockaddr_storage *ss_addr,
const struct ndr_interface_table *table,
struct rpc_pipe_client **presult);
/**
* Create a rpc pipe client struct, connecting to a host via tcp.
* The port is determined by asking the endpoint mapper on the given
* host.
*/
NTSTATUS rpc_pipe_open_tcp(struct cli_state *cli, TALLOC_CTX *mem_ctx, const
char *host,
const struct sockaddr_storage *addr,
const struct ndr_interface_table *table,
struct rpc_pipe_client **presult)
{
NTSTATUS status;
uint16_t port = 0;
status = rpc_pipe_get_tcp_port(host, addr, table, &port);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
status = rpc_pipe_open_tcp_port(mem_ctx, host, addr, port,
table, presult, 1000);
//Saving the pipes opened for connection and free the memory of all these
pipes in cli_nt_pipes_close function.
if (*presult)
{
* DLIST_ADD(cli->pipe_list, *presult);*
}
done:
return status;
}
Sending cli to rpc_pipe_open_tcp
------------------------------------------------------------------
"source3/torture/rpc_open_tcp.c"
status = rpc_pipe_open_tcp(cli, mem_ctx, argv[2], NULL,
*table,
&rpc_pipe);
*For graceful freeing of pipes by one after other
/****************************************************************************
Close all pipes open on this session.
****************************************************************************/
void cli_nt_pipes_close(struct cli_state *cli)
{
struct rpc_pipe_client *tmp, *pipe = cli->pipe_list;
while (pipe) {
/*
* No TALLOC_FREE here!
*/
tmp = pipe->next;
talloc_free(pipe);
pipe = tmp;
}
}
*
Regards,
Nag
--
View this message in context: http://samba.2283325.n4.nabble.com/Review-Saving-the-pipes-opened-for-connection-and-free-the-memory-of-all-these-pipes-in-cli-nt-pipes-tp4717202.html
Sent from the Samba - samba-technical mailing list archive at Nabble.com.
More information about the samba-technical
mailing list