This repository has been archived by the owner on Jan 22, 2024. It is now read-only.
Return errno when fopen fails on request_fs_file_channel_open #90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Windows environments
request_fs_file_channel_open
returns theGetLastError
result code whenfopen
fails. But, on linux environment, there isn'tGetLastError
, andrequest_fs_file_channel_open
fails to return theerrno
code. Because of that, the (client)PacketDispatcher
fails to find an error on the response, not handling the error, which ends with unhandled exceptions. It's easy to reproduce by trying to update a file to a nonexisting remote directory on linux meterpreter:By turning
errno
on non-winidows environments, the meterpreterPacketDispatcher
is able to catch the error, and unhandled exceptions not happen anymore:On the other hand, the linux meterpreter (client) doesn't solve errno codes atm, showing just the error identifier. When handling with windows machines, the meterpreter (client) is able to handle
GetLastError()
codes, showing more user-friendly errors. It's on my TODO, but out of scope change for this pull request, which just tries to solve unhandled exceptions when dealing withrequest_fs_file_channel_open
.