Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
04c2eda0fe
!38 sync some patches
From: @chengyechun 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
2024-11-22 09:10:13 +00:00
chengyechun
bf231264cb sync some patches 2024-11-22 16:53:13 +08:00
openeuler-ci-bot
592c00692c
!36 sync some patch
From: @chengyechun 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
2024-11-13 01:18:05 +00:00
chengyechun
c05cb91a58 fix sftp too many out of order packets 2024-11-11 15:04:51 +08:00
openeuler-ci-bot
ef8bb83b50
!19 update some patches from community
From: @chengyechun 
Reviewed-by: @seuzw 
Signed-off-by: @seuzw
2022-10-17 08:30:50 +00:00
chengyechun
c2686e9235 fix second find_cmd Segmentation fault 2022-09-13 16:30:58 +08:00
openeuler-ci-bot
780e486ce5 !8 Quit while source file increased
From: @sherlock2010
Reviewed-by: @zengwefeng
Signed-off-by: @zengwefeng
2021-10-29 01:09:37 +00:00
sherlock2010
6c76cb8ff3 Quit while source file increased 2021-10-28 19:20:03 +08:00
openeuler-ci-bot
73266c107d !7 update lftp to 4.9.2
From: @haochenstar
Reviewed-by: @zengwefeng
Signed-off-by: @zengwefeng
2021-01-30 14:45:59 +08:00
haochenstar
9cbb7e7041 update lftp to 4.9.2 2021-01-29 11:05:08 +08:00
9 changed files with 376 additions and 3 deletions

View File

