Added TreeID parameter to OpenFileObject

This commit is contained in:
Tal Aloni 2017-03-04 14:04:04 +02:00
parent 241e06c38d
commit 2c1b59973b
6 changed files with 12 additions and 10 deletions

View file

@ -13,11 +13,13 @@ namespace SMBLibrary.Server
{
internal class OpenFileObject
{
public uint TreeID;
public string Path;
public object Handle;
public OpenFileObject(string path, object handle)
public OpenFileObject(uint treeID, string path, object handle)
{
TreeID = treeID;
Path = path;
Handle = handle;
}

View file

@ -69,17 +69,17 @@ namespace SMBLibrary.Server
/// <param name="relativePath">Should include the path relative to the share</param>
/// <returns>FileID</returns>
public ushort? AddOpenFile(string relativePath)
public ushort? AddOpenFile(ushort treeID, string relativePath)
{
return AddOpenFile(relativePath, null);
return AddOpenFile(treeID, relativePath, null);
}
public ushort? AddOpenFile(string relativePath, object handle)
public ushort? AddOpenFile(ushort treeID, string relativePath, object handle)
{
ushort? fileID = m_connection.AllocateFileID();
if (fileID.HasValue)
{
m_openFiles.Add(fileID.Value, new OpenFileObject(relativePath, handle));
m_openFiles.Add(fileID.Value, new OpenFileObject(treeID, relativePath, handle));
}
return fileID;
}

View file

@ -95,12 +95,12 @@ namespace SMBLibrary.Server
}
/// <returns>The persistent portion of the FileID</returns>
public ulong? AddOpenFile(string relativePath, object handle)
public ulong? AddOpenFile(uint treeID, string relativePath, object handle)
{
ulong? persistentID = m_connection.AllocatePersistentFileID();
if (persistentID.HasValue)
{
m_openFiles.Add(persistentID.Value, new OpenFileObject(relativePath, handle));
m_openFiles.Add(persistentID.Value, new OpenFileObject(treeID, relativePath, handle));
}
return persistentID;
}

View file

@ -40,7 +40,7 @@ namespace SMBLibrary.Server.SMB1
return new ErrorResponse(request.CommandName);
}
ushort? fileID = session.AddOpenFile(path, handle);
ushort? fileID = session.AddOpenFile(header.TID, path, handle);
if (!fileID.HasValue)
{
share.FileStore.CloseFile(handle);

View file

@ -56,7 +56,7 @@ namespace SMBLibrary.Server.SMB1
return new ErrorResponse(request.CommandName);
}
ushort? fileID = session.AddOpenFile(path, handle);
ushort? fileID = session.AddOpenFile(header.TID, path, handle);
if (!fileID.HasValue)
{
share.FileStore.CloseFile(handle);

View file

@ -40,7 +40,7 @@ namespace SMBLibrary.Server.SMB2
return new ErrorResponse(request.CommandName, createStatus);
}
ulong? persistentFileID = session.AddOpenFile(path, handle);
ulong? persistentFileID = session.AddOpenFile(request.Header.TreeID, path, handle);
if (!persistentFileID.HasValue)
{
share.FileStore.CloseFile(handle);