Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
d76daafc
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
接近 2 年 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
d76daafc
编写于
8月 20, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 20, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1102 清理非必要caps
Merge pull request !1102 from dapaodexiaoyu2/master
上级
4507570f
0507592d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
17 addition
and
10 deletion
+17
-10
services/param/adapter/param_selinux.c
services/param/adapter/param_selinux.c
+8
-6
services/param/include/param_security.h
services/param/include/param_security.h
+7
-3
services/param/linux/param_service.c
services/param/linux/param_service.c
+1
-0
test/unittest/param/param_stub.cpp
test/unittest/param/param_stub.cpp
+1
-1
未找到文件。
services/param/adapter/param_selinux.c
浏览文件 @
d76daafc
...
...
@@ -216,14 +216,15 @@ static int SelinuxCheckParamPermission(const ParamSecurityLabel *srcLabel, const
SelinuxSpace
*
selinuxSpace
=
&
GetParamWorkSpace
()
->
selinuxSpace
;
int
ret
=
DAC_RESULT_FORBIDED
;
// check
struct
ucred
uc
;
uc
.
pid
=
srcLabel
->
cred
.
pid
;
uc
.
uid
=
srcLabel
->
cred
.
uid
;
uc
.
gid
=
srcLabel
->
cred
.
gid
;
SrcInfo
info
;
info
.
uc
.
pid
=
srcLabel
->
cred
.
pid
;
info
.
uc
.
uid
=
srcLabel
->
cred
.
uid
;
info
.
uc
.
gid
=
srcLabel
->
cred
.
gid
;
info
.
sockFd
=
srcLabel
->
sockFd
;
if
(
mode
==
DAC_WRITE
)
{
PARAM_CHECK
(
selinuxSpace
->
setParamCheck
!=
NULL
,
return
ret
,
"Invalid setParamCheck"
);
const
char
*
context
=
GetSelinuxContent
(
name
);
ret
=
selinuxSpace
->
setParamCheck
(
name
,
context
,
&
uc
);
ret
=
selinuxSpace
->
setParamCheck
(
name
,
context
,
&
info
);
}
else
{
#ifndef STARTUP_INIT_TEST
ret
=
SelinuxReadParamCheck
(
name
);
...
...
@@ -232,7 +233,8 @@ static int SelinuxCheckParamPermission(const ParamSecurityLabel *srcLabel, const
#endif
}
if
(
ret
!=
0
)
{
PARAM_LOGW
(
"Selinux check name %s pid %d uid %d %d result %d"
,
name
,
uc
.
pid
,
uc
.
uid
,
uc
.
gid
,
ret
);
PARAM_LOGW
(
"Selinux check name %s pid %d uid %d %d result %d"
,
name
,
info
.
uc
.
pid
,
info
.
uc
.
uid
,
info
.
uc
.
gid
,
ret
);
ret
=
DAC_RESULT_FORBIDED
;
}
else
{
ret
=
DAC_RESULT_PERMISSION
;
...
...
services/param/include/param_security.h
浏览文件 @
d76daafc
...
...
@@ -25,6 +25,9 @@
#else
typedef
struct
ParamContextsList_
{
}
ParamContextsList
;
typedef
struct
SrcInfo
{
}
SrcInfo
;
#endif
#include "beget_ext.h"
...
...
@@ -66,6 +69,7 @@ typedef enum {
}
ParamSecurityType
;
typedef
struct
{
int32_t
sockFd
;
UserCred
cred
;
uint32_t
flags
[
PARAM_SECURITY_MAX
];
}
ParamSecurityLabel
;
...
...
@@ -96,11 +100,11 @@ typedef struct {
}
ParamSecurityOps
;
typedef
int
(
*
RegisterSecurityOpsPtr
)(
ParamSecurityOps
*
ops
,
int
isInit
);
typedef
int
(
*
SelinuxSetParamCheck
)(
const
char
*
paraName
,
const
char
*
destContext
,
struct
ucred
*
uc
);
typedef
int
(
*
SelinuxSetParamCheck
)(
const
char
*
paraName
,
const
char
*
destContext
,
const
SrcInfo
*
info
);
typedef
struct
SelinuxSpace_
{
void
*
selinuxHandle
;
void
(
*
setSelinuxLogCallback
)(
void
);
int
(
*
setParamCheck
)(
const
char
*
paraName
,
const
char
*
destContext
,
struct
ucred
*
uc
);
int
(
*
setParamCheck
)(
const
char
*
paraName
,
const
char
*
destContext
,
const
SrcInfo
*
info
);
const
char
*
(
*
getParamLabel
)(
const
char
*
paraName
);
int
(
*
initParamSelinux
)(
void
);
int
(
*
readParamCheck
)(
const
char
*
paraName
);
...
...
@@ -122,4 +126,4 @@ INIT_LOCAL_API int RegisterSecurityOps(int onlyRead);
}
#endif
#endif
#endif // BASE_STARTUP_PARAM_SECURITY_H
\ No newline at end of file
#endif // BASE_STARTUP_PARAM_SECURITY_H
services/param/linux/param_service.c
浏览文件 @
d76daafc
...
...
@@ -168,6 +168,7 @@ static int HandleParamSet(const ParamTaskPtr worker, const ParamMessage *msg)
PARAM_LOGE
(
"Failed to get opt %d"
,
errno
);
return
SendResponseMsg
(
worker
,
msg
,
-
1
);
}
srcLabel
.
sockFd
=
LE_GetSocketFd
(
worker
);
srcLabel
.
cred
.
uid
=
cr
.
uid
;
srcLabel
.
cred
.
pid
=
cr
.
pid
;
srcLabel
.
cred
.
gid
=
cr
.
gid
;
...
...
test/unittest/param/param_stub.cpp
浏览文件 @
d76daafc
...
...
@@ -61,7 +61,7 @@ static const char *forbitWriteParamName[] = {
"test.persmission.watch"
};
static
int
TestSetParamCheck
(
const
char
*
paraName
,
const
char
*
context
,
struct
ucred
*
uc
)
static
int
TestSetParamCheck
(
const
char
*
paraName
,
const
char
*
context
,
const
SrcInfo
*
info
)
{
// forbid to read ohos.servicectrl.
for
(
size_t
i
=
0
;
i
<
ARRAY_LENGTH
(
forbitWriteParamName
);
i
++
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录