mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-30 10:47:48 +02:00
All matching opened files will now be closed during logoff
This commit is contained in:
parent
cff82dd4b8
commit
9141665ac6
4 changed files with 38 additions and 2 deletions
|
@ -79,8 +79,14 @@ namespace SMBLibrary.Server
|
|||
|
||||
public void RemoveSession(ushort userID)
|
||||
{
|
||||
SMB1Session session;
|
||||
m_sessions.TryGetValue(userID, out session);
|
||||
if (session != null)
|
||||
{
|
||||
session.Close();
|
||||
m_sessions.Remove(userID);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An open TID MUST be unique within an SMB connection.
|
||||
|
|
|
@ -152,6 +152,18 @@ namespace SMBLibrary.Server
|
|||
m_openSearches.Remove(searchHandle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Free all resources used by this session
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
List<ushort> treeIDList = new List<ushort>(m_connectedTrees.Keys);
|
||||
foreach (ushort treeID in treeIDList)
|
||||
{
|
||||
DisconnectTree(treeID);
|
||||
}
|
||||
}
|
||||
|
||||
public ushort UserID
|
||||
{
|
||||
get
|
||||
|
|
|
@ -60,8 +60,14 @@ namespace SMBLibrary.Server
|
|||
|
||||
public void RemoveSession(ulong sessionID)
|
||||
{
|
||||
SMB2Session session;
|
||||
m_sessions.TryGetValue(sessionID, out session);
|
||||
if (session != null)
|
||||
{
|
||||
session.Close();
|
||||
m_sessions.Remove(sessionID);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearSessions()
|
||||
{
|
||||
|
|
|
@ -152,6 +152,18 @@ namespace SMBLibrary.Server
|
|||
m_openSearches.Remove(fileID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Free all resources used by this session
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
List<uint> treeIDList = new List<uint>(m_connectedTrees.Keys);
|
||||
foreach (uint treeID in treeIDList)
|
||||
{
|
||||
DisconnectTree(treeID);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] SessionKey
|
||||
{
|
||||
get
|
||||
|
|
Loading…
Add table
Reference in a new issue