summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-03-19 15:52:16 +0000
committerGerald Carter <jerry@samba.org>2004-03-19 15:52:16 +0000
commit54d355e581bc1c1bf8deb3c1973285de805743ba (patch)
tree47932e8ffd24e631630064ae6b232efed3fbe9cd
parentc8549363f49ac9ea818bd782319e57154764992f (diff)
downloadsamba-54d355e581bc1c1bf8deb3c1973285de805743ba.tar.gz
samba-54d355e581bc1c1bf8deb3c1973285de805743ba.tar.bz2
samba-54d355e581bc1c1bf8deb3c1973285de805743ba.zip
wrap cli_tdis() in check to make sure we have a valid cnum
(This used to be commit e54342b062e7736b46f56bcb0e064acc5a7b98ee)
-rw-r--r--source3/libsmb/clientgen.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 28da73894f..370249d047 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -367,15 +367,16 @@ void cli_nt_netlogon_netsec_session_close(struct cli_state *cli)
void cli_close_connection(struct cli_state *cli)
{
- /*
- * tell our peer to free his resources. Wihtout this, when an
- * application attempts to do a graceful shutdown and calls
- * smbc_free_context() to clean up all connections, some connections
- * can remain active on the peer end, until some (long) timeout period
- * later. This tree disconnect forces the peer to clean up, since the
- * connection will be going away.
- */
- cli_tdis(cli);
+ /*
+ * tell our peer to free his resources. Wihtout this, when an
+ * application attempts to do a graceful shutdown and calls
+ * smbc_free_context() to clean up all connections, some connections
+ * can remain active on the peer end, until some (long) timeout period
+ * later. This tree disconnect forces the peer to clean up, since the
+ * connection will be going away.
+ */
+ if ( cli->cnum != -1 )
+ cli_tdis(cli);
cli_nt_session_close(cli);
cli_nt_netlogon_netsec_session_close(cli);