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,7 +79,13 @@ namespace SMBLibrary.Server
|
||||||
|
|
||||||
public void RemoveSession(ushort userID)
|
public void RemoveSession(ushort userID)
|
||||||
{
|
{
|
||||||
m_sessions.Remove(userID);
|
SMB1Session session;
|
||||||
|
m_sessions.TryGetValue(userID, out session);
|
||||||
|
if (session != null)
|
||||||
|
{
|
||||||
|
session.Close();
|
||||||
|
m_sessions.Remove(userID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -152,6 +152,18 @@ namespace SMBLibrary.Server
|
||||||
m_openSearches.Remove(searchHandle);
|
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
|
public ushort UserID
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -60,7 +60,13 @@ namespace SMBLibrary.Server
|
||||||
|
|
||||||
public void RemoveSession(ulong sessionID)
|
public void RemoveSession(ulong sessionID)
|
||||||
{
|
{
|
||||||
m_sessions.Remove(sessionID);
|
SMB2Session session;
|
||||||
|
m_sessions.TryGetValue(sessionID, out session);
|
||||||
|
if (session != null)
|
||||||
|
{
|
||||||
|
session.Close();
|
||||||
|
m_sessions.Remove(sessionID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearSessions()
|
public void ClearSessions()
|
||||||
|
|
|
@ -152,6 +152,18 @@ namespace SMBLibrary.Server
|
||||||
m_openSearches.Remove(fileID);
|
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
|
public byte[] SessionKey
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
Loading…
Add table
Reference in a new issue