Skip to content

Commit

Permalink
fusefrontend: drop xattr user namespace restriction
Browse files Browse the repository at this point in the history
We used to restrict setting xattrs to the "user."
namespace. I don't see a real reason for this
anymore, and it causes trouble for users who are using
acls.

Tests will be added in the next commit.

#453
  • Loading branch information
rfjakob committed Feb 29, 2020
1 parent 9ec042f commit ca9e912
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 39 deletions.
12 changes: 0 additions & 12 deletions internal/fusefrontend/xattr.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ func (fs *FS) GetXAttr(relPath string, attr string, context *fuse.Context) ([]by
if fs.isFiltered(relPath) {
return nil, fuse.EPERM
}
if disallowedXAttrName(attr) {
return nil, _EOPNOTSUPP
}

cAttr := fs.encryptXattrName(attr)

cData, status := fs.getXAttr(relPath, cAttr, context)
Expand All @@ -53,10 +49,6 @@ func (fs *FS) SetXAttr(relPath string, attr string, data []byte, flags int, cont
if fs.isFiltered(relPath) {
return fuse.EPERM
}
if disallowedXAttrName(attr) {
return _EOPNOTSUPP
}

flags = filterXattrSetFlags(flags)
cAttr := fs.encryptXattrName(attr)
cData := fs.encryptXattrValue(data)
Expand All @@ -70,10 +62,6 @@ func (fs *FS) RemoveXAttr(relPath string, attr string, context *fuse.Context) fu
if fs.isFiltered(relPath) {
return fuse.EPERM
}
if disallowedXAttrName(attr) {
return _EOPNOTSUPP
}

cAttr := fs.encryptXattrName(attr)
return fs.removeXAttr(relPath, cAttr, context)
}
Expand Down
4 changes: 0 additions & 4 deletions internal/fusefrontend/xattr_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ import (
"github.com/rfjakob/gocryptfs/internal/syscallcompat"
)

func disallowedXAttrName(attr string) bool {
return false
}

// On Darwin it is needed to unset XATTR_NOSECURITY 0x0008
func filterXattrSetFlags(flags int) int {
// See https://opensource.apple.com/source/xnu/xnu-1504.15.3/bsd/sys/xattr.h.auto.html
Expand Down
10 changes: 0 additions & 10 deletions internal/fusefrontend/xattr_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package fusefrontend

import (
"fmt"
"strings"
"syscall"

"golang.org/x/sys/unix"
Expand All @@ -15,15 +14,6 @@ import (
"github.com/rfjakob/gocryptfs/internal/syscallcompat"
)

// Only allow the "user" namespace, block "trusted" and "security", as
// these may be interpreted by the system, and we don't want to cause
// trouble with our encrypted garbage.
const xattrUserPrefix = "user."

func disallowedXAttrName(attr string) bool {
return !strings.HasPrefix(attr, xattrUserPrefix)
}

func filterXattrSetFlags(flags int) int {
return flags
}
Expand Down
13 changes: 0 additions & 13 deletions internal/fusefrontend/xattr_linux_unit_test.go

This file was deleted.

0 comments on commit ca9e912

Please sign in to comment.