You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the get_attrs/6 function in ssh_ftpd.erl (https://github.com/erlang/otp/blob/master/lib/ssh/src/ssh_sftpd.erl#L567) should be set up to handle {error, eacces} (and maybe other errors too) the same as {error, enoent} when running the FileMod:read_link_info/2 function. If the error is anything other than {error, enoent}, the xf_send_names/3 in ssh_xfer.erl will crash with the following:
(it may be worth noting that I am running this from Elixir, and am checking a file where eacces is being returned)
If the user is to use the default FileMod of ssh_sftp_file, the erlang module https://erlang.org/doc/man/file.html will be used and file:read_link_info/1 will be called. file:read_link_info/1 can return more than just {error, enoent} (see https://erlang.org/doc/man/file.html#type-posix), so even if the user uses the default FileMod this crash can occur.
Problem
I think the get_attrs/6 function in ssh_ftpd.erl (https://github.com/erlang/otp/blob/master/lib/ssh/src/ssh_sftpd.erl#L567) should be set up to handle {error, eacces} (and maybe other errors too) the same as {error, enoent} when running the FileMod:read_link_info/2 function. If the error is anything other than {error, enoent}, the xf_send_names/3 in ssh_xfer.erl will crash with the following:
(it may be worth noting that I am running this from Elixir, and am checking a file where eacces is being returned)
If the user is to use the default FileMod of ssh_sftp_file, the erlang module https://erlang.org/doc/man/file.html will be used and file:read_link_info/1 will be called. file:read_link_info/1 can return more than just {error, enoent} (see https://erlang.org/doc/man/file.html#type-posix), so even if the user uses the default FileMod this crash can occur.
Possible Solution
A clear and concise description of what you want to happen.
The solution here I think is to handle {error, eacces} and possibly other error cases the same as {error, enoent}. See https://github.com/alanj853/otp/pull/1/files#diff-3633e8b884563ad1c24bf23c387c168fd21c25f5bbbdc73d4ef3010f6b106e04R569 for an example.
Perhaps there is a reason why enoent is the only case that is handled differently, and if so, can somebody please tell me why this is the case.
The text was updated successfully, but these errors were encountered: