summaryrefslogtreecommitdiff
path: root/internal/fusefrontend/fs.go
diff options
context:
space:
mode:
authorSebastian Lackner2019-01-09 02:40:10 +0100
committerSebastian Lackner2019-01-12 20:35:50 +0100
commit669322482a9be3d62abbe0361a8cc2e10e99fc3e (patch)
tree8aeb3307cbdcc5baa41c71b8b7293d68c0ec8d87 /internal/fusefrontend/fs.go
parentfcaca5fc94d981aa637beb752edc8cb3c2265e96 (diff)
fusefrontend: Don't chown gocryptfs.diriv files.
The current code has a risk of race-conditions, since we pass a path containing "/" to Fchownat. We could fix this by opening a file descriptor, however, this does not seem worth the effort. We also don't chown *.name files.
Diffstat (limited to 'internal/fusefrontend/fs.go')
-rw-r--r--internal/fusefrontend/fs.go16
1 files changed, 2 insertions, 14 deletions
diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go
index 7beeb4f..2cd4630 100644
--- a/internal/fusefrontend/fs.go
+++ b/internal/fusefrontend/fs.go
@@ -5,7 +5,6 @@ package fusefrontend
import (
"os"
- "path/filepath"
"sync"
"syscall"
"time"
@@ -326,19 +325,8 @@ func (fs *FS) Chown(path string, uid uint32, gid uint32, context *fuse.Context)
return fuse.ToStatus(err)
}
defer syscall.Close(dirfd)
- code = fuse.ToStatus(syscallcompat.Fchownat(dirfd, cName, int(uid), int(gid), unix.AT_SYMLINK_NOFOLLOW))
- if !code.Ok() {
- return code
- }
- if !fs.args.PlaintextNames {
- // When filename encryption is active, every directory contains
- // a "gocryptfs.diriv" file. This file should also change the owner.
- // Instead of checking if "cName" is a directory, we just blindly
- // execute the chown on "cName/gocryptfs.diriv" and ignore errors.
- dirIVPath := filepath.Join(cName, nametransform.DirIVFilename)
- syscallcompat.Fchownat(dirfd, dirIVPath, int(uid), int(gid), unix.AT_SYMLINK_NOFOLLOW)
- }
- return fuse.OK
+ err = syscallcompat.Fchownat(dirfd, cName, int(uid), int(gid), unix.AT_SYMLINK_NOFOLLOW)
+ return fuse.ToStatus(err)
}
// Mknod - FUSE call. Create a device file.