diff options
author | Ingela Anderton Andin <[email protected]> | 2012-02-29 12:28:57 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2012-03-01 19:01:32 +0100 |
commit | 4ad7238ba71b818fa0e3a1ea24bb002daeb11f3a (patch) | |
tree | 31bd24327330f84852bdcdae2d81de5a8306f27e /lib/ssh/src | |
parent | 6510ee4abddbecf10b41d0474a35af1e780ea5be (diff) | |
download | otp-4ad7238ba71b818fa0e3a1ea24bb002daeb11f3a.tar.gz otp-4ad7238ba71b818fa0e3a1ea24bb002daeb11f3a.tar.bz2 otp-4ad7238ba71b818fa0e3a1ea24bb002daeb11f3a.zip |
sftp daemon generates file handles correct
Also always run ssh_sftp_SUITE against own daemon as well as openssh
if existing. Corrected links test case and found that openssh has a
known bug that swaps the create link arguments. Created separate
ticket (OTP-9951) to deal with this.
Diffstat (limited to 'lib/ssh/src')
-rw-r--r-- | lib/ssh/src/ssh_sftpd.erl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/ssh/src/ssh_sftpd.erl b/lib/ssh/src/ssh_sftpd.erl index 8cc414f83a..ec7b76b0b3 100644 --- a/lib/ssh/src/ssh_sftpd.erl +++ b/lib/ssh/src/ssh_sftpd.erl @@ -424,18 +424,18 @@ handle_op(?SSH_FXP_RENAME, ReqId, State0 end; handle_op(?SSH_FXP_SYMLINK, ReqId, - <<?UINT32(PLen), BPath:PLen/binary, ?UINT32(PLen2), - BPath2:PLen2/binary>>, + <<?UINT32(PLen), Link:PLen/binary, ?UINT32(PLen2), + Target:PLen2/binary>>, State0 = #state{file_handler = FileMod, file_state = FS0}) -> - Path = relate_file_name(BPath, State0), - Path2 = relate_file_name(BPath2, State0), - {Status, FS1} = FileMod:make_symlink(Path2, Path, FS0), + LinkPath = relate_file_name(Link, State0), + TargetPath = relate_file_name(Target, State0), + {Status, FS1} = FileMod:make_symlink(TargetPath, LinkPath, FS0), State1 = State0#state{file_state = FS1}, send_status(Status, ReqId, State1). new_handle([], H) -> H; -new_handle([{N, _} | Rest], H) when N > H -> +new_handle([{N, _,_} | Rest], H) when N =< H -> new_handle(Rest, N+1); new_handle([_ | Rest], H) -> new_handle(Rest, H). @@ -444,6 +444,8 @@ add_handle(State, XF, ReqId, Type, DirFileTuple) -> Handles = State#state.handles, Handle = new_handle(Handles, 0), ssh_xfer:xf_send_handle(XF, ReqId, integer_to_list(Handle)), + %% OBS: If you change handles-tuple also change new_handle! + %% Is this this the best way to implement new handle? State#state{handles = [{Handle, Type, DirFileTuple} | Handles]}. get_handle(Handles, BinHandle) -> |