add Data At Rest Encryption support

This commit is contained in:
Nicola Murino
2020-12-05 13:48:13 +01:00
parent 95c6d41c35
commit 4a88ea5c03
38 changed files with 1754 additions and 139 deletions

View File

@@ -365,7 +365,11 @@ func (c *Connection) handleFTPUploadToExistingFile(flags int, resolvedPath, file
return nil, common.ErrQuotaExceeded
}
minWriteOffset := int64(0)
isResume := flags&os.O_APPEND != 0 && flags&os.O_TRUNC == 0
// ftpserverlib set os.O_WRONLY | os.O_APPEND for APPE
// and os.O_WRONLY | os.O_CREATE for REST. If is not APPE
// and REST = 0 then os.O_WRONLY | os.O_CREATE | os.O_TRUNC
// so if we don't have O_TRUC is a resume
isResume := flags&os.O_TRUNC == 0
// if there is a size limit remaining size cannot be 0 here, since quotaResult.HasSpace
// will return false in this case and we deny the upload before
maxWriteSize, err := c.GetMaxWriteSize(quotaResult, isResume, fileSize)