aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src
diff options
context:
space:
mode:
authorKarolis Petrauskas <[email protected]>2017-02-07 11:50:40 +0200
committerKarolis Petrauskas <[email protected]>2017-02-12 13:20:29 +0200
commita34576111652d2d7972147160f93cfbbc9f13251 (patch)
tree4a8e6244aa23940df53350890f73415eaa38cb87 /lib/ssh/src
parent47b4abf118e2dac88c5c2cbd531372cc217854ec (diff)
downloadotp-a34576111652d2d7972147160f93cfbbc9f13251.tar.gz
otp-a34576111652d2d7972147160f93cfbbc9f13251.tar.bz2
otp-a34576111652d2d7972147160f93cfbbc9f13251.zip
Fix relative path handling in sftpd
Relative path handling fixed to allow opening a file by a path relative to the current working directory.
Diffstat (limited to 'lib/ssh/src')
-rw-r--r--lib/ssh/src/ssh_sftpd.erl9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/ssh/src/ssh_sftpd.erl b/lib/ssh/src/ssh_sftpd.erl
index b739955836..a6f4af7879 100644
--- a/lib/ssh/src/ssh_sftpd.erl
+++ b/lib/ssh/src/ssh_sftpd.erl
@@ -664,7 +664,7 @@ open(Vsn, ReqId, Data, State) when Vsn >= 4 ->
do_open(ReqId, State, Path, Flags).
do_open(ReqId, State0, Path, Flags) ->
- #state{file_handler = FileMod, file_state = FS0, root = Root, xf = #ssh_xfer{vsn = Vsn}} = State0,
+ #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),
@@ -676,12 +676,7 @@ do_open(ReqId, State0, Path, Flags) ->
ssh_xfer:xf_send_status(State0#state.xf, ReqId,
?SSH_FX_FAILURE, "File is a directory");
false ->
- AbsPath = case Root of
- "" ->
- Path;
- _ ->
- relate_file_name(Path, State0)
- end,
+ AbsPath = relate_file_name(Path, State0),
{Res, FS1} = FileMod:open(AbsPath, F, FS0),
State1 = State0#state{file_state = FS1},
case Res of