fix connection limits

an SFTP client can start multiple transfers on a single connection

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2024-10-26 21:18:19 +02:00
parent c69fbe6bf9
commit ae1487d733
24 changed files with 707 additions and 7 deletions

View File

@@ -380,6 +380,12 @@ func (s *httpdServer) uploadFilesToShare(w http.ResponseWriter, r *http.Request)
if err != nil {
return
}
if err := common.Connections.IsNewTransferAllowed(connection.User.Username); err != nil {
connection.Log(logger.LevelInfo, "denying file write due to number of transfer limits")
sendAPIResponse(w, r, err, "Denying file write due to transfer count limits",
http.StatusConflict)
return
}
transferQuota := connection.GetTransferQuota()
if !transferQuota.HasUploadSpace() {