summaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse/node_dir_ops.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-08-20 17:06:18 +0200
committerJakob Unterwurzacher2021-08-20 17:06:18 +0200
commitfbccb160438aba6f1e16b26a982122c726afee1a (patch)
tree1faac5ad3587a302fff40a8354382cda21823f3a /internal/fusefrontend_reverse/node_dir_ops.go
parent14bf80301b4f3f1fb56f2f0b73de0dcc4aab5216 (diff)
-deterministic-names: implement for reverse mode, too
Diffstat (limited to 'internal/fusefrontend_reverse/node_dir_ops.go')
-rw-r--r--internal/fusefrontend_reverse/node_dir_ops.go19
1 files changed, 7 insertions, 12 deletions
diff --git a/internal/fusefrontend_reverse/node_dir_ops.go b/internal/fusefrontend_reverse/node_dir_ops.go
index 21b9775..2592ebc 100644
--- a/internal/fusefrontend_reverse/node_dir_ops.go
+++ b/internal/fusefrontend_reverse/node_dir_ops.go
@@ -13,7 +13,6 @@ import (
"github.com/rfjakob/gocryptfs/internal/configfile"
"github.com/rfjakob/gocryptfs/internal/cryptocore"
"github.com/rfjakob/gocryptfs/internal/nametransform"
- "github.com/rfjakob/gocryptfs/internal/pathiv"
"github.com/rfjakob/gocryptfs/internal/syscallcompat"
"github.com/rfjakob/gocryptfs/internal/tlog"
)
@@ -23,20 +22,16 @@ import (
// This function is symlink-safe through use of openBackingDir() and
// ReadDirIVAt().
func (n *Node) Readdir(ctx context.Context) (stream fs.DirStream, errno syscall.Errno) {
- // Virtual files: at least one gocryptfs.diriv file
- virtualFiles := []fuse.DirEntry{
- {Mode: virtualFileMode, Name: nametransform.DirIVFilename},
- }
rn := n.rootNode()
+ // Should we present a virtual gocryptfs.diriv?
+ var virtualFiles []fuse.DirEntry
+ if !rn.args.PlaintextNames && !rn.args.DeterministicNames {
+ virtualFiles = append(virtualFiles, fuse.DirEntry{Mode: virtualFileMode, Name: nametransform.DirIVFilename})
+ }
// This directory is a mountpoint. Present it as empty.
if rn.args.OneFileSystem && n.isOtherFilesystem {
- if rn.args.PlaintextNames {
- return fs.NewListDirStream(nil), 0
- } else {
- // An "empty" directory still has a gocryptfs.diriv file!
- return fs.NewListDirStream(virtualFiles), 0
- }
+ return fs.NewListDirStream(virtualFiles), 0
}
d, errno := n.prepareAtSyscall("")
@@ -64,7 +59,7 @@ func (n *Node) Readdir(ctx context.Context) (stream fs.DirStream, errno syscall.
return n.readdirPlaintextnames(entries)
}
- dirIV := pathiv.Derive(d.cPath, pathiv.PurposeDirIV)
+ dirIV := rn.deriveDirIV(d.cPath)
// Encrypt names
for i := range entries {
var cName string