diff options
Diffstat (limited to 'internal/fusefrontend_reverse')
-rw-r--r-- | internal/fusefrontend_reverse/reverse_longnames.go | 10 | ||||
-rw-r--r-- | internal/fusefrontend_reverse/rfs.go | 7 |
2 files changed, 14 insertions, 3 deletions
diff --git a/internal/fusefrontend_reverse/reverse_longnames.go b/internal/fusefrontend_reverse/reverse_longnames.go index f826d1b..a425e64 100644 --- a/internal/fusefrontend_reverse/reverse_longnames.go +++ b/internal/fusefrontend_reverse/reverse_longnames.go @@ -63,9 +63,15 @@ func (rfs *ReverseFS) findLongnameParent(dir string, dirIV []byte, longname stri if hit != "" { return hit, nil } - fd, err := syscallcompat.OpenDirNofollow(rfs.args.Cipherdir, dir) + dirfd, err := syscallcompat.OpenDirNofollow(rfs.args.Cipherdir, filepath.Dir(dir)) if err != nil { - tlog.Warn.Printf("findLongnameParent: opendir failed: %v\n", err) + tlog.Warn.Printf("findLongnameParent: OpenDirNofollow failed: %v\n", err) + return "", err + } + fd, err := syscallcompat.Openat(dirfd, filepath.Base(dir), syscall.O_RDONLY|syscall.O_DIRECTORY|syscall.O_NOFOLLOW, 0) + syscall.Close(dirfd) + if err != nil { + tlog.Warn.Printf("findLongnameParent: Openat failed: %v\n", err) return "", err } dirEntries, err := syscallcompat.Getdents(fd) diff --git a/internal/fusefrontend_reverse/rfs.go b/internal/fusefrontend_reverse/rfs.go index 4f94f3c..9ef6a94 100644 --- a/internal/fusefrontend_reverse/rfs.go +++ b/internal/fusefrontend_reverse/rfs.go @@ -305,7 +305,12 @@ func (rfs *ReverseFS) OpenDir(cipherPath string, context *fuse.Context) ([]fuse. return nil, fuse.ToStatus(err) } // Read plaintext dir - fd, err := syscallcompat.OpenDirNofollow(rfs.args.Cipherdir, relPath) + dirfd, err := syscallcompat.OpenDirNofollow(rfs.args.Cipherdir, filepath.Dir(relPath)) + if err != nil { + return nil, fuse.ToStatus(err) + } + fd, err := syscallcompat.Openat(dirfd, filepath.Base(relPath), syscall.O_RDONLY|syscall.O_DIRECTORY|syscall.O_NOFOLLOW, 0) + syscall.Close(dirfd) if err != nil { return nil, fuse.ToStatus(err) } |