Lines Matching refs:section
103 PathMountNode *GetPathMountNode(const SandboxSection *section, int type, const char *source, const … in GetPathMountNode() argument
105 APPSPAWN_CHECK_ONLY_EXPER(section != NULL, return NULL); in GetPathMountNode()
111 ListNode *node = OH_ListFind(§ion->front, (void *)&pathNode, PathMountNodeCompare); in GetPathMountNode()
118 SymbolLinkNode *GetSymbolLinkNode(const SandboxSection *section, const char *target, const char *li… in GetSymbolLinkNode() argument
120 APPSPAWN_CHECK_ONLY_EXPER(section != NULL, return NULL); in GetSymbolLinkNode()
126 ListNode *node = OH_ListFind(§ion->front, (void *)&linkNode, SymbolLinkNodeCompare); in GetSymbolLinkNode()
153 SandboxMountNode *GetFirstSandboxMountNode(const SandboxSection *section) in GetFirstSandboxMountNode() argument
155 if (section == NULL || ListEmpty(section->front)) { in GetFirstSandboxMountNode()
158 return (SandboxMountNode *)ListEntry(section->front.next, SandboxMountNode, node); in GetFirstSandboxMountNode()
194 static inline void InitSandboxSection(SandboxSection *section, int type) in InitSandboxSection() argument
196 OH_ListInit(§ion->front); in InitSandboxSection()
197 section->sandboxSwitch = 0; in InitSandboxSection()
198 section->sandboxShared = 0; in InitSandboxSection()
199 section->number = 0; in InitSandboxSection()
200 section->gidCount = 0; in InitSandboxSection()
201 section->gidTable = NULL; in InitSandboxSection()
202 section->nameGroups = NULL; in InitSandboxSection()
203 section->name = NULL; in InitSandboxSection()
204 OH_ListInit(§ion->sandboxNode.node); in InitSandboxSection()
205 section->sandboxNode.type = type; in InitSandboxSection()
208 static void ClearSandboxSection(SandboxSection *section) in ClearSandboxSection() argument
210 if (section->gidTable) { in ClearSandboxSection()
211 free(section->gidTable); in ClearSandboxSection()
212 section->gidTable = NULL; in ClearSandboxSection()
215 if (section->nameGroups) { in ClearSandboxSection()
216 free(section->nameGroups); in ClearSandboxSection()
217 section->nameGroups = NULL; in ClearSandboxSection()
219 if (section->name) { in ClearSandboxSection()
220 free(section->name); in ClearSandboxSection()
221 section->name = NULL; in ClearSandboxSection()
223 if (section->sandboxNode.type == SANDBOX_TAG_NAME_GROUP) { in ClearSandboxSection()
224 SandboxNameGroupNode *groupNode = (SandboxNameGroupNode *)section; in ClearSandboxSection()
230 ListNode *node = section->front.next; in ClearSandboxSection()
231 while (node != §ion->front) { in ClearSandboxSection()
238 node = section->front.next; in ClearSandboxSection()
256 static void DumpSandboxSection(const SandboxSection *section) in DumpSandboxSection() argument
258 APPSPAPWN_DUMP(" sandboxSwitch %{public}s", section->sandboxSwitch ? "true" : "false"); in DumpSandboxSection()
259 APPSPAPWN_DUMP(" sandboxShared %{public}s", section->sandboxShared ? "true" : "false"); in DumpSandboxSection()
260 APPSPAPWN_DUMP(" gidCount: %{public}u", section->gidCount); in DumpSandboxSection()
261 for (uint32_t index = 0; index < section->gidCount; index++) { in DumpSandboxSection()
262 APPSPAPWN_DUMP(" gidTable[%{public}u]: %{public}u", index, section->gidTable[index]); in DumpSandboxSection()
264 APPSPAPWN_DUMP(" mount group count: %{public}u", section->number); in DumpSandboxSection()
265 for (uint32_t i = 0; i < section->number; i++) { in DumpSandboxSection()
266 if (section->nameGroups[i]) { in DumpSandboxSection()
267 SandboxNameGroupNode *groupNode = (SandboxNameGroupNode *)section->nameGroups[i]; in DumpSandboxSection()
268 APPSPAPWN_DUMP(" name[%{public}d] %{public}s", i, groupNode->section.name); in DumpSandboxSection()
272 DumpSandboxQueue(§ion->front, DumpSandboxMountNode); in DumpSandboxSection()
282 SandboxSection *section = (SandboxSection *)calloc(1, dataLen); in CreateSandboxSection() local
283 APPSPAWN_CHECK(section != NULL, return NULL, "Failed to create base node"); in CreateSandboxSection()
284 InitSandboxSection(section, type); in CreateSandboxSection()
285 section->name = strdup(name); in CreateSandboxSection()
286 if (section->name == NULL) { in CreateSandboxSection()
287 ClearSandboxSection(section); in CreateSandboxSection()
288 free(section); in CreateSandboxSection()
291 return section; in CreateSandboxSection()
325 void DeleteSandboxSection(SandboxSection *section) in DeleteSandboxSection() argument
327 APPSPAWN_CHECK_ONLY_EXPER(section != NULL, return); in DeleteSandboxSection()
329 OH_ListRemove(§ion->sandboxNode.node); in DeleteSandboxSection()
330 OH_ListInit(§ion->sandboxNode.node); in DeleteSandboxSection()
331 ClearSandboxSection(section); in DeleteSandboxSection()
332 free(section); in DeleteSandboxSection()
389 APPSPAPWN_DUMP(" Section %{public}s", permissionNode->section.name); in DumpSandboxPermission()
391 DumpSandboxSection(&permissionNode->section); in DumpSandboxPermission()
396 SandboxSection *section = (SandboxSection *)node; in DumpSandboxSectionNode() local
398 APPSPAPWN_DUMP(" Section %{public}s", section->name); in DumpSandboxSectionNode()
399 DumpSandboxSection(section); in DumpSandboxSectionNode()
406 APPSPAPWN_DUMP(" Section %{public}s", nameGroupNode->section.name); in DumpSandboxNameGroupNode()
413 DumpSandboxSection(&nameGroupNode->section); in DumpSandboxNameGroupNode()
553 if (permissionNode->section.gidCount == 0) { in AppendPermissionGid()
558 … permissionNode->section.name, permissionNode->section.gidTable[0], GetProcessName(property)); in AppendPermissionGid()
560 size_t copyLen = permissionNode->section.gidCount; in AppendPermissionGid()
561 if ((permissionNode->section.gidCount + dacInfo->gidCount) > APP_MAX_GIDS) { in AppendPermissionGid()
563 GetProcessName(property), dacInfo->gidCount, permissionNode->section.gidCount); in AppendPermissionGid()
567 permissionNode->section.gidTable, sizeof(gid_t) * copyLen); in AppendPermissionGid()
570 permissionNode->section.name, GetProcessName(property)); in AppendPermissionGid()