summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorM. Vefa Bicakci2017-03-07 12:09:09 +0300
committerJakob Unterwurzacher2017-03-07 20:46:58 +0100
commitd48ccb3ddab71773a991b8f1b062901ff5b435b0 (patch)
tree54aab9db59a7d7cc43ca2e1199d6f9aa1ff388c4 /internal
parent6e9b6e17c33b4471c30248c11b292468fe4ab912 (diff)
Report correct symbolic link dentry sizes
Prior to this commit, gocryptfs's reverse mode did not report correct directory entry sizes for symbolic links, where the dentry size needs to be the same as the length of a string containing the target path. This commit corrects this issue and adds a test case to verify the correctness of the implementation. This issue was discovered during the use of a strict file copying program on a reverse-mounted gocryptfs file system.
Diffstat (limited to 'internal')
-rw-r--r--internal/fusefrontend_reverse/rfs.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/fusefrontend_reverse/rfs.go b/internal/fusefrontend_reverse/rfs.go
index f9a2979..a3a3d3b 100644
--- a/internal/fusefrontend_reverse/rfs.go
+++ b/internal/fusefrontend_reverse/rfs.go
@@ -221,6 +221,16 @@ func (rfs *ReverseFS) GetAttr(relPath string, context *fuse.Context) (*fuse.Attr
// Calculate encrypted file size
if a.IsRegular() {
a.Size = rfs.contentEnc.PlainSizeToCipherSize(a.Size)
+ } else if a.IsSymlink() {
+ var linkTarget string
+ var readlinkStatus fuse.Status
+
+ linkTarget, readlinkStatus = rfs.Readlink(relPath, context)
+ if !readlinkStatus.Ok() {
+ return nil, readlinkStatus
+ }
+
+ a.Size = uint64(len(linkTarget))
}
return a, fuse.OK
}