mirror of
https://gitee.com/openharmony/startup_appspawn
synced 2024-11-27 01:00:38 +00:00
commit
8f79ca7e4e
@ -131,7 +131,7 @@ APPSPAWN_STATIC int CreateClientSocket(uint32_t type, uint32_t timeout)
|
||||
int pathLen = snprintf_s(addr.sun_path, pathSize, (pathSize - 1), "%s%s", APPSPAWN_SOCKET_DIR, socketName);
|
||||
APPSPAWN_CHECK(pathLen > 0, break, "Format path %{public}s error: %{public}d", socketName, errno);
|
||||
addr.sun_family = AF_LOCAL;
|
||||
socklen_t socketAddrLen = (socklen_t)offsetof(struct sockaddr_un, sun_path) + pathLen + 1;
|
||||
socklen_t socketAddrLen = (socklen_t)(offsetof(struct sockaddr_un, sun_path) + pathLen + 1);
|
||||
ret = connect(socketFd, (struct sockaddr *)(&addr), socketAddrLen);
|
||||
APPSPAWN_CHECK(ret == 0, break,
|
||||
"Failed to connect %{public}s error: %{public}d", addr.sun_path, errno);
|
||||
|
@ -1567,19 +1567,20 @@ static inline int EnableSandboxNamespace(AppSpawningCtx *appProperty, uint32_t s
|
||||
|
||||
int32_t SandboxUtils::SetPermissionWithParam(AppSpawningCtx *appProperty)
|
||||
{
|
||||
uint32_t index = 0;
|
||||
int32_t index = 0;
|
||||
int32_t appFullMountStatus = CheckAppFullMountEnable();
|
||||
if (appFullMountStatus == FILE_CROSS_APP_STATUS) {
|
||||
index = (uint32_t)GetPermissionIndex(nullptr, FILE_CROSS_APP_MODE.c_str());
|
||||
index = GetPermissionIndex(nullptr, FILE_CROSS_APP_MODE.c_str());
|
||||
} else if (appFullMountStatus == FILE_ACCESS_COMMON_DIR_STATUS) {
|
||||
index = (uint32_t)GetPermissionIndex(nullptr, FILE_ACCESS_COMMON_DIR_MODE.c_str());
|
||||
index = GetPermissionIndex(nullptr, FILE_ACCESS_COMMON_DIR_MODE.c_str());
|
||||
}
|
||||
|
||||
int32_t fileMgrIndex = GetPermissionIndex(nullptr, FILE_ACCESS_MANAGER_MODE.c_str());
|
||||
if (index > 0 && (CheckAppPermissionFlagSet(appProperty, static_cast<uint32_t>(fileMgrIndex)) == 0)) {
|
||||
int32_t fileMgrIndex = GetPermissionIndex(nullptr, FILE_ACCESS_MANAGER_MODE.c_str());
|
||||
if (index > 0 && fileMgrIndex > 0 &&
|
||||
(CheckAppPermissionFlagSet(appProperty, static_cast<uint32_t>(fileMgrIndex)) == 0)) {
|
||||
return SetAppPermissionFlags(appProperty, index);
|
||||
}
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t SandboxUtils::SetAppSandboxProperty(AppSpawningCtx *appProperty, uint32_t sandboxNsFlags)
|
||||
|
@ -257,10 +257,11 @@ static int HnpHapJsonWrite(cJSON *json)
|
||||
return HNP_ERRNO_BASE_FILE_OPEN_FAILED;
|
||||
}
|
||||
char *jsonStr = cJSON_Print(json);
|
||||
size_t writeLen = fwrite(jsonStr, strlen(jsonStr), sizeof(char), fp);
|
||||
size_t jsonStrSize = strlen(jsonStr);
|
||||
size_t writeLen = fwrite(jsonStr, sizeof(char), jsonStrSize, fp);
|
||||
(void)fclose(fp);
|
||||
free(jsonStr);
|
||||
if (writeLen == 0) {
|
||||
if (writeLen != jsonStrSize) {
|
||||
HNP_LOGE("package info write file:%{public}s unsuccess!", HNP_PACKAGE_INFO_JSON_FILE_PATH);
|
||||
return HNP_ERRNO_BASE_FILE_WRITE_FAILED;
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ int HnpCfgGetFromZip(const char *inputFile, HnpCfgInfo *hnpCfg)
|
||||
return HNP_ERRNO_NOMEM;
|
||||
}
|
||||
int readSize = unzReadCurrentFile(zipFile, cfgStream, fileInfo.uncompressed_size);
|
||||
if ((uLong)readSize != fileInfo.uncompressed_size) {
|
||||
if (readSize < 0 || (uLong)readSize != fileInfo.uncompressed_size) {
|
||||
free(cfgStream);
|
||||
unzClose(zipFile);
|
||||
HNP_LOGE("unzip read zip:%{public}s info size[%{public}lu]=>[%{public}d] error!", inputFile,
|
||||
|
@ -398,10 +398,6 @@ void DumpAppSpawnMsg(const AppSpawnMsgNode *message)
|
||||
AppSpawnMsgOwnerId *owner = (AppSpawnMsgOwnerId *)GetAppSpawnMsgInfo(message, TLV_OWNER_INFO);
|
||||
APPSPAWN_ONLY_EXPER(owner != NULL, APPSPAPWN_DUMP("App owner info: \"%{public}s\" ", owner->ownerId));
|
||||
|
||||
AppSpawnMsgAccessToken *t = (AppSpawnMsgAccessToken *)GetAppSpawnMsgInfo(message, TLV_ACCESS_TOKEN_INFO);
|
||||
APPSPAWN_ONLY_EXPER(t != NULL,
|
||||
APPSPAPWN_DUMP("App access token info: %{private}" PRId64 "", t->accessTokenIdEx));
|
||||
|
||||
AppSpawnMsgInternetInfo *info = (AppSpawnMsgInternetInfo *)GetAppSpawnMsgInfo(message, TLV_INTERNET_INFO);
|
||||
APPSPAWN_ONLY_EXPER(info != NULL,
|
||||
APPSPAPWN_DUMP("App internet permission info [%{public}d %{public}d]",
|
||||
|
Loading…
Reference in New Issue
Block a user