[erlang-bugs] Suspicious callback when using an SFTP server-side file handler
Rabbe Fogelholm
rabbe.fogelholm@REDACTED
Wed Jan 14 17:52:22 CET 2015
I have set up an SFTP service, using OTP SSH, where I configure a custom
ssh_sftpd_file_api module.
The service is started with a subsystem_spec() roughly like this:
{"sftp",
{mySftpd,
[{cwd,"/aaa/bbb"},
{root,"/aaa/bbb"},
{file_handler,myStfpdHandler},
{sftpd_vsn,3}]}}
The callbacks generally pass paths that are filesystem-absolute. For example,
when myStfpdHandler:is_dir/2 is called the passed path may look like
"/aaa/bbb/xxx/somefile.txt"
This happens when the callback occurs due to an SFTP client call like this,
ls /xxx
However, if I instead make the following SFTP client command
get /xxx/somefile.txt
the path passed to is_dir/2 is instead
"/xxx/somefile.txt"
This path does not make sense? The default callback module calls filelib:is_dir/1
with the passed path, which is bound to be false all the time.
So, I suspect that there may be a bug, although not a very serious one: The "get"
operation succeeds despite the peculiar call. Anyway, for the passed path to be
useful in is_dir/2 it ought to be filesystem-absolute all the time, just like the
argument name suggests.
_______________
Rabbe fogelholm, Ericsson, Stockholm
More information about the erlang-bugs
mailing list