From 8951eb2472d6af50554806df2ffd655f53da8bfe Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 17 Jan 2018 00:23:09 +0100 Subject: 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 --- internal/fusefrontend/fs.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'internal/fusefrontend') 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 -- cgit v1.2.3