Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
go-fuse
Commits
155877e9
Commit
155877e9
authored
Mar 22, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: move Access to DefaultOperations
parent
7059718c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
19 deletions
+17
-19
nodefs/default.go
nodefs/default.go
+17
-1
nodefs/loopback.go
nodefs/loopback.go
+0
-18
No files found.
nodefs/default.go
View file @
155877e9
...
...
@@ -10,6 +10,7 @@ import (
"unsafe"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/internal"
)
// DefaultOperations provides no-operation default implementations for
...
...
@@ -76,8 +77,23 @@ func (n *DefaultOperations) SetAttr(ctx context.Context, in *fuse.SetAttrIn, out
return
fuse
.
EROFS
}
// The Access default implementation checks traditional unix
// permissions of the GetAttr result agains the caller.
func
(
n
*
DefaultOperations
)
Access
(
ctx
context
.
Context
,
mask
uint32
)
fuse
.
Status
{
return
fuse
.
ENOENT
caller
,
ok
:=
fuse
.
FromContext
(
ctx
)
if
!
ok
{
return
fuse
.
EINVAL
}
var
out
fuse
.
AttrOut
if
s
:=
InodeOf
(
n
)
.
Operations
()
.
GetAttr
(
ctx
,
&
out
);
!
s
.
Ok
()
{
return
s
}
if
!
internal
.
HasAccess
(
caller
.
Uid
,
caller
.
Gid
,
out
.
Uid
,
out
.
Gid
,
out
.
Mode
,
mask
)
{
return
fuse
.
EACCES
}
return
fuse
.
OK
}
// FSetAttr delegates to the FileHandle's if f is not nil, or else to the
...
...
nodefs/loopback.go
View file @
155877e9
...
...
@@ -11,7 +11,6 @@ import (
"syscall"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/internal"
"golang.org/x/sys/unix"
)
...
...
@@ -296,20 +295,3 @@ func NewLoopbackRoot(root string) (DirOperations, error) {
n
.
rootNode
=
n
return
n
,
nil
}
func
(
n
*
loopbackNode
)
Access
(
ctx
context
.
Context
,
mask
uint32
)
fuse
.
Status
{
caller
,
ok
:=
fuse
.
FromContext
(
ctx
)
if
!
ok
{
return
fuse
.
EACCES
}
var
st
syscall
.
Stat_t
if
err
:=
syscall
.
Stat
(
n
.
path
(),
&
st
);
err
!=
nil
{
return
fuse
.
ToStatus
(
err
)
}
if
!
internal
.
HasAccess
(
caller
.
Uid
,
caller
.
Gid
,
st
.
Uid
,
st
.
Gid
,
uint32
(
st
.
Mode
),
mask
)
{
return
fuse
.
EACCES
}
return
fuse
.
OK
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment