Procházet zdrojové kódy

Minor code refactoring

Tal Aloni před 7 roky
rodič
revize
d17866f6f9

+ 1 - 2
SMBLibrary/SMB1/Commands/NegotiateResponseExtended.cs

@@ -31,11 +31,10 @@ namespace SMBLibrary.SMB1
         private byte ChallengeLength; // MUST be set to 0
         // Data:
         public Guid ServerGuid;
-        public byte[] SecurityBlob;
+        public byte[] SecurityBlob;   // [MS-SMB] 3.3.5.2: The server can leave SecurityBlob empty if not configured to send GSS token.
 
         public NegotiateResponseExtended() : base()
         {
-            // [MS-SMB] 3.3.5.2: The server can leave SecurityBlob empty if not configured to send GSS token.
             SecurityBlob = new byte[0];
         }
 

+ 2 - 2
SMBLibrary/SMB1/Commands/SessionSetupAndXRequest.cs

@@ -58,7 +58,7 @@ namespace SMBLibrary.SMB1
             {
                 // A Unicode string MUST be aligned to a 16-bit boundary with respect to the beginning of the SMB Header.
                 // Note: SMBData starts at an odd offset.
-                int padding = (OEMPasswordLength + UnicodePasswordLength + 1) % 2;
+                int padding = (1 + OEMPasswordLength + UnicodePasswordLength) % 2;
                 dataOffset += padding;
             }
             AccountName = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
@@ -86,7 +86,7 @@ namespace SMBLibrary.SMB1
             {
                 // A Unicode string MUST be aligned to a 16-bit boundary with respect to the beginning of the SMB Header.
                 // Note: SMBData starts at an odd offset.
-                padding = (OEMPasswordLength + UnicodePasswordLength + 1) % 2;
+                padding = (1 + OEMPasswordLength + UnicodePasswordLength) % 2;
                 this.SMBData = new byte[OEMPassword.Length + UnicodePassword.Length + padding + (AccountName.Length + 1) * 2 + (PrimaryDomain.Length + 1) * 2 + (NativeOS.Length + 1) * 2 + (NativeLanMan.Length + 1) * 2];
             }
             else

+ 2 - 2
SMBLibrary/SMB1/Commands/SessionSetupAndXRequestExtended.cs

@@ -51,7 +51,7 @@ namespace SMBLibrary.SMB1
             {
                 // A Unicode string MUST be aligned to a 16-bit boundary with respect to the beginning of the SMB Header.
                 // Note: SMBData starts at an odd offset.
-                int padding = (SecurityBlobLength + 1) % 2;
+                int padding = (1 + SecurityBlobLength) % 2;
                 dataOffset += padding;
             }
             NativeOS = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
@@ -76,7 +76,7 @@ namespace SMBLibrary.SMB1
             {
                 // A Unicode string MUST be aligned to a 16-bit boundary with respect to the beginning of the SMB Header.
                 // Note: SMBData starts at an odd offset.
-                padding = (SecurityBlobLength + 1) % 2;
+                padding = (1 + SecurityBlobLength) % 2;
                 this.SMBData = new byte[SecurityBlob.Length + padding + (NativeOS.Length + 1) * 2 + (NativeLanMan.Length  + 1) * 2];
             }
             else

+ 1 - 1
SMBLibrary/SMB1/Commands/SessionSetupAndXResponseExtended.cs

@@ -45,7 +45,7 @@ namespace SMBLibrary.SMB1
             {
                 // A Unicode string MUST be aligned to a 16-bit boundary with respect to the beginning of the SMB Header.
                 // Note: SMBData starts at an odd offset.
-                int padding = (SecurityBlobLength + 1) % 2;
+                int padding = (1 + SecurityBlobLength) % 2;
                 dataOffset += padding;
             }
             NativeOS = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);