From 4ced9734c0e979da9f01332aacd48e20106da30f Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 30 Nov 1999 00:08:39 +0000 Subject: 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) --- source3/rpc_client/cli_connect.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'source3/rpc_client') 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); } -- cgit