From 685be319a6e11c82c59720e681fd91330177dad7 Mon Sep 17 00:00:00 2001 From: Tal Aloni Date: Wed, 15 Mar 2017 12:28:54 +0200 Subject: [PATCH] SMB2: Minor logging improvements --- SMBLibrary/Server/SMB2/QueryInfoHelper.cs | 3 +++ SMBLibrary/Server/SMB2/SetInfoHelper.cs | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/SMBLibrary/Server/SMB2/QueryInfoHelper.cs b/SMBLibrary/Server/SMB2/QueryInfoHelper.cs index 7e2dfb2..e1ceb78 100644 --- a/SMBLibrary/Server/SMB2/QueryInfoHelper.cs +++ b/SMBLibrary/Server/SMB2/QueryInfoHelper.cs @@ -42,6 +42,7 @@ namespace SMBLibrary.Server.SMB2 return new ErrorResponse(request.CommandName, queryStatus); } + state.LogToServer(Severity.Information, "GetFileInformation on '{0}{1}' succeeded. Information class: {2}", share.Name, openFile.Path, request.FileInformationClass); QueryInfoResponse response = new QueryInfoResponse(); response.SetFileInformation(fileInformation); return response; @@ -63,6 +64,8 @@ namespace SMBLibrary.Server.SMB2 state.LogToServer(Severity.Verbose, "GetFileSystemInformation on '{0}' failed. Information class: {1}, NTStatus: {2}", share.Name, request.FileSystemInformationClass, queryStatus); return new ErrorResponse(request.CommandName, queryStatus); } + + state.LogToServer(Severity.Information, "GetFileSystemInformation on '{0} succeeded. Information class: {1}", share.Name, request.FileSystemInformationClass); QueryInfoResponse response = new QueryInfoResponse(); response.SetFileSystemInformation(fileSystemInformation); return response; diff --git a/SMBLibrary/Server/SMB2/SetInfoHelper.cs b/SMBLibrary/Server/SMB2/SetInfoHelper.cs index 670b3ce..e0e1ce5 100644 --- a/SMBLibrary/Server/SMB2/SetInfoHelper.cs +++ b/SMBLibrary/Server/SMB2/SetInfoHelper.cs @@ -41,23 +41,27 @@ namespace SMBLibrary.Server.SMB2 } catch (UnsupportedInformationLevelException) { + state.LogToServer(Severity.Verbose, "SetFileInformation on '{0}{1}' failed. Information class: {2}, NTStatus: STATUS_INVALID_INFO_CLASS", share.Name, openFile.Path, request.FileInformationClass); return new ErrorResponse(request.CommandName, NTStatus.STATUS_INVALID_INFO_CLASS); } catch (NotImplementedException) { + state.LogToServer(Severity.Verbose, "SetFileInformation on '{0}{1}' failed. Information class: {2}, NTStatus: STATUS_NOT_SUPPORTED", share.Name, openFile.Path, request.FileInformationClass); return new ErrorResponse(request.CommandName, NTStatus.STATUS_NOT_SUPPORTED); } catch (Exception) { + state.LogToServer(Severity.Verbose, "SetFileInformation on '{0}{1}' failed. Information class: {2}, NTStatus: STATUS_INVALID_PARAMETER", share.Name, openFile.Path, request.FileInformationClass); return new ErrorResponse(request.CommandName, NTStatus.STATUS_INVALID_PARAMETER); } NTStatus status = share.FileStore.SetFileInformation(openFile.Handle, information); if (status != NTStatus.STATUS_SUCCESS) { - state.LogToServer(Severity.Verbose, "SetFileInformation on '{0}{1}' failed. Information class: {2}, NTStatus: {3}", share.Name, openFile.Path, information.FileInformationClass, status); + state.LogToServer(Severity.Verbose, "SetFileInformation on '{0}{1}' failed. Information class: {2}, NTStatus: {3}", share.Name, openFile.Path, request.FileInformationClass, status); return new ErrorResponse(request.CommandName, status); } + state.LogToServer(Severity.Information, "SetFileInformation on '{0}{1}' succeeded. Information class: {2}", share.Name, openFile.Path, request.FileInformationClass); return new SetInfoResponse(); } return new ErrorResponse(request.CommandName, NTStatus.STATUS_NOT_SUPPORTED);