summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-01-04 17:59:00 +0100
committerJakob Unterwurzacher2019-01-04 17:59:00 +0100
commit6b94f5ef51c92f471919e7542a0ce45b0859282f (patch)
tree27194949d730d4eb7c7067408eb617f1ef9f96af /internal
parent58f62ada465c4ecbdb9a62a08968bebe37f02b7d (diff)
reverse mode: -exclude: filter out excluded .name files
Fixes https://github.com/rfjakob/gocryptfs/issues/286 : While the actual file is properly excluded, the * .name file is still leaked in the directory listing: ``` drwxr-xr-x 2 sebastian sebastian 4,0K Dez 17 14:58 . drwxr-xr-x 7 sebastian sebastian 4,0K Dez 17 14:45 .. -r-------- 1 sebastian sebastian 408 Dez 17 14:56 gocryptfs.conf -r--r--r-- 1 sebastian sebastian 16 Dez 17 14:58 gocryptfs.diriv -r--r--r-- 1 sebastian sebastian 320 Dez 17 14:58 gocryptfs.longname.3vZ_r3eDPb1_fL3j5VA4rd_bcKWLKT9eaxOVIGK5HFA.name ```
Diffstat (limited to 'internal')
-rw-r--r--internal/fusefrontend_reverse/rfs.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/internal/fusefrontend_reverse/rfs.go b/internal/fusefrontend_reverse/rfs.go
index 50d995c..69cedb1 100644
--- a/internal/fusefrontend_reverse/rfs.go
+++ b/internal/fusefrontend_reverse/rfs.go
@@ -74,6 +74,15 @@ func NewFS(args fusefrontend.Args, c *contentenc.ContentEnc, n *nametransform.Na
os.Exit(exitcodes.ExcludeError)
}
fs.cExclude = append(fs.cExclude, cPath)
+ if !fs.args.PlaintextNames {
+ // If we exclude
+ // gocryptfs.longname.3vZ_r3eDPb1_fL3j5VA4rd_bcKWLKT9eaxOVIGK5HFA
+ // we should also exclude
+ // gocryptfs.longname.3vZ_r3eDPb1_fL3j5VA4rd_bcKWLKT9eaxOVIGK5HFA.name
+ if nametransform.IsLongContent(filepath.Base(cPath)) {
+ fs.cExclude = append(fs.cExclude, cPath+nametransform.LongNameSuffix)
+ }
+ }
}
tlog.Debug.Printf("-exclude: %v -> %v", fs.args.Exclude, fs.cExclude)
}
@@ -361,10 +370,10 @@ func (rfs *ReverseFS) OpenDir(cipherPath string, context *fuse.Context) ([]fuse.
}
entries[i].Name = cName
}
- // Filter out excluded entries
- entries = rfs.excludeDirEntries(cipherPath, entries)
// Add virtual files
entries = append(entries, virtualFiles[:nVirtual]...)
+ // Filter out excluded entries
+ entries = rfs.excludeDirEntries(cipherPath, entries)
return entries, fuse.OK
}