LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 0514-Fix-sftpd-interop-for-SSH_FXP_STAT.patch of Package erlang (Project home:Ledest:erlang:20)

From 7b8c8ba289125a52d4dfca2da506e2063cb99d0e Mon Sep 17 00:00:00 2001
From: Kristoffer Larsen <kri@telia.net>
Date: Fri, 4 Jan 2019 13:15:35 +0100
Subject: [PATCH] Fix sftpd interop for SSH_FXP_STAT

Some SFTP client's have been discover to claim one version of the
protocol and send messages in a different version.

In the spirit of Postel's law, we can for SSH_FXP_STAT, ignore the
differences in the protocol, as we are not doing anything with the flags
anyway.
---
 lib/ssh/src/ssh_sftpd.erl | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/ssh/src/ssh_sftpd.erl b/lib/ssh/src/ssh_sftpd.erl
index 278f6a9780..aa9ba0f9bb 100644
--- a/lib/ssh/src/ssh_sftpd.erl
+++ b/lib/ssh/src/ssh_sftpd.erl
@@ -508,11 +508,8 @@ close_our_file({_,Fd}, FileMod, FS0) ->
     FS1.
 
 %%% stat: do the stat
-stat(Vsn, ReqId, Data, State, F) when Vsn =< 3->
-    <<?UINT32(BLen), BPath:BLen/binary>> = Data,
-    stat(ReqId, unicode:characters_to_list(BPath), State, F);
-stat(Vsn, ReqId, Data, State, F) when Vsn >= 4->
-    <<?UINT32(BLen), BPath:BLen/binary, ?UINT32(_Flags)>> = Data,
+stat(Vsn, ReqId, Data, State, F) ->
+    <<?UINT32(BLen), BPath:BLen/binary, _/binary>> = Data,
     stat(ReqId, unicode:characters_to_list(BPath), State, F).
 
 fstat(Vsn, ReqId, Data, State) when Vsn =< 3->
-- 
2.16.4