4.7 Disconnecting a Share and Logging Off
The following diagram demonstrates the steps taken to close a tree connect and log off a session. Assume that this sequence starts on a connection where the session and tree connect have been established as described in previous sections with SessionId of 0x40000000015 and TreeId of 0x1.
Figure 12: Disconnecting a share and logging off a session
The client sends an SMB2 TREE_DISCONNECT Request for the tree connect.
Smb2: C TREE DISCONNECT TID=0x1 SMB2Header: Size: 64 (0x40) CreditCharge: 0 (0x0) Status: STATUS_SUCCESS Command: TREE DISCONNECT Credits: 111 (0x6F) Flags: 0 (0x0) ServerToRedir: ...............................0 Client to Server AsyncCommand: ..............................0. Command is not asynchronous Related: .............................0.. Packet is single message Signed: ............................0... Packet is not signed Reserved: 0 (0x0) DFS: 0............................... Command is not a DFS Operation NextCommand: 0 (0x0) MessageId: 32 (0x20) Reserved: 0 (0x0) TreeId: 1 (0x1) SessionId: 4398046511125 (0x40000000015) CTreeDisconnect: Size: 4 (0x4) Reserved: 0 (0x0)
The server responds with an SMB2 TREE_DISCONNECT Response indicating success.
Smb2: R TREE DISCONNECT SMB2Header: Size: 64 (0x40) CreditCharge: 0 (0x0) Status: STATUS_SUCCESS Command: TREE DISCONNECT Credits: 1 (0x1) Flags: 1 (0x1) ServerToRedir: ...............................1 Server to Client AsyncCommand: ..............................0. Command is not asynchronous Related: .............................0.. Packet is single message Signed: ............................0... Packet is not signed Reserved: 0 (0x0) DFS: 0............................... Command is not a DFS Operation NextCommand: 0 (0x0) MessageId: 32 (0x20) Reserved: 0 (0x0) TreeId: 1 (0x1) SessionId: 4398046511125 (0x40000000015) RTreeDisconnect: Size: 4 (0x4) Reserved: 0 (0x0)
The client sends an SMB2 LOGOFF Request for the session.
Smb2: C LOGOFF SMB2Header: Size: 64 (0x40) CreditCharge: 0 (0x0) Status: STATUS_SUCCESS Command: LOGOFF Credits: 111 (0x6F) Flags: 0 (0x0) ServerToRedir: ...............................0 Client to Server AsyncCommand: ..............................0. Command is not asynchronous Related: .............................0.. Packet is single message Signed: ............................0... Packet is not signed Reserved: 0 (0x0) DFS: 0............................... Command is not a DFS Operation NextCommand: 0 (0x0) MessageId: 33 (0x21) Reserved: 0 (0x0) TreeId: 0 (0x0) SessionId: 4398046511125 (0x40000000015) CLogoff: Size: 4 (0x4) Reserved: 0 (0x0)
The server responds with an SMB2 LOGOFF Response indicating success.
Smb2: R LOGOFF SMB2Header: Size: 64 (0x40) CreditCharge: 0 (0x0) Status: STATUS_SUCCESS Command: LOGOFF Credits: 1 (0x1) Flags: 1 (0x1) ServerToRedir: ...............................1 Server to Client AsyncCommand: ..............................0. Command is not asynchronous Related: .............................0.. Packet is single message Signed: ............................0... Packet is not signed Reserved: 0 (0x0) DFS: 0............................... Command is not a DFS Operation NextCommand: 0 (0x0) MessageId: 33 (0x21) Reserved: 0 (0x0) TreeId: 0 (0x0) SessionId: 4398046511125 (0x40000000015) RLogoff: Size: 4 (0x4) Reserved: 0 (0x0)