提交 ade542c4 编写于 作者: Y yichengzhao

add permission

Signed-off-by: Nyichengzhao <yichengzhao1@huawei.com>
Change-Id: I64187213968dda97012e53e09c88e8900e094bbf
上级 353b2776
......@@ -141,6 +141,7 @@ typedef struct Service_ {
uint64_t tokenId;
char apl[MAX_APL_NAME + 1];
ServiceArgs capsArgs;
ServiceArgs permArgs;
Perms servPerm;
ServiceArgs pathArgs;
ServiceArgs extraArgs;
......
......@@ -204,6 +204,7 @@ void ReleaseService(Service *service)
FreeServiceArg(&service->pathArgs);
FreeServiceArg(&service->writePidArgs);
FreeServiceArg(&service->capsArgs);
FreeServiceArg(&service->permArgs);
if (service->servPerm.caps != NULL) {
free(service->servPerm.caps);
......@@ -808,6 +809,7 @@ int ParseOneService(const cJSON *curItem, Service *service)
(void)GetServiceArgs(curItem, "writepid", MAX_WRITEPID_FILES, &service->writePidArgs);
(void)GetServiceArgs(curItem, D_CAPS_STR_IN_CFG, MAX_WRITEPID_FILES, &service->capsArgs);
(void)GetServiceArgs(curItem, "permission", MAX_WRITEPID_FILES, &service->permArgs);
(void)GetStringItem(curItem, APL_STR_IN_CFG, service->apl, MAX_APL_NAME);
(void)GetCpuArgs(curItem, CPU_CORE_STR_IN_CFG, service);
ret = GetServiceSandbox(curItem, service);
......
......@@ -148,8 +148,15 @@ void GetAccessToken(void)
if (strlen(service->apl) == 0) {
(void)strncpy_s(service->apl, sizeof(service->apl), "system_core", sizeof(service->apl) - 1);
}
uint64_t tokenId = GetAccessTokenId(service->name, (const char **)service->capsArgs.argv,
service->capsArgs.count, service->apl);
NativeInfo nativeInfo = {
service->capsArgs.count,
service->permArgs.count,
(const char **)service->capsArgs.argv,
(const char **)service->permArgs.argv,
service->name,
service->apl,
};
uint64_t tokenId = GetAccessTokenId(&nativeInfo);
if (tokenId == 0) {
INIT_LOGE("Get totken id %lld of service \' %s \' failed", tokenId, service->name);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册