fusefrontend: Preserve SUID/SGID/sticky-bits in openWriteOnlyFile and Rmdir.
Fixes https://github.com/rfjakob/gocryptfs/issues/336 and https://github.com/rfjakob/gocryptfs/issues/337.
This commit is contained in:
parent
efc280330c
commit
99e8b6d288
@ -192,7 +192,7 @@ func (fs *FS) openWriteOnlyFile(dirfd int, cName string, newFlags int) (*File, f
|
|||||||
return nil, fuse.ToStatus(err)
|
return nil, fuse.ToStatus(err)
|
||||||
}
|
}
|
||||||
// The cast to uint32 fixes a build failure on Darwin, where st.Mode is uint16.
|
// The cast to uint32 fixes a build failure on Darwin, where st.Mode is uint16.
|
||||||
perms := uint32(st.Mode & 0777)
|
perms := uint32(st.Mode)
|
||||||
// Verify that we don't have read permissions
|
// Verify that we don't have read permissions
|
||||||
if perms&0400 != 0 {
|
if perms&0400 != 0 {
|
||||||
tlog.Warn.Printf("openWriteOnlyFile: unexpected permissions %#o, returning EPERM", perms)
|
tlog.Warn.Printf("openWriteOnlyFile: unexpected permissions %#o, returning EPERM", perms)
|
||||||
|
@ -163,7 +163,7 @@ func (fs *FS) Rmdir(relPath string, context *fuse.Context) (code fuse.Status) {
|
|||||||
return fuse.ToStatus(err)
|
return fuse.ToStatus(err)
|
||||||
}
|
}
|
||||||
// This cast is needed on Darwin, where st.Mode is uint16.
|
// This cast is needed on Darwin, where st.Mode is uint16.
|
||||||
origMode := uint32(st.Mode & 0777)
|
origMode := uint32(st.Mode)
|
||||||
err = syscallcompat.Fchmodat(parentDirFd, cName, origMode|0700, unix.AT_SYMLINK_NOFOLLOW)
|
err = syscallcompat.Fchmodat(parentDirFd, cName, origMode|0700, unix.AT_SYMLINK_NOFOLLOW)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tlog.Debug.Printf("Rmdir: Fchmodat failed: %v", err)
|
tlog.Debug.Printf("Rmdir: Fchmodat failed: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user