aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_sftpd.erl
diff options
context:
space:
mode:
authorKarolis Petrauskas <[email protected]>2017-02-12 15:00:36 +0200
committerKarolis Petrauskas <[email protected]>2017-02-12 15:00:36 +0200
commit002e507bab9209aeb5487ee3a1dbe52a73f80f84 (patch)
treefc431befdaa3498ba128fb9fd13cdb3bec0d7381 /lib/ssh/src/ssh_sftpd.erl
parenta34576111652d2d7972147160f93cfbbc9f13251 (diff)
downloadotp-002e507bab9209aeb5487ee3a1dbe52a73f80f84.tar.gz
otp-002e507bab9209aeb5487ee3a1dbe52a73f80f84.tar.bz2
otp-002e507bab9209aeb5487ee3a1dbe52a73f80f84.zip
Check for directory with correct path
When opening file in the ssh_sftpd, directory check should be performed on the server's file tree.
Diffstat (limited to 'lib/ssh/src/ssh_sftpd.erl')
-rw-r--r--lib/ssh/src/ssh_sftpd.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_sftpd.erl b/lib/ssh/src/ssh_sftpd.erl
index a6f4af7879..7ebe5ed4ef 100644
--- a/lib/ssh/src/ssh_sftpd.erl
+++ b/lib/ssh/src/ssh_sftpd.erl
@@ -667,7 +667,8 @@ do_open(ReqId, State0, Path, Flags) ->
#state{file_handler = FileMod, file_state = FS0, xf = #ssh_xfer{vsn = Vsn}} = State0,
XF = State0#state.xf,
F = [binary | Flags],
- {IsDir, _FS1} = FileMod:is_dir(Path, FS0),
+ AbsPath = relate_file_name(Path, State0),
+ {IsDir, _FS1} = FileMod:is_dir(AbsPath, FS0),
case IsDir of
true when Vsn > 5 ->
ssh_xfer:xf_send_status(State0#state.xf, ReqId,
@@ -676,7 +677,6 @@ do_open(ReqId, State0, Path, Flags) ->
ssh_xfer:xf_send_status(State0#state.xf, ReqId,
?SSH_FX_FAILURE, "File is a directory");
false ->
- AbsPath = relate_file_name(Path, State0),
{Res, FS1} = FileMod:open(AbsPath, F, FS0),
State1 = State0#state{file_state = FS1},
case Res of