From e5136e984922570ce9992c642c340dd3e937fc4e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 12 Mar 2009 17:59:24 -0700 Subject: Remove the static "struct client_connection" mess which is part of the problem that stops libsmbclient being thread safe. Subsidiary DFS connections are now hung off a list inside the cli_state struct. Much more to do in order to get libsmbclient to thread safety, but this is a good start. Jeremy. --- source3/lib/netapi/cm.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'source3/lib/netapi/cm.c') diff --git a/source3/lib/netapi/cm.c b/source3/lib/netapi/cm.c index 233255fed4..43ebed6c22 100644 --- a/source3/lib/netapi/cm.c +++ b/source3/lib/netapi/cm.c @@ -73,19 +73,10 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx, /******************************************************************** ********************************************************************/ -WERROR libnetapi_shutdown_cm(struct libnetapi_ctx *ctx) -{ - cli_cm_shutdown(); - - return WERR_OK; -} - -/******************************************************************** -********************************************************************/ - struct client_pipe_connection { struct client_pipe_connection *prev, *next; struct rpc_pipe_client *pipe; + struct cli_state *cli; }; static struct client_pipe_connection *pipe_connections; @@ -93,6 +84,20 @@ static struct client_pipe_connection *pipe_connections; /******************************************************************** ********************************************************************/ +WERROR libnetapi_shutdown_cm(struct libnetapi_ctx *ctx) +{ + struct client_pipe_connection *p; + + for (p = pipe_connections; p; p = p->next) { + cli_shutdown(p->cli); + } + + return WERR_OK; +} + +/******************************************************************** +********************************************************************/ + static NTSTATUS pipe_cm_find(struct cli_state *cli, const struct ndr_syntax_id *interface, struct rpc_pipe_client **presult) @@ -138,6 +143,7 @@ static NTSTATUS pipe_cm_connect(TALLOC_CTX *mem_ctx, return status; } + p->cli = cli; DLIST_ADD(pipe_connections, p); *presult = p->pipe; @@ -193,5 +199,3 @@ WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx, return WERR_OK; } - - -- cgit