From 99e8b6d288b1551947faec669b6af65331441471 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 12 Jan 2019 21:24:48 +0100 Subject: 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. --- internal/fusefrontend/fs_dir.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'internal/fusefrontend/fs_dir.go') diff --git a/internal/fusefrontend/fs_dir.go b/internal/fusefrontend/fs_dir.go index 880f271..a017050 100644 --- a/internal/fusefrontend/fs_dir.go +++ b/internal/fusefrontend/fs_dir.go @@ -163,7 +163,7 @@ func (fs *FS) Rmdir(relPath string, context *fuse.Context) (code fuse.Status) { return fuse.ToStatus(err) } // 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) if err != nil { tlog.Debug.Printf("Rmdir: Fchmodat failed: %v", err) -- cgit v1.2.3