diff options
author | Ingela Anderton Andin <[email protected]> | 2015-01-21 15:33:36 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2015-01-23 09:59:30 +0100 |
commit | b3069dbb63bcdba437157911763073cbd62d40eb (patch) | |
tree | 2fee9710ad702e616248208b8ab3fc7c27baa70c /lib/ssh/src/ssh_sftpd.erl | |
parent | 677cb69c4c919e40d074df3bae40338a375a4731 (diff) | |
download | otp-b3069dbb63bcdba437157911763073cbd62d40eb.tar.gz otp-b3069dbb63bcdba437157911763073cbd62d40eb.tar.bz2 otp-b3069dbb63bcdba437157911763073cbd62d40eb.zip |
ssh: Add handling of sftp v3 flags
Diffstat (limited to 'lib/ssh/src/ssh_sftpd.erl')
-rw-r--r-- | lib/ssh/src/ssh_sftpd.erl | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/ssh/src/ssh_sftpd.erl b/lib/ssh/src/ssh_sftpd.erl index 52665635f0..5410bd1925 100644 --- a/lib/ssh/src/ssh_sftpd.erl +++ b/lib/ssh/src/ssh_sftpd.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2013. All Rights Reserved. +%% Copyright Ericsson AB 2005-2015. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -558,7 +558,20 @@ stat(ReqId, RelPath, State0=#state{file_handler=FileMod, {error, E} -> send_status({error, E}, ReqId, State1) end. - +%% sftp v3 +decode_4_open_flag(read) -> + [read]; +decode_4_open_flag(write) -> + [write]; +decode_4_open_flag(append) -> + [append]; +decode_4_open_flag(creat) -> + [write]; +decode_4_open_flag(trunc) -> + [write]; +decode_4_open_flag(excl) -> + [read]; +%% sftp newer decode_4_open_flag(create_new) -> [write]; decode_4_open_flag(create_truncate) -> @@ -608,7 +621,8 @@ open(Vsn, ReqId, Data, State) when Vsn =< 3 -> <<?UINT32(BLen), BPath:BLen/binary, ?UINT32(PFlags), _Attrs/binary>> = Data, Path = unicode:characters_to_list(BPath), - Flags = ssh_xfer:decode_open_flags(Vsn, PFlags), + FlagBits = ssh_xfer:decode_open_flags(Vsn, PFlags), + Flags = lists:append(lists:umerge([[decode_4_flags(FlagBits)]])), do_open(ReqId, State, Path, Flags); open(Vsn, ReqId, Data, State) when Vsn >= 4 -> <<?UINT32(BLen), BPath:BLen/binary, ?UINT32(Access), |