diff options
author | Jeremy Allison <jra@samba.org> | 2009-03-12 17:59:24 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-03-12 17:59:24 -0700 |
commit | e5136e984922570ce9992c642c340dd3e937fc4e (patch) | |
tree | 90acd50687e0adf2352eb1663b4934f01df0a9fc /source3/libsmb/clientgen.c | |
parent | bace42d586f2e4364e5b66ccc80a0b19749b5e1c (diff) | |
download | samba-e5136e984922570ce9992c642c340dd3e937fc4e.tar.gz samba-e5136e984922570ce9992c642c340dd3e937fc4e.tar.bz2 samba-e5136e984922570ce9992c642c340dd3e937fc4e.zip |
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.
Diffstat (limited to 'source3/libsmb/clientgen.c')
-rw-r--r-- | source3/libsmb/clientgen.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 2983f7771a..7c42da4430 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -425,7 +425,7 @@ void cli_init_creds(struct cli_state *cli, const char *username, const char *dom } /**************************************************************************** - Initialise a client structure. Always returns a malloc'ed struct. + Initialise a client structure. Always returns a talloc'ed struct. Set the signing state (used from the command line). ****************************************************************************/ @@ -446,6 +446,11 @@ struct cli_state *cli_initialise_ex(int signing_state) return NULL; } + cli->dfs_mountpoint = talloc_strdup(cli, ""); + if (!cli->dfs_mountpoint) { + TALLOC_FREE(cli); + return NULL; + } cli->port = 0; cli->fd = -1; cli->cnum = -1; @@ -550,6 +555,27 @@ void cli_nt_pipes_close(struct cli_state *cli) void cli_shutdown(struct cli_state *cli) { + if (cli->prev == NULL) { + /* + * Possible head of a DFS list, + * shutdown all subsidiary DFS + * connections. + */ + struct cli_state *p, *next; + + for (p = cli->next; p; p = next) { + next = p->next; + cli_shutdown(p); + } + } else { + /* + * We're a subsidiary connection. + * Just remove ourselves from the + * DFS list. + */ + DLIST_REMOVE(cli->prev, cli); + } + cli_nt_pipes_close(cli); /* |