@ -0,0 +1,57 @@
From 3cabbf03f80e78a69a0b9e797050a1dacf5c26da Mon Sep 17 00:00:00 2001
From: sherlock2010 <15151851377@163.com>
Date: Thu, 28 Oct 2021 18:36:53 +0800
Subject: [PATCH] Quit while source file increased
---
src/FileCopy.cc | 7 +++++++
src/FileCopy.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/src/FileCopy.cc b/src/FileCopy.cc
index ead65a2..361958e 100644
--- a/src/FileCopy.cc
+++ b/src/FileCopy.cc
@@ -1137,6 +1137,7 @@ void FileCopyPeerFA::OpenSession()
debug((10,"copy dst: seek past eof (seek_pos=%lld, size=%lld)\n",
(long long)seek_pos,(long long)e_size));
eof=true;
+ fileincreased=true;
if(date==NO_DATE || date==NO_DATE_YET)
return;
}
@@ -1284,6 +1285,11 @@ int FileCopyPeerFA::Put_LL(const char *buf,int len)
if(session->IsClosed())
OpenSession();
+ if(fileincreased)
+ {
+ SetError(_("file size increased during transfer"));
+ return -1;
+ }
off_t io_at=pos; // GetRealPos can alter pos, save it.
if(GetRealPos()!=io_at)
return 0;
@@ -1352,6 +1358,7 @@ void FileCopyPeerFA::Init()
{
get_delay=0;
fxp=false;
+ fileincreased=false;
redirections=0;
can_seek=true;
can_seek0=true;
diff --git a/src/FileCopy.h b/src/FileCopy.h
index af97880..5a9e4cf 100644
--- a/src/FileCopy.h
+++ b/src/FileCopy.h
@@ -335,6 +335,7 @@ class FileCopyPeerFA : public FileCopyPeer
FileSet info;
bool fxp; // FXP (ftp<=>ftp copy) active
+ bool fileincreased;
UploadState upload_state;
int redirections;
--
1.8.3.1

View File

@ -0,0 +1,30 @@
From 40c20c587ed6435bb489f31c0aac94c2ca828f4a Mon Sep 17 00:00:00 2001
From: Kevin Adler <kadler@su.ibm.com>
Date: Sat, 23 Jul 2022 16:39:40 +0800
Subject: [PATCH] Ensure that PollVec enum matches poll values
Conflict:NA
Reference:https://github.com/lavv17/lftp/commit/40c20c587ed6435bb489f31c0aac94c2ca828f4a
---
src/PollVec.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/PollVec.h b/src/PollVec.h
index fda75a4..296f2f2 100644
--- a/src/PollVec.h
+++ b/src/PollVec.h
@@ -59,8 +59,8 @@ public:
void Block();
enum {
- IN=1,
- OUT=4,
+ IN=POLLIN,
+ OUT=POLLOUT,
};
void SetTimeout(const timeval &t) { tv_timeout=t; }
--
2.23.0

View File

@ -0,0 +1,33 @@
From d67fc14d085849a6b0418bb3e912fea2e94c18d1 Mon Sep 17 00:00:00 2001
From: "Alexander V. Lukyanov" <lavv17f@gmail.com>
Date: Sat, 28 Nov 2020 20:09:11 +0300
Subject: [PATCH] fix a coredump in TorrentTracker (fix #513)
Conflict: NA
Reference: https://github.com/lavv17/lftp/commit/d67fc14d085849a6b0418bb3e912fea2e94c18d1
---
src/TorrentTracker.cc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/TorrentTracker.cc b/src/TorrentTracker.cc
index f867c334..30b531ce 100644
--- a/src/TorrentTracker.cc
+++ b/src/TorrentTracker.cc
@@ -121,7 +121,7 @@ bool TorrentTracker::AddPeer(const xstring& addr,int port) const
int TorrentTracker::Do()
{
int m=STALL;
- if(Failed())
+ if(Failed() || !backend)
return m;
if(backend && backend->IsActive()) {
if(tracker_timeout_timer.Stopped()) {
@@ -165,6 +165,8 @@ void TorrentTracker::Start()
}
void TorrentTracker::SendTrackerRequest(const char *event)
{
+ if(!backend)
+ return;
backend->SendTrackerRequest(event);
tracker_timeout_timer.Reset();
}

View File

@ -0,0 +1,47 @@
From ced8ab2f95695aee05424e9aa206cd59a3f90888 Mon Sep 17 00:00:00 2001
From: "Alexander V. Lukyanov" <lavv17f@gmail.com>
Date: Mon, 5 Jul 2021 19:59:33 +0300
Subject: [PATCH] fix a null deref on exit
Conflict: NA
Reference: https://github.com/lavv17/lftp/commit/ced8ab2f95695aee05424e9aa206cd59a3f90888
---
src/Job.cc | 7 +++++--
src/SMTask.cc | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/Job.cc b/src/Job.cc
index 63be3fb5..b783eae4 100644
--- a/src/Job.cc
+++ b/src/Job.cc
@@ -365,12 +365,15 @@ xstring& Job::FormatJobs(xstring& s,int verbose,int indent)
void Job::BuryDoneJobs()
{
- xlist_for_each_safe(Job,all_jobs,node,scan,next)
+ xarray<Job*> to_bury;
+ xlist_for_each(Job,all_jobs,node,scan)
{
if((scan->parent==this || scan->parent==0) && scan->jobno>=0
&& scan->Done())
- scan->DeleteLater();
+ to_bury.append(scan);
}
+ for(int i=0; i<to_bury.count(); i++)
+ to_bury[i]->DeleteLater();
CollectGarbage();
}
diff --git a/src/SMTask.cc b/src/SMTask.cc
index b8a84e2f..435ab8c3 100644
--- a/src/SMTask.cc
+++ b/src/SMTask.cc
@@ -129,6 +129,7 @@ void SMTask::DeleteLater()
{
if(deleting)
return;
+ DEBUG(("DeleteLater(%p) from %p\n",this,current));
deleting=true;
deleted_tasks.add_tail(deleted_tasks_node);
PrepareToDie();

View File

@ -0,0 +1,94 @@
From 0ead378c8a19d4c7b86e35265a7f6e878fd63c0d Mon Sep 17 00:00:00 2001
From: "Alexander V. Lukyanov" <lavv17@gmail.com>
Date: Wed, 20 Apr 2022 23:32:37 +0300
Subject: [PATCH] fix second find_cmd Segmentation fault
Conflict:NA
Reference:https://github.com/lavv17/lftp/commit/0ead378c8a19d4c7b86e35265a7f6e878fd63c0d
---
src/GetFileInfo.cc | 34 +++++++++++++++++++++++-----------
src/GetFileInfo.h | 2 ++
2 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/src/GetFileInfo.cc b/src/GetFileInfo.cc
index 7afb3d8..4d08dfa 100644
--- a/src/GetFileInfo.cc
+++ b/src/GetFileInfo.cc
@@ -114,6 +114,22 @@ void GetFileInfo::PrepareToDie()
}
}
+void GetFileInfo::MakeVerifyFileName()
+{
+ /* Here we should have the home directory path. Find out
+ * the real name of the path. (we may have something like "~..".) */
+
+ FileAccess::Path pwd(session->GetCwd());
+
+ session->SetCwd(origdir);
+ session->Chdir(dir, false);
+
+ verify_fn.set(basename_ptr(session->GetCwd()));
+
+ /* go back */
+ session->SetCwd(pwd);
+}
+
int GetFileInfo::Do()
{
int res;
@@ -241,6 +257,8 @@ int GetFileInfo::Do()
if(!saved_error_text)
saved_error_text.set(session->StrError(res));
session->Close();
+ if(!verify_fn)
+ MakeVerifyFileName();
if(res==FA::NO_FILE)
{
/* If this is a CWD to the parent, and it failed, we
@@ -262,17 +280,7 @@ int GetFileInfo::Do()
/* Now that we've connected, we should have the home directory path. Find out
* the real name of the path. (We may have something like "~/..".) */
if(!verify_fn)
- {
- FileAccess::Path pwd(session->GetCwd());
-
- session->SetCwd(origdir);
- session->Chdir(dir, false);
-
- verify_fn.set(basename_ptr(session->GetCwd()));
-
- /* go back */
- session->SetCwd(pwd);
- }
+ MakeVerifyFileName();
/* Special case: looking up "/". Make a phony entry. */
if(showdir && !strcmp(verify_fn, "/"))
@@ -390,6 +398,10 @@ int GetFileInfo::Do()
* also serves as a last attempt to see if the file exists--we
* only get here if everything else thinks the path doesn't exist.
*/
+
+ /* verify_fn_mabe null. */
+ if(!verify_fn)
+ MakeVerifyFileName();
FileInfo *fi=new FileInfo(verify_fn);
fi->need=need;
/* We need to do at least one. */
diff --git a/src/GetFileInfo.h b/src/GetFileInfo.h
index 1ac8f4d..483dcc3 100644
--- a/src/GetFileInfo.h
+++ b/src/GetFileInfo.h
@@ -66,6 +66,8 @@ class GetFileInfo : public ListInfo
void PrepareToDie();
+ void MakeVerifyFileName();
+
public:
GetFileInfo(const FileAccessRef& a, const char *path, bool showdir);
virtual ~GetFileInfo();
--
2.23.0

View File

@ -0,0 +1,75 @@
From fdb81537a2f854cf5e2b9dd95c7e5542bb5cd420 Mon Sep 17 00:00:00 2001
From: Paul Dennis <padenn@github.com>
Date: Mon, 29 Jul 2024 16:43:02 -0400
Subject: [PATCH] Attempt to fix SFTP issue #636 Too many out-of-order packets.
lftp supports making many SFTP DATA requests in parallel when downloading a file. Responses
with data payloads from an sftp server can sometimes arrive in a different order from the
original requests.
The out of order data payload (packets) are added to the `ooo_chain` to be processed when the expected
(but late) next requested packet arrives.
A single packet being delayed while many parallel requests continue to be made can sometimes result in the
`Too many out-of-order packets` message if the `ooo_chain` buffer of 64 entries is exceeded.
This fix checks the remaining capacity of the `ooo_chain` and pending requests (`RespQueueSize()`)
and will avoid sending new requests for more data until the `ooo_chain` is processed or `RespQueueSize()`
shrinks. Adding this constraint does mean that `sftp:max-packets-in-flight` will be limited to
the current `ooo_chain` length of 64.
I was able to reliably reproduce the issue with a 4gb download and verify the fix.
Conflict:NA
Reference:https://github/lavv17/lftp/commit/fdb81537a2f854cf5e2b9dd95c7e5542bb5cd420
---
src/SFtp.cc | 8 ++++++--
src/SFtp.h | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/SFtp.cc b/src/SFtp.cc
index 6c818dfa1..5879a6314 100644
--- a/src/SFtp.cc
+++ b/src/SFtp.cc
@@ -344,6 +344,7 @@ void SFtp::Init()
size_write=0x8000;
use_full_path=false;
flush_timer.Set(0,500);
+ max_out_of_order=64;
}
SFtp::SFtp() : SSH_Access("SFTP:")
@@ -892,7 +893,7 @@ void SFtp::HandleExpect(Expect *e)
{
LogNote(9,"put a packet with id=%d on out-of-order chain (need_pos=%lld packet_pos=%lld)",
reply->GetID(),(long long)(pos+file_buf->Size()),(long long)r->pos);
- if(ooo_chain.count()>=64)
+ if(ooo_chain.count()>=max_out_of_order)
{
LogError(0,"Too many out-of-order packets");
Disconnect();
@@ -1192,7 +1193,10 @@ int SFtp::Read(Buffer *buf,int size)
{
// keep some packets in flight.
int limit=(entity_size>=0?max_packets_in_flight:max_packets_in_flight_slow_start);
- if(RespQueueSize()<limit && !file_buf->Eof())
+ int ooo_queue_available=max_out_of_order-ooo_chain.count();
+ int current_in_flight=RespQueueSize();
+ if(RespQueueSize()<limit && !file_buf->Eof()
+ && current_in_flight < ooo_queue_available)
{
// but don't request much after possible EOF.
if(entity_size<0 || request_pos<entity_size || RespQueueSize()<2)
diff --git a/src/SFtp.h b/src/SFtp.h
index 50888b376..2099440c6 100644
--- a/src/SFtp.h
+++ b/src/SFtp.h
@@ -755,6 +755,7 @@ enum sftp_status_t {
int size_read;
int size_write;
bool use_full_path;
+ int max_out_of_order;
protected:
void SetError(int code,const Packet *reply);

Binary file not shown.

BIN
lftp-4.9.2.tar.xz Normal file

Binary file not shown.

View File

@ -1,7 +1,7 @@
Summary: A sophisticated file transfer program
Name: lftp
Version: 4.9.1
Release: 1
Version: 4.9.2
Release: 6
License: GPLv3+
URL: http://lftp.yar.ru/
Source0: http://lftp.yar.ru/ftp/%{name}-%{version}.tar.xz
@ -9,7 +9,13 @@ BuildRequires: ncurses-devel, gnutls-devel, perl-generators, pkgconfig, gettext
BuildRequires: gettext readline-devel, zlib-devel, gcc-c++ desktop-file-utils
BuildRequires: chrpath
Patch1: lftp-4.0.9-date_fmt.patch
Patch0: lftp-4.0.9-date_fmt.patch
Patch1: Quit-while-source-file-increased.patch
Patch6000: backport-Ensure-that-PollVec-enum-matches-poll-values.patch
Patch6001: backport-fix-second-find_cmd-Segmentation-fault.patch
Patch6002: backport-fix-sftp-too-many-out-of-order-packets.patch
Patch6003: backport-fix-a-coredump-in-TorrentTracker-fix-513.patch
Patch6004: backport-fix-a-null-deref-on-exit.patch
%description
LFTP is a sophisticated file transfer program supporting a number of
@ -83,6 +89,37 @@ echo "%{_libdir}/lftp/%{version}" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arc
%changelog
* Fri Nov 22 2024 chengyechun <chengyechun1@huawei.com> - 4.9.2-6
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:sync some patches
* Mon Nov 11 2024 chengyechun <chengyechun1@huawei.com> - 4.9.2-4
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix sftp too many out of order packets
* Thu Sep 8 2022 chengyechun <chengyechun1@huawei.com> - 4.9.2-3
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix second find_cmd Segmentation fault
Ensure that PollVec enum matches poll values
* Thu Oct 28 2021 zhouyihang <zhouyihang3@huawei.com> - 4.9.2-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: quit while source file increased
* Fri Jan 29 2021 xihaochen <xihaochen@huawei.com> - 4.9.2-1
- Type:requirements
- Id:NA
- SUG:NA
- DESC:update lftp to 4.9.2
* Sat Jul 25 2020 gaihuiying <gaihuiying1@huawei.com> - 4.9.1-1
- Type:requirement
- ID:NA