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