From 75105681ca3886251f0f5e8edb5725280f765007 Mon Sep 17 00:00:00 2001 From: Xiao Tan <16686956+bh1xaq@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:27:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20pure-ftpd=20?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=BC=93=E6=85=A2=E9=97=AE=E9=A2=98=20(#6994?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复 pure-ftpd 上传缓慢问题 * fix: 修复 pure-ftpd 修改密码用户名的判断依据 --------- Co-authored-by: BH1XAQ --- backend/utils/toolbox/pure-ftpd.go | 139 +++++++++++++++++++++++++---- 1 file changed, 122 insertions(+), 17 deletions(-) diff --git a/backend/utils/toolbox/pure-ftpd.go b/backend/utils/toolbox/pure-ftpd.go index 8538ea599a41b..68eb72ac807f2 100644 --- a/backend/utils/toolbox/pure-ftpd.go +++ b/backend/utils/toolbox/pure-ftpd.go @@ -1,8 +1,10 @@ package toolbox import ( + "bufio" "errors" "fmt" + "golang.org/x/crypto/bcrypt" "os" "os/user" "path" @@ -21,6 +23,21 @@ type Ftp struct { DefaultGroup string } +type FtpList struct { + User string + Path string + Status string +} + +type FtpLog struct { + IP string `json:"ip"` + User string `json:"user"` + Time string `json:"time"` + Operation string `json:"operation"` + Status string `json:"status"` + Size string `json:"size"` +} + type FtpClient interface { Status() (bool, bool) Operate(operate string) error @@ -88,9 +105,19 @@ func (f *Ftp) Operate(operate string) error { } func (f *Ftp) UserAdd(username, passwd, path string) error { - std, err := cmd.Execf("pure-pw useradd %s -u %s -d %s <