SMB1: Improved logging of Transaction2 subcommands

This commit is contained in:
Tal Aloni 2017-03-15 12:23:19 +02:00
parent 112ab74cc3
commit 941429d75e

View file

@ -146,6 +146,7 @@ namespace SMBLibrary.Server.SMB1
header.Status = queryStatus; header.Status = queryStatus;
return null; return null;
} }
state.LogToServer(Severity.Information, "GetFileSystemInformation on '{0}' succeeded. Information level: {1}", share.Name, subcommand.InformationLevel);
response.SetQueryFSInformation(queryFSInformation, header.UnicodeFlag); response.SetQueryFSInformation(queryFSInformation, header.UnicodeFlag);
return response; return response;
} }
@ -173,6 +174,7 @@ namespace SMBLibrary.Server.SMB1
header.Status = queryStatus; header.Status = queryStatus;
return null; return null;
} }
state.LogToServer(Severity.Information, "GetFileInformation on '{0}{1}' succeeded. Information level: {2}", share.Name, path, subcommand.InformationLevel);
response.SetQueryInformation(queryInformation); response.SetQueryInformation(queryInformation);
return response; return response;
} }
@ -206,6 +208,7 @@ namespace SMBLibrary.Server.SMB1
header.Status = queryStatus; header.Status = queryStatus;
return null; return null;
} }
state.LogToServer(Severity.Information, "GetFileInformation on '{0}{1}' succeeded. Information level: {2}", share.Name, openFile.Path, subcommand.InformationLevel);
response.SetQueryInformation(queryInformation); response.SetQueryInformation(queryInformation);
return response; return response;
} }
@ -237,11 +240,13 @@ namespace SMBLibrary.Server.SMB1
} }
catch(UnsupportedInformationLevelException) catch(UnsupportedInformationLevelException)
{ {
state.LogToServer(Severity.Verbose, "SetFileInformation on '{0}{1}' failed. Information level: {2}, NTStatus: STATUS_OS2_INVALID_LEVEL", share.Name, openFile.Path, subcommand.InformationLevel);
header.Status = NTStatus.STATUS_OS2_INVALID_LEVEL; header.Status = NTStatus.STATUS_OS2_INVALID_LEVEL;
return null; return null;
} }
catch(Exception) catch(Exception)
{ {
state.LogToServer(Severity.Verbose, "SetFileInformation on '{0}{1}' failed. Information level: {2}, NTStatus: STATUS_INVALID_PARAMETER", share.Name, openFile.Path, subcommand.InformationLevel);
header.Status = NTStatus.STATUS_INVALID_PARAMETER; header.Status = NTStatus.STATUS_INVALID_PARAMETER;
return null; return null;
} }
@ -249,10 +254,11 @@ namespace SMBLibrary.Server.SMB1
NTStatus status = SMB1FileStoreHelper.SetFileInformation(share.FileStore, openFile.Handle, information); NTStatus status = SMB1FileStoreHelper.SetFileInformation(share.FileStore, openFile.Handle, information);
if (status != NTStatus.STATUS_SUCCESS) if (status != NTStatus.STATUS_SUCCESS)
{ {
state.LogToServer(Severity.Verbose, "SetFileInformation on '{0}{1}' failed. Information level: {2}, NTStatus: {3}", share.Name, openFile.Path, information.InformationLevel, status); state.LogToServer(Severity.Verbose, "SetFileInformation on '{0}{1}' failed. Information level: {2}, NTStatus: {3}", share.Name, openFile.Path, subcommand.InformationLevel, status);
header.Status = status; header.Status = status;
return null; return null;
} }
state.LogToServer(Severity.Information, "SetFileInformation on '{0}{1}' succeeded. Information level: {2}", share.Name, openFile.Path, subcommand.InformationLevel);
Transaction2SetFileInformationResponse response = new Transaction2SetFileInformationResponse(); Transaction2SetFileInformationResponse response = new Transaction2SetFileInformationResponse();
return response; return response;
} }