Browse Source

SMB2: Renamed ServerCapabilities to Capabilities and added notes

Tal Aloni 7 years ago
parent
commit
6d49e4a03e

+ 2 - 2
SMBLibrary/SMB2/Commands/NegotiateRequest.cs

@@ -21,7 +21,7 @@ namespace SMBLibrary.SMB2
         private ushort DialectCount;
         public SecurityMode SecurityMode;
         public ushort Reserved;
-        public ServerCapabilities Capabilities;
+        public Capabilities Capabilities; // If the client does not implements the SMB 3.x dialect family, this field MUST be set to 0.
         public Guid ClientGuid;
         public DateTime ClientStartTime;
         public List<SMB2Dialect> Dialects = new List<SMB2Dialect>();
@@ -37,7 +37,7 @@ namespace SMBLibrary.SMB2
             DialectCount = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 2);
             SecurityMode = (SecurityMode)LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 4);
             Reserved = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 6);
-            Capabilities = (ServerCapabilities)LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 8);
+            Capabilities = (Capabilities)LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 8);
             ClientGuid = LittleEndianConverter.ToGuid(buffer, offset + SMB2Header.Length + 12);
             ClientStartTime = DateTime.FromFileTimeUtc(LittleEndianConverter.ToInt64(buffer, offset + SMB2Header.Length + 28));
 

+ 2 - 2
SMBLibrary/SMB2/Commands/NegotiateResponse.cs

@@ -23,7 +23,7 @@ namespace SMBLibrary.SMB2
         public SMB2Dialect DialectRevision;
         private ushort NegotiateContextCount;
         public Guid ServerGuid;
-        public ServerCapabilities Capabilities;
+        public Capabilities Capabilities;
         public uint MaxTransactSize;
         public uint MaxReadSize;
         public uint MaxWriteSize;
@@ -48,7 +48,7 @@ namespace SMBLibrary.SMB2
             DialectRevision = (SMB2Dialect)LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 4);
             NegotiateContextCount = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 6);
             ServerGuid = LittleEndianConverter.ToGuid(buffer, offset + SMB2Header.Length + 8);
-            Capabilities = (ServerCapabilities)LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 24);
+            Capabilities = (Capabilities)LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 24);
             MaxTransactSize = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 28);
             MaxReadSize = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 32);
             MaxWriteSize = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 36);

+ 2 - 2
SMBLibrary/SMB2/Commands/SessionSetupRequest.cs

@@ -21,7 +21,7 @@ namespace SMBLibrary.SMB2
         private ushort StructureSize;
         public SessionSetupFlags Flags;
         public SecurityMode SecurityMode;
-        public ServerCapabilities Capabilities;
+        public Capabilities Capabilities; // Values other than SMB2_GLOBAL_CAP_DFS should be treated as reserved.
         public uint Channel;
         private ushort SecurityBufferOffset;
         private ushort SecurityBufferLength;
@@ -38,7 +38,7 @@ namespace SMBLibrary.SMB2
             StructureSize = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
             Flags = (SessionSetupFlags)ByteReader.ReadByte(buffer, offset + SMB2Header.Length + 2);
             SecurityMode = (SecurityMode)ByteReader.ReadByte(buffer, offset + SMB2Header.Length + 3);
-            Capabilities = (ServerCapabilities)LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 4);
+            Capabilities = (Capabilities)LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 4);
             Channel = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 8);
             SecurityBufferOffset = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 12);
             SecurityBufferLength = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 14);

+ 1 - 1
SMBLibrary/SMB2/Enums/Negotiate/ServerCapabilities.cs

@@ -3,7 +3,7 @@ using System;
 namespace SMBLibrary.SMB2
 {
     [Flags]
-    public enum ServerCapabilities : uint
+    public enum Capabilities : uint
     {
         DFS = 0x00000001,               // SMB2_GLOBAL_CAP_DFS
         Leasing = 0x00000002,           // SMB2_GLOBAL_CAP_LEASING

+ 1 - 1
SMBLibrary/SMBLibrary.csproj

@@ -532,9 +532,9 @@
     <Compile Include="SMB2\Enums\Create\OplockLevel.cs" />
     <Compile Include="SMB2\Enums\InfoType.cs" />
     <Compile Include="SMB2\Enums\IOCtl\IOCtlRequestFlags.cs" />
+    <Compile Include="SMB2\Enums\Negotiate\Capabilities.cs" />
     <Compile Include="SMB2\Enums\Negotiate\NegotiateContextType.cs" />
     <Compile Include="SMB2\Enums\Negotiate\SecurityMode.cs" />
-    <Compile Include="SMB2\Enums\Negotiate\ServerCapabilities.cs" />
     <Compile Include="SMB2\Enums\Negotiate\SMB2Dialect.cs" />
     <Compile Include="SMB2\Enums\QueryDirectory\QueryDirectoryFlags.cs" />
     <Compile Include="SMB2\Enums\Read\ReadFlags.cs" />