1
0
mirror of https://github.com/drakkan/sftpgo.git synced 2025-11-29 22:08:10 +02:00

add a new permission for overwriting existing files

The upload permission is required to allow file overwrite
This commit is contained in:
Nicola Murino
2019-09-17 08:53:45 +02:00
parent 580fae7a8f
commit df96ea7e9f
9 changed files with 110 additions and 13 deletions

View File

@@ -131,6 +131,10 @@ func (c Connection) Filewrite(request *sftp.Request) (io.WriterAt, error) {
return nil, sftp.ErrSshFxOpUnsupported
}
if !c.User.HasPerm(dataprovider.PermOverwrite) {
return nil, sftp.ErrSshFxPermissionDenied
}
return c.handleSFTPUploadToExistingFile(request.Pflags(), p, filePath, stat.Size())
}