mirror of
https://gitee.com/openharmony/startup_init
synced 2024-12-03 16:34:03 +00:00
fix: def mode
Signed-off-by: Mupceet <laiguizhong@huawei.com>
This commit is contained in:
parent
b675c17ff0
commit
03e1b9c8f9
@ -53,6 +53,8 @@ extern "C" {
|
||||
#endif
|
||||
#define PARAM_WORKSPACE_SMALL PARAM_WORKSPACE_MAX
|
||||
#define PARAM_WORKSPACE_DEF PARAM_WORKSPACE_MAX
|
||||
#define DAC_DEFAULT_GROUP 0
|
||||
#define DAC_DEFAULT_USER 0
|
||||
#else
|
||||
#define PARAM_WORKSPACE_MAX (80 * 1024)
|
||||
#define PARAM_WORKSPACE_SMALL (1024 * 10)
|
||||
@ -63,6 +65,8 @@ extern "C" {
|
||||
#define DAC_DEFAULT_MODE 0774
|
||||
#define PARAM_WORKSPACE_DEF (1024 * 30)
|
||||
#endif
|
||||
#define DAC_DEFAULT_GROUP 2000
|
||||
#define DAC_DEFAULT_USER 0
|
||||
#endif
|
||||
|
||||
// support futex
|
||||
|
@ -155,8 +155,8 @@ int InitParamWorkSpace(int onlyRead)
|
||||
// add default dac policy
|
||||
ParamAuditData auditData = {};
|
||||
auditData.name = "#";
|
||||
auditData.dacData.gid = 2000; // 2000 for shell
|
||||
auditData.dacData.uid = 0; // for root
|
||||
auditData.dacData.gid = DAC_DEFAULT_GROUP; // 2000 for shell
|
||||
auditData.dacData.uid = DAC_DEFAULT_USER; // for root
|
||||
auditData.dacData.mode = DAC_DEFAULT_MODE; // 0774 default mode
|
||||
ret = AddSecurityLabel(&auditData);
|
||||
PARAM_CHECK(ret == 0, return ret, "Failed to add default dac label");
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
const char *value = "2001";
|
||||
uint32_t labelIndex = 0;
|
||||
SystemWriteParam(name, value);
|
||||
// 获取到跟属性
|
||||
// get root
|
||||
WorkSpace *workspace = GetWorkSpace(WORKSPACE_NAME_DAC);
|
||||
(void)FindTrieNode(workspace, name, strlen(name), &labelIndex);
|
||||
ParamSecruityNode *node = (ParamSecruityNode *)GetTrieNode(workspace, labelIndex);
|
||||
@ -86,7 +86,7 @@ public:
|
||||
EXPECT_EQ(1, 0);
|
||||
return 0;
|
||||
}
|
||||
EXPECT_EQ(node->gid, 0);
|
||||
EXPECT_EQ(node->gid, DAC_DEFAULT_GROUP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user