فهرست منبع

Logging improvements

Tal Aloni 7 سال پیش
والد
کامیت
fd2e6cf517

+ 1 - 0
SMBLibrary/Server/SMB1/FileStoreResponseHelper.cs

@@ -206,6 +206,7 @@ namespace SMBLibrary.Server.SMB1
             OpenFileObject openFile = session.GetOpenFileObject(request.FID);
             if (openFile == null)
             {
+                state.LogToServer(Severity.Verbose, "Set Information 2 failed. Invalid FID.");
                 header.Status = NTStatus.STATUS_SMB_BAD_FID;
                 return new ErrorResponse(request.CommandName);
             }

+ 5 - 0
SMBLibrary/Server/SMB1/ReadWriteResponseHelper.cs

@@ -23,6 +23,7 @@ namespace SMBLibrary.Server.SMB1
             OpenFileObject openFile = session.GetOpenFileObject(request.FID);
             if (openFile == null)
             {
+                state.LogToServer(Severity.Verbose, "Read failed. Invalid FID.");
                 header.Status = NTStatus.STATUS_INVALID_HANDLE;
                 return null;
             }
@@ -57,6 +58,7 @@ namespace SMBLibrary.Server.SMB1
             OpenFileObject openFile = session.GetOpenFileObject(request.FID);
             if (openFile == null)
             {
+                state.LogToServer(Severity.Verbose, "Read failed. Invalid FID.");
                 header.Status = NTStatus.STATUS_INVALID_HANDLE;
                 return null;
             }
@@ -107,6 +109,7 @@ namespace SMBLibrary.Server.SMB1
             OpenFileObject openFile = session.GetOpenFileObject(request.FID);
             if (openFile == null)
             {
+                state.LogToServer(Severity.Verbose, "Write failed. Invalid FID.");
                 header.Status = NTStatus.STATUS_INVALID_HANDLE;
                 return new ErrorResponse(request.CommandName);
             }
@@ -139,6 +142,7 @@ namespace SMBLibrary.Server.SMB1
             OpenFileObject openFile = session.GetOpenFileObject(request.FID);
             if (openFile == null)
             {
+                state.LogToServer(Severity.Verbose, "Write failed. Invalid FID.");
                 header.Status = NTStatus.STATUS_INVALID_HANDLE;
                 return new ErrorResponse(request.CommandName);
             }
@@ -184,6 +188,7 @@ namespace SMBLibrary.Server.SMB1
             OpenFileObject openFile = session.GetOpenFileObject(request.FID);
             if (openFile == null)
             {
+                state.LogToServer(Severity.Verbose, "Flush failed. Invalid FID.");
                 header.Status = NTStatus.STATUS_INVALID_HANDLE;
                 return new ErrorResponse(request.CommandName);
             }

+ 6 - 0
SMBLibrary/Server/SMB1/Transaction2SubcommandHelper.cs

@@ -32,6 +32,7 @@ namespace SMBLibrary.Server.SMB1
             }
             catch (UnsupportedInformationLevelException)
             {
+                state.LogToServer(Severity.Verbose, "FindFirst2: Unsupported information level: {0}.", subcommand.InformationLevel);
                 header.Status = NTStatus.STATUS_OS2_INVALID_LEVEL;
                 return null;
             }
@@ -64,6 +65,7 @@ namespace SMBLibrary.Server.SMB1
             }
             catch (UnsupportedInformationLevelException)
             {
+                state.LogToServer(Severity.Verbose, "FindFirst2: Unsupported information level: {0}.", subcommand.InformationLevel);
                 header.Status = NTStatus.STATUS_OS2_INVALID_LEVEL;
                 return null;
             }
@@ -98,6 +100,7 @@ namespace SMBLibrary.Server.SMB1
             OpenSearch openSearch = session.GetOpenSearch(subcommand.SID);
             if (openSearch == null)
             {
+                state.LogToServer(Severity.Verbose, "FindNext2 failed. Invalid SID.");
                 header.Status = NTStatus.STATUS_INVALID_HANDLE;
                 return null;
             }
@@ -113,6 +116,7 @@ namespace SMBLibrary.Server.SMB1
             }
             catch (UnsupportedInformationLevelException)
             {
+                state.LogToServer(Severity.Verbose, "FindNext2: Unsupported information level: {0}.", subcommand.InformationLevel);
                 header.Status = NTStatus.STATUS_OS2_INVALID_LEVEL;
                 return null;
             }
@@ -194,6 +198,7 @@ namespace SMBLibrary.Server.SMB1
             OpenFileObject openFile = session.GetOpenFileObject(subcommand.FID);
             if (openFile == null)
             {
+                state.LogToServer(Severity.Verbose, "QueryFileInformation failed. Invalid FID.");
                 header.Status = NTStatus.STATUS_INVALID_HANDLE;
                 return null;
             }
@@ -228,6 +233,7 @@ namespace SMBLibrary.Server.SMB1
             OpenFileObject openFile = session.GetOpenFileObject(subcommand.FID);
             if (openFile == null)
             {
+                state.LogToServer(Severity.Verbose, "SetFileInformation failed. Invalid FID.");
                 header.Status = NTStatus.STATUS_INVALID_HANDLE;
                 return null;
             }

+ 2 - 0
SMBLibrary/Server/SMB1/TransactionSubcommandHelper.cs

@@ -22,6 +22,7 @@ namespace SMBLibrary.Server.SMB1
             OpenFileObject openFile = session.GetOpenFileObject(subcommand.FID);
             if (openFile == null)
             {
+                state.LogToServer(Severity.Verbose, "TransactNamedPipe failed. Invalid FID.");
                 header.Status = NTStatus.STATUS_INVALID_HANDLE;
                 return null;
             }
@@ -31,6 +32,7 @@ namespace SMBLibrary.Server.SMB1
             header.Status = share.FileStore.DeviceIOControl(openFile.Handle, (uint)IoControlCode.FSCTL_PIPE_TRANSCEIVE, subcommand.WriteData, out output, maxOutputLength);
             if (header.Status != NTStatus.STATUS_SUCCESS && header.Status != NTStatus.STATUS_BUFFER_OVERFLOW)
             {
+                state.LogToServer(Severity.Verbose, "TransactNamedPipe failed. NTStatus: {0}.", header.Status);
                 return null;
             }
             TransactionTransactNamedPipeResponse response = new TransactionTransactNamedPipeResponse();