Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Juicedata
JuiceFS
提交
a101f145
JuiceFS
项目概览
Juicedata
/
JuiceFS
通知
10
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
JuiceFS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a101f145
编写于
8月 30, 2021
作者:
D
Davies Liu
提交者:
GitHub
8月 30, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
keep SGID when file is non-group-executable (#773)
上级
cd901081
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
12 deletion
+25
-12
pkg/meta/redis.go
pkg/meta/redis.go
+8
-3
pkg/meta/redis_test.go
pkg/meta/redis_test.go
+1
-3
pkg/meta/sql.go
pkg/meta/sql.go
+8
-3
pkg/meta/tkv.go
pkg/meta/tkv.go
+8
-3
未找到文件。
pkg/meta/redis.go
浏览文件 @
a101f145
...
...
@@ -1127,11 +1127,16 @@ func (r *redisMeta) SetAttr(ctx Context, inode Ino, set uint16, sugidclearmode u
}
var
changed
bool
if
(
cur
.
Mode
&
06000
)
!=
0
&&
(
set
&
(
SetAttrUID
|
SetAttrGID
))
!=
0
{
if
cur
.
Mode
&
01777
!=
cur
.
Mode
{
if
ctx
.
Uid
()
!=
0
||
(
cur
.
Mode
>>
3
)
&
1
!=
0
{
// clear SUID and SGID
cur
.
Mode
&=
01777
changed
=
true
attr
.
Mode
&=
01777
}
else
{
// keep SGID if the file is non-group-executable
cur
.
Mode
&=
03777
attr
.
Mode
&=
03777
}
attr
.
Mode
&=
01777
changed
=
true
}
if
set
&
SetAttrUID
!=
0
&&
cur
.
Uid
!=
attr
.
Uid
{
cur
.
Uid
=
attr
.
Uid
...
...
pkg/meta/redis_test.go
浏览文件 @
a101f145
...
...
@@ -122,13 +122,11 @@ func testMetaClient(t *testing.T, m Meta) {
}
// check owner permission
var
p1
,
c1
Ino
if
st
:=
m
.
Mkdir
(
ctx2
,
1
,
"d1"
,
027
77
,
022
,
0
,
&
p1
,
attr
);
st
!=
0
{
if
st
:=
m
.
Mkdir
(
ctx2
,
1
,
"d1"
,
027
66
,
022
,
0
,
&
p1
,
attr
);
st
!=
0
{
t
.
Fatalf
(
"mkdir d1: %s"
,
st
)
}
attr
.
Gid
=
1
m
.
SetAttr
(
ctx
,
p1
,
SetAttrGID
,
0
,
attr
)
attr
.
Mode
|=
02000
m
.
SetAttr
(
ctx
,
p1
,
SetAttrMode
,
0
,
attr
)
if
attr
.
Mode
&
02000
==
0
{
t
.
Fatalf
(
"SGID is lost"
)
}
...
...
pkg/meta/sql.go
浏览文件 @
a101f145
...
...
@@ -784,11 +784,16 @@ func (m *dbMeta) SetAttr(ctx Context, inode Ino, set uint16, sugidclearmode uint
}
var
changed
bool
if
(
cur
.
Mode
&
06000
)
!=
0
&&
(
set
&
(
SetAttrUID
|
SetAttrGID
))
!=
0
{
if
cur
.
Mode
&
01777
!=
cur
.
Mode
{
if
ctx
.
Uid
()
!=
0
||
(
cur
.
Mode
>>
3
)
&
1
!=
0
{
// clear SUID and SGID
cur
.
Mode
&=
01777
changed
=
true
attr
.
Mode
&=
01777
}
else
{
// keep SGID if the file is non-group-executable
cur
.
Mode
&=
03777
attr
.
Mode
&=
03777
}
attr
.
Mode
&=
01777
changed
=
true
}
if
set
&
SetAttrUID
!=
0
&&
cur
.
Uid
!=
attr
.
Uid
{
cur
.
Uid
=
attr
.
Uid
...
...
pkg/meta/tkv.go
浏览文件 @
a101f145
...
...
@@ -979,11 +979,16 @@ func (m *kvMeta) SetAttr(ctx Context, inode Ino, set uint16, sugidclearmode uint
}
var
changed
bool
if
(
cur
.
Mode
&
06000
)
!=
0
&&
(
set
&
(
SetAttrUID
|
SetAttrGID
))
!=
0
{
if
cur
.
Mode
&
01777
!=
cur
.
Mode
{
if
ctx
.
Uid
()
!=
0
||
(
cur
.
Mode
>>
3
)
&
1
!=
0
{
// clear SUID and SGID
cur
.
Mode
&=
01777
changed
=
true
attr
.
Mode
&=
01777
}
else
{
// keep SGID if the file is non-group-executable
cur
.
Mode
&=
03777
attr
.
Mode
&=
03777
}
attr
.
Mode
&=
01777
changed
=
true
}
if
set
&
SetAttrUID
!=
0
&&
cur
.
Uid
!=
attr
.
Uid
{
cur
.
Uid
=
attr
.
Uid
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录