aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse
diff options
context:
space:
mode:
authorVal2022-03-31 14:41:36 -0400
committerrfjakob2022-04-02 15:15:04 +0200
commitc9e4e4f74150d2734496e90a4c442a17b79f52c1 (patch)
treee73067b4816a4b1d0af9ab60f6fe494c60b626f6 /internal/fusefrontend_reverse
parentad2904f9ed84225150c45037c00ca5e6b767e63f (diff)
Fix reverse gocryptfs.conf access on macOS
Unlike the FUSE implementation on Linux, macFUSE doesn't cache the file attributes from the `LOOKUP` call, so it calls `GETATTR` prior to accessing a file. In the case of the `VirtualConfNode` (reverse config file passthrough), this resulted in the default `GETATTR` implementation returning an empty result, ultimately resulting in a "permission denied" error. 14:44:14.095207 rx 3: GETATTR n2 14:44:14.095229 tx 3: OK, {tA=1s {M0100000 SZ=0 L=0 0:0 0 0:8954996 A 0.000000 M 0.000000 C 0.000000}} 14:44:14.099943 rx 4: ACCESS n2 {u=501 g=20 r} 14:44:14.099990 tx 4: 13=permission denied By impementing `Getattr` (from `fs.NodeGetattrer`) on `VirtualConfNode` this solves the issue.
Diffstat (limited to 'internal/fusefrontend_reverse')
-rw-r--r--internal/fusefrontend_reverse/virtualconf.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/fusefrontend_reverse/virtualconf.go b/internal/fusefrontend_reverse/virtualconf.go
index 8620f6d..e8cc080 100644
--- a/internal/fusefrontend_reverse/virtualconf.go
+++ b/internal/fusefrontend_reverse/virtualconf.go
@@ -10,6 +10,7 @@ import (
)
var _ = (fs.NodeOpener)((*VirtualConfNode)(nil))
+var _ = (fs.NodeGetattrer)((*VirtualConfNode)(nil))
type VirtualConfNode struct {
fs.Inode
@@ -27,6 +28,17 @@ func (n *VirtualConfNode) Open(ctx context.Context, flags uint32) (fh fs.FileHan
return
}
+func (n *VirtualConfNode) Getattr(ctx context.Context, fh fs.FileHandle, out *fuse.AttrOut) syscall.Errno {
+ var st syscall.Stat_t
+ err := syscall.Stat(n.path, &st)
+ if err != nil {
+ return fs.ToErrno(err)
+ }
+ out.FromStat(&st)
+ return 0
+}
+
+
// Check that we have implemented the fs.File* interfaces
var _ = (fs.FileReader)((*VirtualConfFile)(nil))
var _ = (fs.FileReleaser)((*VirtualConfFile)(nil))