Lines Matching refs:newc

294 	ocontext_t *newc = 0, *c, *head;  in define_initial_sid()  local
307 newc = (ocontext_t *) malloc(sizeof(ocontext_t)); in define_initial_sid()
308 if (!newc) { in define_initial_sid()
312 memset(newc, 0, sizeof(ocontext_t)); in define_initial_sid()
313 newc->u.name = id; in define_initial_sid()
314 context_init(&newc->context[0]); in define_initial_sid()
318 if (!strcmp(newc->u.name, c->u.name)) { in define_initial_sid()
325 newc->sid[0] = head->sid[0] + 1; in define_initial_sid()
327 newc->sid[0] = 1; in define_initial_sid()
329 newc->next = head; in define_initial_sid()
330 policydbp->ocontexts[OCON_ISID] = newc; in define_initial_sid()
337 if (newc) in define_initial_sid()
338 free(newc); in define_initial_sid()
4630 ocontext_t *newc, *c, *head; in define_fs_context() local
4643 newc = (ocontext_t *) malloc(sizeof(ocontext_t)); in define_fs_context()
4644 if (!newc) { in define_fs_context()
4648 memset(newc, 0, sizeof(ocontext_t)); in define_fs_context()
4650 newc->u.name = (char *)malloc(6); in define_fs_context()
4651 if (!newc->u.name) { in define_fs_context()
4653 free(newc); in define_fs_context()
4656 sprintf(newc->u.name, "%02x:%02x", major, minor); in define_fs_context()
4658 if (parse_security_context(&newc->context[0])) { in define_fs_context()
4659 free(newc->u.name); in define_fs_context()
4660 free(newc); in define_fs_context()
4663 if (parse_security_context(&newc->context[1])) { in define_fs_context()
4664 context_destroy(&newc->context[0]); in define_fs_context()
4665 free(newc->u.name); in define_fs_context()
4666 free(newc); in define_fs_context()
4672 if (!strcmp(newc->u.name, c->u.name)) { in define_fs_context()
4674 newc->u.name); in define_fs_context()
4675 context_destroy(&newc->context[0]); in define_fs_context()
4676 context_destroy(&newc->context[1]); in define_fs_context()
4677 free(newc->u.name); in define_fs_context()
4678 free(newc); in define_fs_context()
4683 newc->next = head; in define_fs_context()
4684 policydbp->ocontexts[OCON_FS] = newc; in define_fs_context()
4691 ocontext_t *newc, *c, *l, *head; in define_pirq_context() local
4706 newc = malloc(sizeof(ocontext_t)); in define_pirq_context()
4707 if (!newc) { in define_pirq_context()
4711 memset(newc, 0, sizeof(ocontext_t)); in define_pirq_context()
4713 newc->u.pirq = pirq; in define_pirq_context()
4715 if (parse_security_context(&newc->context[0])) { in define_pirq_context()
4716 free(newc); in define_pirq_context()
4732 l->next = newc; in define_pirq_context()
4734 policydbp->ocontexts[OCON_XEN_PIRQ] = newc; in define_pirq_context()
4739 free(newc); in define_pirq_context()
4745 ocontext_t *newc, *c, *l, *head; in define_iomem_context() local
4760 newc = malloc(sizeof(ocontext_t)); in define_iomem_context()
4761 if (!newc) { in define_iomem_context()
4765 memset(newc, 0, sizeof(ocontext_t)); in define_iomem_context()
4767 newc->u.iomem.low_iomem = low; in define_iomem_context()
4768 newc->u.iomem.high_iomem = high; in define_iomem_context()
4772 free(newc); in define_iomem_context()
4776 if (parse_security_context(&newc->context[0])) { in define_iomem_context()
4777 free(newc); in define_iomem_context()
4796 l->next = newc; in define_iomem_context()
4798 policydbp->ocontexts[OCON_XEN_IOMEM] = newc; in define_iomem_context()
4803 free(newc); in define_iomem_context()
4809 ocontext_t *newc, *c, *l, *head; in define_ioport_context() local
4824 newc = malloc(sizeof(ocontext_t)); in define_ioport_context()
4825 if (!newc) { in define_ioport_context()
4829 memset(newc, 0, sizeof(ocontext_t)); in define_ioport_context()
4831 newc->u.ioport.low_ioport = low; in define_ioport_context()
4832 newc->u.ioport.high_ioport = high; in define_ioport_context()
4836 free(newc); in define_ioport_context()
4840 if (parse_security_context(&newc->context[0])) { in define_ioport_context()
4841 free(newc); in define_ioport_context()
4860 l->next = newc; in define_ioport_context()
4862 policydbp->ocontexts[OCON_XEN_IOPORT] = newc; in define_ioport_context()
4867 free(newc); in define_ioport_context()
4873 ocontext_t *newc, *c, *l, *head; in define_pcidevice_context() local
4888 newc = malloc(sizeof(ocontext_t)); in define_pcidevice_context()
4889 if (!newc) { in define_pcidevice_context()
4893 memset(newc, 0, sizeof(ocontext_t)); in define_pcidevice_context()
4895 newc->u.device = device; in define_pcidevice_context()
4897 if (parse_security_context(&newc->context[0])) { in define_pcidevice_context()
4898 free(newc); in define_pcidevice_context()
4915 l->next = newc; in define_pcidevice_context()
4917 policydbp->ocontexts[OCON_XEN_PCIDEVICE] = newc; in define_pcidevice_context()
4922 free(newc); in define_pcidevice_context()
4928 ocontext_t *newc, *c, *l, *head; in define_devicetree_context() local
4941 newc = malloc(sizeof(ocontext_t)); in define_devicetree_context()
4942 if (!newc) { in define_devicetree_context()
4946 memset(newc, 0, sizeof(ocontext_t)); in define_devicetree_context()
4948 newc->u.name = (char *)queue_remove(id_queue); in define_devicetree_context()
4949 if (!newc->u.name) { in define_devicetree_context()
4950 free(newc); in define_devicetree_context()
4954 if (parse_security_context(&newc->context[0])) { in define_devicetree_context()
4955 free(newc->u.name); in define_devicetree_context()
4956 free(newc); in define_devicetree_context()
4962 if (strcmp(newc->u.name, c->u.name) == 0) { in define_devicetree_context()
4963 yyerror2("duplicate devicetree entry for '%s'", newc->u.name); in define_devicetree_context()
4969 l->next = newc; in define_devicetree_context()
4971 policydbp->ocontexts[OCON_XEN_DEVICETREE] = newc; in define_devicetree_context()
4976 free(newc->u.name); in define_devicetree_context()
4977 free(newc); in define_devicetree_context()
4983 ocontext_t *newc, *c, *l, *head; in define_port_context() local
4999 newc = malloc(sizeof(ocontext_t)); in define_port_context()
5000 if (!newc) { in define_port_context()
5004 memset(newc, 0, sizeof(ocontext_t)); in define_port_context()
5008 free(newc); in define_port_context()
5024 newc->u.port.protocol = protocol; in define_port_context()
5025 newc->u.port.low_port = low; in define_port_context()
5026 newc->u.port.high_port = high; in define_port_context()
5033 if (parse_security_context(&newc->context[0])) { in define_port_context()
5060 l->next = newc; in define_port_context()
5062 policydbp->ocontexts[OCON_PORT] = newc; in define_port_context()
5069 free(newc); in define_port_context()
5075 ocontext_t *newc, *c, *l, *head; in define_ibpkey_context() local
5092 newc = malloc(sizeof(*newc)); in define_ibpkey_context()
5093 if (!newc) { in define_ibpkey_context()
5097 memset(newc, 0, sizeof(*newc)); in define_ibpkey_context()
5127 memcpy(&newc->u.ibpkey.subnet_prefix, &subnet_prefix.s6_addr[0], in define_ibpkey_context()
5128 sizeof(newc->u.ibpkey.subnet_prefix)); in define_ibpkey_context()
5130 newc->u.ibpkey.low_pkey = low; in define_ibpkey_context()
5131 newc->u.ibpkey.high_pkey = high; in define_ibpkey_context()
5139 rc = parse_security_context(&newc->context[0]); in define_ibpkey_context()
5152 c->u.ibpkey.subnet_prefix == newc->u.ibpkey.subnet_prefix) { in define_ibpkey_context()
5159 c->u.ibpkey.subnet_prefix == newc->u.ibpkey.subnet_prefix) { in define_ibpkey_context()
5168 l->next = newc; in define_ibpkey_context()
5170 policydbp->ocontexts[OCON_IBPKEY] = newc; in define_ibpkey_context()
5175 free(newc); in define_ibpkey_context()
5181 ocontext_t *newc, *c, *l, *head; in define_ibendport_context() local
5202 newc = malloc(sizeof(*newc)); in define_ibendport_context()
5203 if (!newc) { in define_ibendport_context()
5207 memset(newc, 0, sizeof(*newc)); in define_ibendport_context()
5209 newc->u.ibendport.dev_name = queue_remove(id_queue); in define_ibendport_context()
5210 if (!newc->u.ibendport.dev_name) { in define_ibendport_context()
5216 if (strlen(newc->u.ibendport.dev_name) > IB_DEVICE_NAME_MAX - 1) { in define_ibendport_context()
5222 newc->u.ibendport.port = port; in define_ibendport_context()
5224 if (parse_security_context(&newc->context[0])) { in define_ibendport_context()
5225 free(newc); in define_ibendport_context()
5238 newc->u.ibendport.dev_name)) { in define_ibendport_context()
5240 newc->u.ibendport.dev_name, port); in define_ibendport_context()
5247 l->next = newc; in define_ibendport_context()
5249 policydbp->ocontexts[OCON_IBENDPORT] = newc; in define_ibendport_context()
5254 free(newc->u.ibendport.dev_name); in define_ibendport_context()
5255 free(newc); in define_ibendport_context()
5261 ocontext_t *newc, *c, *head; in define_netif_context() local
5275 newc = (ocontext_t *) malloc(sizeof(ocontext_t)); in define_netif_context()
5276 if (!newc) { in define_netif_context()
5280 memset(newc, 0, sizeof(ocontext_t)); in define_netif_context()
5282 newc->u.name = (char *)queue_remove(id_queue); in define_netif_context()
5283 if (!newc->u.name) { in define_netif_context()
5284 free(newc); in define_netif_context()
5287 if (parse_security_context(&newc->context[0])) { in define_netif_context()
5288 free(newc->u.name); in define_netif_context()
5289 free(newc); in define_netif_context()
5292 if (parse_security_context(&newc->context[1])) { in define_netif_context()
5293 context_destroy(&newc->context[0]); in define_netif_context()
5294 free(newc->u.name); in define_netif_context()
5295 free(newc); in define_netif_context()
5301 if (!strcmp(newc->u.name, c->u.name)) { in define_netif_context()
5303 newc->u.name); in define_netif_context()
5304 context_destroy(&newc->context[0]); in define_netif_context()
5305 context_destroy(&newc->context[1]); in define_netif_context()
5306 free(newc->u.name); in define_netif_context()
5307 free(newc); in define_netif_context()
5312 newc->next = head; in define_netif_context()
5313 policydbp->ocontexts[OCON_NETIF] = newc; in define_netif_context()
5322 ocontext_t *newc, *c, *l, *head; in define_ipv4_node_context() local
5368 newc = malloc(sizeof(ocontext_t)); in define_ipv4_node_context()
5369 if (!newc) { in define_ipv4_node_context()
5375 memset(newc, 0, sizeof(ocontext_t)); in define_ipv4_node_context()
5376 newc->u.node.addr = addr.s_addr; in define_ipv4_node_context()
5377 newc->u.node.mask = mask.s_addr; in define_ipv4_node_context()
5379 if (parse_security_context(&newc->context[0])) { in define_ipv4_node_context()
5380 free(newc); in define_ipv4_node_context()
5388 if (newc->u.node.mask > c->u.node.mask) in define_ipv4_node_context()
5392 newc->next = c; in define_ipv4_node_context()
5395 l->next = newc; in define_ipv4_node_context()
5397 policydbp->ocontexts[OCON_NODE] = newc; in define_ipv4_node_context()
5408 ocontext_t *newc, *c, *l, *head; in define_ipv6_node_context() local
5454 newc = malloc(sizeof(ocontext_t)); in define_ipv6_node_context()
5455 if (!newc) { in define_ipv6_node_context()
5461 memset(newc, 0, sizeof(ocontext_t)); in define_ipv6_node_context()
5462 memcpy(&newc->u.node6.addr[0], &addr.s6_addr[0], 16); in define_ipv6_node_context()
5463 memcpy(&newc->u.node6.mask[0], &mask.s6_addr[0], 16); in define_ipv6_node_context()
5465 if (parse_security_context(&newc->context[0])) { in define_ipv6_node_context()
5466 free(newc); in define_ipv6_node_context()
5475 if (memcmp(&newc->u.node6.mask, &c->u.node6.mask, 16) > 0) in define_ipv6_node_context()
5479 newc->next = c; in define_ipv6_node_context()
5482 l->next = newc; in define_ipv6_node_context()
5484 policydbp->ocontexts[OCON_NODE6] = newc; in define_ipv6_node_context()
5493 ocontext_t *newc, *c, *head; in define_fs_use() local
5506 newc = (ocontext_t *) malloc(sizeof(ocontext_t)); in define_fs_use()
5507 if (!newc) { in define_fs_use()
5511 memset(newc, 0, sizeof(ocontext_t)); in define_fs_use()
5513 newc->u.name = (char *)queue_remove(id_queue); in define_fs_use()
5514 if (!newc->u.name) { in define_fs_use()
5515 free(newc); in define_fs_use()
5518 newc->v.behavior = behavior; in define_fs_use()
5519 if (parse_security_context(&newc->context[0])) { in define_fs_use()
5520 free(newc->u.name); in define_fs_use()
5521 free(newc); in define_fs_use()
5528 if (!strcmp(newc->u.name, c->u.name)) { in define_fs_use()
5530 newc->u.name); in define_fs_use()
5531 context_destroy(&newc->context[0]); in define_fs_use()
5532 free(newc->u.name); in define_fs_use()
5533 free(newc); in define_fs_use()
5538 newc->next = head; in define_fs_use()
5539 policydbp->ocontexts[OCON_FSUSE] = newc; in define_fs_use()
5546 ocontext_t *newc, *c, *head, *p; in define_genfs_context_helper() local
5589 newc = (ocontext_t *) malloc(sizeof(ocontext_t)); in define_genfs_context_helper()
5590 if (!newc) { in define_genfs_context_helper()
5594 memset(newc, 0, sizeof(ocontext_t)); in define_genfs_context_helper()
5596 newc->u.name = (char *)queue_remove(id_queue); in define_genfs_context_helper()
5597 if (!newc->u.name) in define_genfs_context_helper()
5609 newc->v.sclass = SECCLASS_BLK_FILE; in define_genfs_context_helper()
5612 newc->v.sclass = SECCLASS_CHR_FILE; in define_genfs_context_helper()
5615 newc->v.sclass = SECCLASS_DIR; in define_genfs_context_helper()
5618 newc->v.sclass = SECCLASS_FIFO_FILE; in define_genfs_context_helper()
5621 newc->v.sclass = SECCLASS_LNK_FILE; in define_genfs_context_helper()
5624 newc->v.sclass = SECCLASS_SOCK_FILE; in define_genfs_context_helper()
5627 newc->v.sclass = SECCLASS_FILE; in define_genfs_context_helper()
5634 if (parse_security_context(&newc->context[0])) in define_genfs_context_helper()
5640 if (!strcmp(newc->u.name, c->u.name) && in define_genfs_context_helper()
5641 (!newc->v.sclass || !c->v.sclass in define_genfs_context_helper()
5642 || newc->v.sclass == c->v.sclass)) { in define_genfs_context_helper()
5644 genfs->fstype, newc->u.name); in define_genfs_context_helper()
5647 len = strlen(newc->u.name); in define_genfs_context_helper()
5653 newc->next = c; in define_genfs_context_helper()
5655 p->next = newc; in define_genfs_context_helper()
5657 genfs->head = newc; in define_genfs_context_helper()
5663 context_destroy(&newc->context[0]); in define_genfs_context_helper()
5666 if (newc->u.name) in define_genfs_context_helper()
5667 free(newc->u.name); in define_genfs_context_helper()
5668 free(newc); in define_genfs_context_helper()