Ver código fonte

Renamed SMBMessage to SMB1Message

Tal Aloni 8 anos atrás
pai
commit
6700166f5a

+ 2 - 2
SMBLibrary/Client/SMBClient.cs

@@ -40,12 +40,12 @@ namespace SMBLibrary.Client
 
         public static void TrySendMessage(Socket serverSocket, SMB1Command request)
         {
-            SMBMessage message = new SMBMessage();
+            SMB1Message message = new SMB1Message();
             message.Commands.Add(request);
             TrySendMessage(serverSocket, message);
         }
 
-        public static void TrySendMessage(Socket serverSocket, SMBMessage message)
+        public static void TrySendMessage(Socket serverSocket, SMB1Message message)
         {
             SessionMessagePacket packet = new SessionMessagePacket();
             packet.Trailer = message.GetBytes();

+ 5 - 5
SMBLibrary/SMB1/SMBMessage.cs

@@ -16,17 +16,17 @@ namespace SMBLibrary.SMB1
     /// Each message has a single header and either a single command or multiple batched (AndX) commands.
     /// Multiple command requests or responses can be sent in a single message.
     /// </summary>
-    public class SMBMessage
+    public class SMB1Message
     {
         public SMB1Header Header;
         public List<SMB1Command> Commands = new List<SMB1Command>();
 
-        public SMBMessage()
+        public SMB1Message()
         {
             Header = new SMB1Header();
         }
 
-        public SMBMessage(byte[] buffer)
+        public SMB1Message(byte[] buffer)
         {
             Header = new SMB1Header(buffer);
             SMB1Command command = SMB1Command.ReadCommand(buffer, SMB1Header.Length, Header.Command, Header);
@@ -110,13 +110,13 @@ namespace SMBLibrary.SMB1
             }
         }
 
-        public static SMBMessage GetSMBMessage(byte[] buffer)
+        public static SMB1Message GetSMBMessage(byte[] buffer)
         {
             if (!IsValidSMBMessage(buffer))
             {
                 throw new InvalidRequestException("Invalid SMB message signature");;
             }
-            return new SMBMessage(buffer);
+            return new SMB1Message(buffer);
         }
     }
 }

+ 1 - 1
SMBLibrary/SMBLibrary.csproj

@@ -276,7 +276,7 @@
     <Compile Include="SMB1\NTTransactSubcommands\NTTransactSubcommand.cs" />
     <Compile Include="SMB1\SMB1Header.cs" />
     <Compile Include="SMB1\SMB1Helper.cs" />
-    <Compile Include="SMB1\SMBMessage.cs" />
+    <Compile Include="SMB1\SMB1Message.cs" />
     <Compile Include="SMB1\Transaction2Subcommands\Enums\ExtendedAttributeFlag.cs" />
     <Compile Include="SMB1\Transaction2Subcommands\Enums\FindFlags.cs" />
     <Compile Include="SMB1\Transaction2Subcommands\Enums\FindInformationLevel.cs" />

+ 8 - 8
SMBLibrary/Server/SMBServer.cs

@@ -200,14 +200,14 @@ namespace SMBLibrary.Server
             }
             else if (packet is SessionMessagePacket)
             {
-                SMBMessage message = null;
+                SMB1Message message = null;
 #if DEBUG
-                message = SMBMessage.GetSMBMessage(packet.Trailer);
+                message = SMB1Message.GetSMBMessage(packet.Trailer);
                 System.Diagnostics.Debug.Print("[{0}] Message Received: {1} Commands, First Command: {2}, Packet length: {3}", DateTime.Now.ToString("HH:mm:ss:ffff"), message.Commands.Count, message.Commands[0].CommandName.ToString(), packet.Length);
 #else
                 try
                 {
-                    message = SMBMessage.GetSMBMessage(packet.Trailer);
+                    message = SMB1Message.GetSMBMessage(packet.Trailer);
                 }
                 catch (Exception)
                 {
@@ -225,9 +225,9 @@ namespace SMBLibrary.Server
             }
         }
 
-        public void ProcessMessage(SMBMessage message, StateObject state)
+        public void ProcessMessage(SMB1Message message, StateObject state)
         {
-            SMBMessage reply = new SMBMessage();
+            SMB1Message reply = new SMB1Message();
             PrepareResponseHeader(reply, message);
             List<SMB1Command> sendQueue = new List<SMB1Command>();
 
@@ -250,7 +250,7 @@ namespace SMBLibrary.Server
 
                 foreach (SMB1Command command in sendQueue)
                 {
-                    SMBMessage secondaryReply = new SMBMessage();
+                    SMB1Message secondaryReply = new SMB1Message();
                     secondaryReply.Header = reply.Header;
                     secondaryReply.Commands.Add(command);
                     TrySendMessage(state, secondaryReply);
@@ -524,7 +524,7 @@ namespace SMBLibrary.Server
             return new ErrorResponse(command.CommandName);
         }
 
-        public static void TrySendMessage(StateObject state, SMBMessage reply)
+        public static void TrySendMessage(StateObject state, SMB1Message reply)
         {
             SessionMessagePacket packet = new SessionMessagePacket();
             packet.Trailer = reply.GetBytes();
@@ -547,7 +547,7 @@ namespace SMBLibrary.Server
             }
         }
 
-        private static void PrepareResponseHeader(SMBMessage response, SMBMessage request)
+        private static void PrepareResponseHeader(SMB1Message response, SMB1Message request)
         {
             response.Header.Status = NTStatus.STATUS_SUCCESS;
             response.Header.Flags = HeaderFlags.CaseInsensitive | HeaderFlags.CanonicalizedPaths | HeaderFlags.Reply;