summaryrefslogtreecommitdiff
path: root/internal/fusefrontend
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-01-17 00:23:09 +0100
committerJakob Unterwurzacher2018-01-17 00:25:36 +0100
commit8951eb2472d6af50554806df2ffd655f53da8bfe (patch)
tree8c1a28ba2f8401eafd2499af784839de809e5a1e /internal/fusefrontend
parent36ffd813cd04c6c43a7572ba5d71db4da8c2b060 (diff)
fusefronted: add PlaintextNames special-cases for Create & Rename
gocryptfs.longname.XXX files were considered magic in PlaintextNames mode, which was wrong. Fix that and add tests. Fixes https://github.com/rfjakob/gocryptfs/issues/174
Diffstat (limited to 'internal/fusefrontend')
-rw-r--r--internal/fusefrontend/fs.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go
index cabfdd2..8b0bb2e 100644
--- a/internal/fusefrontend/fs.go
+++ b/internal/fusefrontend/fs.go
@@ -195,7 +195,7 @@ func (fs *FS) Create(path string, flags uint32, mode uint32, context *fuse.Conte
cName := filepath.Base(cPath)
// Handle long file name
- if nametransform.IsLongContent(cName) {
+ if !fs.args.PlaintextNames && nametransform.IsLongContent(cName) {
var dirfd *os.File
dirfd, err = os.Open(filepath.Dir(cPath))
if err != nil {
@@ -466,7 +466,10 @@ func (fs *FS) Rename(oldPath string, newPath string, context *fuse.Context) (cod
// The Rename may cause a directory to take the place of another directory.
// That directory may still be in the DirIV cache, clear it.
fs.nameTransform.DirIVCache.Clear()
-
+ // Easy case.
+ if fs.args.PlaintextNames {
+ return fuse.ToStatus(syscall.Rename(cOldPath, cNewPath))
+ }
// Handle long source file name
var oldDirFd *os.File
var finalOldDirFd int