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
4e10c985
Commit
4e10c985
authored
Apr 08, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internal: fix access for root user
parent
1abae81d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
internal/access.go
internal/access.go
+4
-0
internal/access_test.go
internal/access_test.go
+1
-0
No files found.
internal/access.go
View file @
4e10c985
...
...
@@ -12,6 +12,10 @@ import (
// HasAccess tests if a caller can access a file with permissions
// `perm` in mode `mask`
func
HasAccess
(
callerUid
,
callerGid
,
fileUid
,
fileGid
uint32
,
perm
uint32
,
mask
uint32
)
bool
{
if
callerUid
==
0
{
// root can do anything.
return
true
}
mask
=
mask
&
7
if
mask
==
0
{
return
true
...
...
internal/access_test.go
View file @
4e10c985
...
...
@@ -63,6 +63,7 @@ func TestHasAccess(t *testing.T) {
{
myUid
,
myGid
,
myUid
+
1
,
notMyGid
,
0020
,
002
,
false
},
{
myUid
,
myGid
,
myUid
,
myGid
,
0000
,
01
,
false
},
{
myUid
,
myGid
,
myUid
,
myGid
,
0200
,
01
,
false
},
{
0
,
myGid
,
myUid
+
1
,
notMyGid
,
0700
,
01
,
true
},
}
{
got
:=
HasAccess
(
tc
.
uid
,
tc
.
gid
,
tc
.
fuid
,
tc
.
fgid
,
tc
.
perm
,
tc
.
mask
)
if
got
!=
tc
.
want
{
...
...
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