When tearing down the connection make sure we close all files before
authorJeremy Allison <jra@samba.org>
Fri, 7 May 2010 13:54:16 +0000 (06:54 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 7 May 2010 13:54:16 +0000 (06:54 -0700)
freeing the global context, as we close access to the locking db
before freeing the global context.

Jeremy.

source3/smbd/conn.c
source3/smbd/smb2_tcon.c

index 803a775e16777496f102419f450544f617d3c7ce..afb7a7fa85b758e5f62684a0a56a5165e75d320f 100644 (file)
@@ -181,6 +181,13 @@ bool conn_close_all(struct smbd_server_connection *sconn)
                /* SMB2 */
                if (sconn->smb2.sessions.list &&
                                sconn->smb2.sessions.list->tcons.list) {
+                       struct smbd_smb2_tcon *tcon, *tc_next;
+
+                       for (tcon = sconn->smb2.sessions.list->tcons.list;
+                                       tcon; tcon = tc_next) {
+                               tc_next = tcon->next;
+                               TALLOC_FREE(tcon);
+                       }
                        return true;
                }
                return false;
index 0f765d662a79dbdba22ca4ab617a81d82e751385..084ded95a4b40a87729efe92d465721b3c99e1ee 100644 (file)
@@ -128,6 +128,7 @@ static int smbd_smb2_tcon_destructor(struct smbd_smb2_tcon *tcon)
        DLIST_REMOVE(tcon->session->tcons.list, tcon);
 
        if (tcon->compat_conn) {
+               set_current_service(tcon->compat_conn, 0, true);
                close_cnum(tcon->compat_conn, tcon->session->vuid);
        }