summaryrefslogtreecommitdiff
path: root/internal/fusefrontend
diff options
context:
space:
mode:
Diffstat (limited to 'internal/fusefrontend')
-rw-r--r--internal/fusefrontend/args.go7
-rw-r--r--internal/fusefrontend/fs.go3
2 files changed, 10 insertions, 0 deletions
diff --git a/internal/fusefrontend/args.go b/internal/fusefrontend/args.go
index 5781db8..37f4463 100644
--- a/internal/fusefrontend/args.go
+++ b/internal/fusefrontend/args.go
@@ -1,6 +1,7 @@
package fusefrontend
import (
+ "github.com/hanwen/go-fuse/fuse"
"github.com/rfjakob/gocryptfs/internal/cryptocore"
)
@@ -16,6 +17,12 @@ type Args struct {
// Should we chown a file after it has been created?
// This only makes sense if (1) allow_other is set and (2) we run as root.
PreserveOwner bool
+ // Should we force ownership to be presented with a given user and group?
+ // This only makes sense if allow_other is set. In *most* cases, it also
+ // only makes sense with PreserveOwner set, but can also make sense without
+ // PreserveOwner if the underlying filesystem acting as backing store
+ // enforces ownership itself.
+ ForceOwner *fuse.Owner
// ConfigCustom is true when the user select a non-default config file
// location. If it is false, reverse mode maps ".gocryptfs.reverse.conf"
// to "gocryptfs.conf" in the plaintext dir.
diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go
index c589302..16707d6 100644
--- a/internal/fusefrontend/fs.go
+++ b/internal/fusefrontend/fs.go
@@ -77,6 +77,9 @@ func (fs *FS) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Stat
target, _ := fs.Readlink(name, context)
a.Size = uint64(len(target))
}
+ if fs.args.ForceOwner != nil {
+ a.Owner = *fs.args.ForceOwner
+ }
return a, status
}