Browse Source

Write to log when CreateFile failed

Tal Aloni 8 years ago
parent
commit
25584a151f

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

@@ -37,6 +37,7 @@ namespace SMBLibrary.Server.SMB1
             NTStatus createStatus = share.FileStore.CreateFile(out handle, out fileStatus, path, request.DesiredAccess, request.ShareAccess, request.CreateDisposition, request.CreateOptions, session.SecurityContext);
             if (createStatus != NTStatus.STATUS_SUCCESS)
             {
+                state.LogToServer(Severity.Verbose, "Create: Opening '{0}{1}' failed. NTStatus: '{2}'.", share.Name, path, createStatus);
                 header.Status = createStatus;
                 return new ErrorResponse(request.CommandName);
             }

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

@@ -54,6 +54,7 @@ namespace SMBLibrary.Server.SMB1
             header.Status = share.FileStore.CreateFile(out handle, out fileStatus, path, desiredAccess, shareAccess, createDisposition, createOptions, session.SecurityContext);
             if (header.Status != NTStatus.STATUS_SUCCESS)
             {
+                state.LogToServer(Severity.Verbose, "OpenAndX: Opening '{0}{1}' failed. NTStatus: '{2}'.", share.Name, path, header.Status);
                 return new ErrorResponse(request.CommandName);
             }
 

+ 1 - 0
SMBLibrary/Server/SMB2/CreateHelper.cs

@@ -38,6 +38,7 @@ namespace SMBLibrary.Server.SMB2
             NTStatus createStatus = share.FileStore.CreateFile(out handle, out fileStatus, path, request.DesiredAccess, request.ShareAccess, request.CreateDisposition, request.CreateOptions, session.SecurityContext);
             if (createStatus != NTStatus.STATUS_SUCCESS)
             {
+                state.LogToServer(Severity.Verbose, "Create: Opening '{0}{1}' failed. NTStatus: '{2}'.", share.Name, path, createStatus);
                 return new ErrorResponse(request.CommandName, createStatus);
             }