|
@@ -31,14 +31,15 @@ namespace SMBLibrary.Server.SMB1
|
|
|
else
|
|
|
{
|
|
|
share = shares.GetShareFromName(shareName);
|
|
|
- serviceName = ServiceName.DiskShare;
|
|
|
- supportFlags = OptionalSupportFlags.SMB_SUPPORT_SEARCH_BITS | OptionalSupportFlags.SMB_CSC_CACHE_MANUAL_REINT;
|
|
|
if (share == null)
|
|
|
{
|
|
|
header.Status = NTStatus.STATUS_OBJECT_PATH_NOT_FOUND;
|
|
|
return new ErrorResponse(request.CommandName);
|
|
|
}
|
|
|
|
|
|
+ serviceName = ServiceName.DiskShare;
|
|
|
+ supportFlags = OptionalSupportFlags.SMB_SUPPORT_SEARCH_BITS | GetCachingSupportFlags(((FileSystemShare)share).CachingPolicy);
|
|
|
+
|
|
|
if (!((FileSystemShare)share).HasReadAccess(session.SecurityContext, @"\"))
|
|
|
{
|
|
|
state.LogToServer(Severity.Verbose, "Tree Connect to '{0}' failed. User '{1}' was denied access.", share.Name, session.UserName);
|
|
@@ -64,6 +65,21 @@ namespace SMBLibrary.Server.SMB1
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private static OptionalSupportFlags GetCachingSupportFlags(CachingPolicy cachingPolicy)
|
|
|
+ {
|
|
|
+ switch (cachingPolicy)
|
|
|
+ {
|
|
|
+ case CachingPolicy.ManualCaching:
|
|
|
+ return OptionalSupportFlags.SMB_CSC_CACHE_MANUAL_REINT;
|
|
|
+ case CachingPolicy.AutoCaching:
|
|
|
+ return OptionalSupportFlags.SMB_CSC_CACHE_AUTO_REINT;
|
|
|
+ case CachingPolicy.VideoCaching:
|
|
|
+ return OptionalSupportFlags.SMB_CSC_CACHE_VDO;
|
|
|
+ default:
|
|
|
+ return OptionalSupportFlags.SMB_CSC_NO_CACHING;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private static TreeConnectAndXResponse CreateTreeConnectResponse(ServiceName serviceName, OptionalSupportFlags supportFlags)
|
|
|
{
|
|
|
TreeConnectAndXResponse response = new TreeConnectAndXResponse();
|