summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/client/smbmount.c1
-rw-r--r--source3/include/smb.h1
-rw-r--r--source3/libsmb/clientgen.c6
3 files changed, 7 insertions, 1 deletions
diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c
index 6e8d9f5bca..04bb103dae 100644
--- a/source3/client/smbmount.c
+++ b/source3/client/smbmount.c
@@ -383,6 +383,7 @@ static void send_fs_socket(char *the_service, char *mount_point, struct cli_stat
If we don't do this we will "leak" sockets and memory on
each reconnection we have to make. */
+ c->smb_rw_error = DO_NOT_DO_TDIS;
cli_shutdown(c);
c = NULL;
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 3ee6f01d34..5d306be062 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -82,6 +82,7 @@ typedef int BOOL;
#define READ_ERROR 3
#define WRITE_ERROR 4 /* This error code can go into the client smb_rw_error. */
#define READ_BAD_SIG 5
+#define DO_NOT_DO_TDIS 6 /* cli_close_connection() check for this when smbfs wants to keep tree connected */
#define DIR_STRUCT_SIZE 43
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 66edc3ce38..6edc83c9d7 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -374,8 +374,12 @@ void cli_close_connection(struct cli_state *cli)
* 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.
+ *
+ * Also, do not do tree disconnect when cli->smb_rw_error is DO_NOT_DO_TDIS
+ * the only user for this so far is smbmount which passes opened connection
+ * down to kernel's smbfs module.
*/
- if ( cli->cnum != (uint16)-1 )
+ if ( (cli->cnum != (uint16)-1) && (cli->smb_rw_error != DO_NOT_DO_TDIS ) )
cli_tdis(cli);
cli_nt_session_close(cli);