Переглянути джерело

Return STATUS_INVALID_PARAMETER instead of STATUS_SMB_BAD_COMMAND when client tries to perform operation on mismatching share

Tal Aloni 8 роки тому
батько
коміт
acf3a99214

+ 3 - 2
SMBLibrary/Server/SMB1/TransactionHelper.cs

@@ -136,7 +136,8 @@ namespace SMBLibrary.Server.SMB1
             {
                 if (!(share is NamedPipeShare))
                 {
-                    header.Status = NTStatus.STATUS_SMB_BAD_COMMAND;
+                    // [MS-CIFS] If the pipe is not a message mode pipe, the Trans subsystem MUST fail the request with STATUS_INVALID_PARAMETER
+                    header.Status = NTStatus.STATUS_INVALID_PARAMETER;
                     return new ErrorResponse(CommandName.SMB_COM_TRANSACTION);
                 }
 
@@ -196,7 +197,7 @@ namespace SMBLibrary.Server.SMB1
 
             if (!(share is FileSystemShare))
             {
-                header.Status = NTStatus.STATUS_SMB_BAD_COMMAND;
+                header.Status = NTStatus.STATUS_INVALID_PARAMETER;
                 return new ErrorResponse(CommandName.SMB_COM_TRANSACTION2);
             }
 

+ 8 - 8
SMBLibrary/Server/SMBServer.SMB1.cs

@@ -146,7 +146,7 @@ namespace SMBLibrary.Server
                     {
                         if (!(share is FileSystemShare))
                         {
-                            header.Status = NTStatus.STATUS_SMB_BAD_COMMAND;
+                            header.Status = NTStatus.STATUS_INVALID_PARAMETER;
                             return new ErrorResponse(command.CommandName);
                         }
                         CreateDirectoryRequest request = (CreateDirectoryRequest)command;
@@ -156,7 +156,7 @@ namespace SMBLibrary.Server
                     {
                         if (!(share is FileSystemShare))
                         {
-                            header.Status = NTStatus.STATUS_SMB_BAD_COMMAND;
+                            header.Status = NTStatus.STATUS_INVALID_PARAMETER;
                             return new ErrorResponse(command.CommandName);
                         }
                         DeleteDirectoryRequest request = (DeleteDirectoryRequest)command;
@@ -175,7 +175,7 @@ namespace SMBLibrary.Server
                     {
                         if (!(share is FileSystemShare))
                         {
-                            header.Status = NTStatus.STATUS_SMB_BAD_COMMAND;
+                            header.Status = NTStatus.STATUS_INVALID_PARAMETER;
                             return new ErrorResponse(command.CommandName);
                         }
                         DeleteRequest request = (DeleteRequest)command;
@@ -185,7 +185,7 @@ namespace SMBLibrary.Server
                     {
                         if (!(share is FileSystemShare))
                         {
-                            header.Status = NTStatus.STATUS_SMB_BAD_COMMAND;
+                            header.Status = NTStatus.STATUS_INVALID_PARAMETER;
                             return new ErrorResponse(command.CommandName);
                         }
                         RenameRequest request = (RenameRequest)command;
@@ -195,7 +195,7 @@ namespace SMBLibrary.Server
                     {
                         if (!(share is FileSystemShare))
                         {
-                            header.Status = NTStatus.STATUS_SMB_BAD_COMMAND;
+                            header.Status = NTStatus.STATUS_INVALID_PARAMETER;
                             return new ErrorResponse(command.CommandName);
                         }
                         QueryInformationRequest request = (QueryInformationRequest)command;
@@ -205,7 +205,7 @@ namespace SMBLibrary.Server
                     {
                         if (!(share is FileSystemShare))
                         {
-                            header.Status = NTStatus.STATUS_SMB_BAD_COMMAND;
+                            header.Status = NTStatus.STATUS_INVALID_PARAMETER;
                             return new ErrorResponse(command.CommandName);
                         }
                         SetInformationRequest request = (SetInformationRequest)command;
@@ -231,7 +231,7 @@ namespace SMBLibrary.Server
                     {
                         if (!(share is FileSystemShare))
                         {
-                            header.Status = NTStatus.STATUS_SMB_BAD_COMMAND;
+                            header.Status = NTStatus.STATUS_INVALID_PARAMETER;
                             return new ErrorResponse(command.CommandName);
                         }
                         CheckDirectoryRequest request = (CheckDirectoryRequest)command;
@@ -249,7 +249,7 @@ namespace SMBLibrary.Server
                     {
                         if (!(share is FileSystemShare))
                         {
-                            header.Status = NTStatus.STATUS_SMB_BAD_COMMAND;
+                            header.Status = NTStatus.STATUS_INVALID_PARAMETER;
                             return new ErrorResponse(command.CommandName);
                         }
                         SetInformation2Request request = (SetInformation2Request)command;