fix file tranfser access control.

This commit is contained in:
Miroslav Šedivý 2022-11-19 23:05:34 +01:00
parent db87229f16
commit 04a0ce17de

View File

@ -8,6 +8,10 @@ import (
)
func (h *MessageHandler) FileTransferRefresh(session types.Session) error {
if !h.state.FileTransferEnabled() {
return nil
}
fileTransferPath := h.state.FileTransferPath("") // root
// allow users only if file transfer is not locked
@ -16,6 +20,7 @@ func (h *MessageHandler) FileTransferRefresh(session types.Session) error {
return nil
}
// TODO: keep list of files in memory and update it on file changes
files, err := utils.ListFiles(fileTransferPath)
if err != nil {
return err