summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-30 00:08:39 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-30 00:08:39 +0000
commit4ced9734c0e979da9f01332aacd48e20106da30f (patch)
tree0da35db0bc3270f96360ebd1c4d5b22b954514fe
parenta43bdadce998bc5465c55b6cf1d5579cb56f1956 (diff)
downloadsamba-4ced9734c0e979da9f01332aacd48e20106da30f.tar.gz
samba-4ced9734c0e979da9f01332aacd48e20106da30f.tar.bz2
samba-4ced9734c0e979da9f01332aacd48e20106da30f.zip
ok. this is where it gets interesting. client states are now maintained
by cli_net_use_add() and cli_net_use_del(). MSRPC connections are established with cli_connection_init(), and automatically unlinked with cli_connection_unlink. client states are _reused_ by cli_connection_init. (This used to be commit 0fcd8ce0967169362bd126a28aa309401abdf17d)
-rw-r--r--source3/rpc_client/cli_connect.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/source3/rpc_client/cli_connect.c b/source3/rpc_client/cli_connect.c
index 81630c5125..0baa279711 100644
--- a/source3/rpc_client/cli_connect.c
+++ b/source3/rpc_client/cli_connect.c
@@ -148,23 +148,50 @@ terminate client connection
void cli_connection_free(struct cli_connection *con)
{
BOOL closed;
+ int i;
+
+ if (con->cli != NULL)
+ {
+ cli_nt_session_close(con->cli, con->fnum);
+ cli_net_use_del(con->srv_name, &con->usr_creds, False, &closed);
+ }
- cli_nt_session_close(con->cli, con->fnum);
- cli_net_use_del(con->srv_name, &con->usr_creds, False, &closed);
+ if (closed)
+ {
+ for (i = 0; i < num_cons; i++)
+ {
+ if (con != con_list[i] && con_list[i]->cli == con->cli)
+ {
+ /* WHOOPS! fnum already open: too bad!!! */
+ con_list[i]->cli = NULL;
+ con_list[i]->fnum = 0xffff;
+ }
+ }
+ }
con->cli = NULL;
if (con->srv_name != NULL)
{
free(con->srv_name);
+ con->srv_name = NULL;
}
if (con->pipe_name != NULL)
{
free(con->pipe_name);
+ con->pipe_name = NULL;
}
memset(&con->usr_creds, 0, sizeof(con->usr_creds));
+ for (i = 0; i < num_cons; i++)
+ {
+ if (con == con_list[i])
+ {
+ con_list[i] = NULL;
+ }
+ }
+
free(con);
}