Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
e4ec3363
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
1 年多 前同步成功
通知
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看板
提交
e4ec3363
编写于
3月 28, 2022
作者:
X
xionglei6
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:fix param bug
Signed-off-by:
N
xionglei6
<
xionglei6@huawei.com
>
上级
3135a696
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
7 deletion
+10
-7
services/begetctl/param_cmd.c
services/begetctl/param_cmd.c
+5
-4
services/etc/group
services/etc/group
+1
-0
services/param/adapter/param_dac.c
services/param/adapter/param_dac.c
+3
-3
services/param/manager/param_manager.c
services/param/manager/param_manager.c
+1
-0
未找到文件。
services/begetctl/param_cmd.c
浏览文件 @
e4ec3363
...
...
@@ -91,6 +91,7 @@ static char *GetRealParameter(BShellHandle shell, const char *name, char *buffer
}
else
{
realLen
=
sprintf_s
(
buffer
,
buffSize
,
"%s"
,
name
);
}
BSH_CHECK
(
realLen
>=
0
,
return
NULL
,
"Failed to format buffer"
);
buffer
[
realLen
]
=
'\0'
;
BSH_LOGV
(
"GetRealParameter current %s input %s real %s"
,
current
,
name
,
buffer
);
return
buffer
;
...
...
@@ -158,7 +159,7 @@ static void ShowParam(BShellHandle shell, const char *name, const char *value)
BSH_LOGE
(
"Failed to get param security for %s"
,
name
);
return
;
}
char
permissionStr
[
MASK_LENGTH_MAX
]
=
{
'-'
,
'-'
,
'-'
,
0
};
char
permissionStr
[
3
][
MASK_LENGTH_MAX
]
=
{};
// 3 permission
struct
passwd
*
user
=
getpwuid
(
auditData
.
dacData
.
uid
);
struct
group
*
group
=
getgrgid
(
auditData
.
dacData
.
gid
);
if
(
user
==
NULL
||
group
==
NULL
)
{
...
...
@@ -167,9 +168,9 @@ static void ShowParam(BShellHandle shell, const char *name, const char *value)
}
BShellEnvOutput
(
shell
,
"Parameter infomation:
\r\n
"
);
BShellEnvOutput
(
shell
,
" dac : %s(%s) %s(%s) (%s)
\r\n
"
,
user
->
pw_name
,
GetPermissionString
(
auditData
.
dacData
.
mode
,
0
,
permissionStr
,
MASK_LENGTH_MAX
),
group
->
gr_name
,
GetPermissionString
(
auditData
.
dacData
.
mode
,
DAC_GROUP_START
,
permissionStr
,
MASK_LENGTH_MAX
),
GetPermissionString
(
auditData
.
dacData
.
mode
,
DAC_OTHER_START
,
permissionStr
,
MASK_LENGTH_MAX
));
user
->
pw_name
,
GetPermissionString
(
auditData
.
dacData
.
mode
,
0
,
permissionStr
[
0
]
,
MASK_LENGTH_MAX
),
group
->
gr_name
,
GetPermissionString
(
auditData
.
dacData
.
mode
,
DAC_GROUP_START
,
permissionStr
[
1
]
,
MASK_LENGTH_MAX
),
GetPermissionString
(
auditData
.
dacData
.
mode
,
DAC_OTHER_START
,
permissionStr
[
2
],
MASK_LENGTH_MAX
));
// 2 other
BShellEnvOutput
(
shell
,
" name : %s
\r\n
"
,
name
);
if
(
value
!=
NULL
)
{
BShellEnvOutput
(
shell
,
" value: %s
\r\n
"
,
value
);
...
...
services/etc/group
浏览文件 @
e4ec3363
...
...
@@ -23,6 +23,7 @@ logd:x:1036:
shared_relro:x:1037:
audioserver:x:1041:
cameraserver:x:1047:
servicectrl:x:1050:root,shell,system,samgr,hdf_devmgr
shell:x:2000:
cache:x:2001:
net_bw_stats:x:3006:
...
...
services/param/adapter/param_dac.c
浏览文件 @
e4ec3363
...
...
@@ -253,10 +253,10 @@ static int CheckParamPermission(const ParamSecurityLabel *srcLabel, const ParamA
if
((
auditData
->
dacData
.
mode
&
localMode
)
!=
0
)
{
ret
=
DAC_RESULT_PERMISSION
;
}
PARAM_LOG
V
(
"Src label gid:%d uid:%d "
,
srcLabel
->
cred
.
gid
,
srcLabel
->
cred
.
uid
);
PARAM_LOG
V
(
"local label gid:%d uid:%d mode %o"
,
PARAM_LOG
I
(
"Src label gid:%d uid:%d "
,
srcLabel
->
cred
.
gid
,
srcLabel
->
cred
.
uid
);
PARAM_LOG
I
(
"local label gid:%d uid:%d mode %o"
,
auditData
->
dacData
.
gid
,
auditData
->
dacData
.
uid
,
auditData
->
dacData
.
mode
);
PARAM_LOG
V
(
"%s check %o localMode %o ret %d"
,
auditData
->
name
,
mode
,
localMode
,
ret
);
PARAM_LOG
I
(
"%s check %o localMode %o ret %d"
,
auditData
->
name
,
mode
,
localMode
,
ret
);
return
ret
;
#endif
}
...
...
services/param/manager/param_manager.c
浏览文件 @
e4ec3363
...
...
@@ -304,6 +304,7 @@ int CheckParamPermission(const ParamWorkSpace *workSpace,
if
(
mode
==
DAC_WRITE
)
{
int
ret
=
CheckParamPermissionWithSelinux
(
srcLabel
,
name
,
mode
);
if
(
ret
==
DAC_RESULT_PERMISSION
)
{
PARAM_LOGI
(
"CheckParamPermission %s"
,
name
);
return
DAC_RESULT_PERMISSION
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录