Suspicious callback when using an SFTP server-side file handler

Rabbe Fogelholm <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <[email protected]>
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
_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.