Lines Matching refs:id
81 static int id_has_dot(char *id);
119 int insert_id(const char *id, int push) in insert_id() argument
124 newid = (char *)malloc(strlen(id) + 1); in insert_id()
129 strcpy(newid, id); in insert_id()
145 static int id_has_dot(char *id) in id_has_dot() argument
147 if (strchr(id, '.') >= id + 1) { in id_has_dot()
155 char *id = 0; in define_class() local
161 id = queue_remove(id_queue); in define_class()
162 free(id); in define_class()
166 id = (char *)queue_remove(id_queue); in define_class()
167 if (!id) { in define_class()
177 ret = declare_symbol(SYM_CLASSES, id, datum, &value, &value); in define_class()
184 yyerror2("duplicate declaration of class %s", id); in define_class()
203 if (id) in define_class()
204 free(id); in define_class()
255 char *id = 0; in define_polcap() local
259 id = queue_remove(id_queue); in define_polcap()
260 free(id); in define_polcap()
264 id = (char *)queue_remove(id_queue); in define_polcap()
265 if (!id) { in define_polcap()
271 capnum = sepol_polcap_getnum(id); in define_polcap()
273 yyerror2("invalid policy capability name %s", id); in define_polcap()
283 free(id); in define_polcap()
287 free(id); in define_polcap()
293 char *id = 0; in define_initial_sid() local
297 id = queue_remove(id_queue); in define_initial_sid()
298 free(id); in define_initial_sid()
302 id = (char *)queue_remove(id_queue); in define_initial_sid()
303 if (!id) { in define_initial_sid()
313 newc->u.name = id; in define_initial_sid()
319 yyerror2("duplicate initial SID %s", id); in define_initial_sid()
335 if (id) in define_initial_sid()
336 free(id); in define_initial_sid()
344 char *id; in read_classes() local
347 while ((id = queue_remove(id_queue))) { in read_classes()
348 if (!is_id_in_scope(SYM_CLASSES, id)) { in read_classes()
349 yyerror2("class %s is not within scope", id); in read_classes()
352 cladatum = hashtab_search(policydbp->p_classes.table, id); in read_classes()
354 yyerror2("unknown class %s", id); in read_classes()
355 free(id); in read_classes()
358 free(id); in read_classes()
369 char *id; in define_default_user() local
373 while ((id = queue_remove(id_queue))) in define_default_user()
374 free(id); in define_default_user()
378 while ((id = queue_remove(id_queue))) { in define_default_user()
379 if (!is_id_in_scope(SYM_CLASSES, id)) { in define_default_user()
380 yyerror2("class %s is not within scope", id); in define_default_user()
383 cladatum = hashtab_search(policydbp->p_classes.table, id); in define_default_user()
385 yyerror2("unknown class %s", id); in define_default_user()
389 yyerror2("conflicting default user information for class %s", id); in define_default_user()
393 free(id); in define_default_user()
401 char *id; in define_default_role() local
405 while ((id = queue_remove(id_queue))) in define_default_role()
406 free(id); in define_default_role()
410 while ((id = queue_remove(id_queue))) { in define_default_role()
411 if (!is_id_in_scope(SYM_CLASSES, id)) { in define_default_role()
412 yyerror2("class %s is not within scope", id); in define_default_role()
415 cladatum = hashtab_search(policydbp->p_classes.table, id); in define_default_role()
417 yyerror2("unknown class %s", id); in define_default_role()
421 yyerror2("conflicting default role information for class %s", id); in define_default_role()
425 free(id); in define_default_role()
433 char *id; in define_default_type() local
437 while ((id = queue_remove(id_queue))) in define_default_type()
438 free(id); in define_default_type()
442 while ((id = queue_remove(id_queue))) { in define_default_type()
443 if (!is_id_in_scope(SYM_CLASSES, id)) { in define_default_type()
444 yyerror2("class %s is not within scope", id); in define_default_type()
447 cladatum = hashtab_search(policydbp->p_classes.table, id); in define_default_type()
449 yyerror2("unknown class %s", id); in define_default_type()
453 yyerror2("conflicting default type information for class %s", id); in define_default_type()
457 free(id); in define_default_type()
465 char *id; in define_default_range() local
469 while ((id = queue_remove(id_queue))) in define_default_range()
470 free(id); in define_default_range()
474 while ((id = queue_remove(id_queue))) { in define_default_range()
475 if (!is_id_in_scope(SYM_CLASSES, id)) { in define_default_range()
476 yyerror2("class %s is not within scope", id); in define_default_range()
479 cladatum = hashtab_search(policydbp->p_classes.table, id); in define_default_range()
481 yyerror2("unknown class %s", id); in define_default_range()
485 yyerror2("conflicting default range information for class %s", id); in define_default_range()
489 free(id); in define_default_range()
497 char *id = 0, *perm = 0; in define_common_perms() local
503 while ((id = queue_remove(id_queue))) in define_common_perms()
504 free(id); in define_common_perms()
508 id = (char *)queue_remove(id_queue); in define_common_perms()
509 if (!id) { in define_common_perms()
513 comdatum = hashtab_search(policydbp->p_commons.table, id); in define_common_perms()
515 yyerror2("duplicate declaration for common %s\n", id); in define_common_perms()
525 (hashtab_key_t) id, (hashtab_datum_t) comdatum); in define_common_perms()
561 id); in define_common_perms()
574 if (id) in define_common_perms()
575 free(id); in define_common_perms()
590 char *id; in define_av_perms() local
597 while ((id = queue_remove(id_queue))) in define_av_perms()
598 free(id); in define_av_perms()
602 id = (char *)queue_remove(id_queue); in define_av_perms()
603 if (!id) { in define_av_perms()
608 (hashtab_key_t) id); in define_av_perms()
610 yyerror2("class %s is not defined", id); in define_av_perms()
613 free(id); in define_av_perms()
624 id = (char *)queue_remove(id_queue); in define_av_perms()
625 if (!id) { in define_av_perms()
633 (hashtab_key_t) id); in define_av_perms()
636 yyerror2("common %s is not defined", id); in define_av_perms()
639 cladatum->comkey = id; in define_av_perms()
648 while ((id = queue_remove(id_queue))) { in define_av_perms()
671 (hashtab_key_t) id); in define_av_perms()
674 "inherited permission", id); in define_av_perms()
679 (hashtab_key_t) id, in define_av_perms()
683 yyerror2("duplicate permission %s", id); in define_av_perms()
699 if (id) in define_av_perms()
700 free(id); in define_av_perms()
708 char *id; in define_sens() local
720 while ((id = queue_remove(id_queue))) in define_sens()
721 free(id); in define_sens()
725 id = (char *)queue_remove(id_queue); in define_sens()
726 if (!id) { in define_sens()
730 if (id_has_dot(id)) { in define_sens()
752 ret = declare_symbol(SYM_LEVELS, id, datum, &value, &value); in define_sens()
775 while ((id = queue_remove(id_queue))) { in define_sens()
776 if (id_has_dot(id)) { in define_sens()
789 ret = declare_symbol(SYM_LEVELS, id, aliasdatum, NULL, &value); in define_sens()
818 if (id) in define_sens()
819 free(id); in define_sens()
829 if (id) in define_sens()
830 free(id); in define_sens()
842 char *id; in define_dominance() local
850 while ((id = queue_remove(id_queue))) in define_dominance()
851 free(id); in define_dominance()
856 while ((id = (char *)queue_remove(id_queue))) { in define_dominance()
859 (hashtab_key_t) id); in define_dominance()
862 "definition", id); in define_dominance()
863 free(id); in define_dominance()
868 "definition", id); in define_dominance()
869 free(id); in define_dominance()
875 free(id); in define_dominance()
888 char *id; in define_category() local
899 while ((id = queue_remove(id_queue))) in define_category()
900 free(id); in define_category()
904 id = (char *)queue_remove(id_queue); in define_category()
905 if (!id) { in define_category()
909 if (id_has_dot(id)) { in define_category()
921 ret = declare_symbol(SYM_CATS, id, datum, &value, &value); in define_category()
945 while ((id = queue_remove(id_queue))) { in define_category()
946 if (id_has_dot(id)) { in define_category()
960 declare_symbol(SYM_CATS, id, aliasdatum, NULL, in define_category()
990 if (id) in define_category()
991 free(id); in define_category()
999 if (id) in define_category()
1000 free(id); in define_category()
1031 char *id; in define_level() local
1040 while ((id = queue_remove(id_queue))) in define_level()
1041 free(id); in define_level()
1045 id = (char *)queue_remove(id_queue); in define_level()
1046 if (!id) { in define_level()
1051 (hashtab_key_t) id); in define_level()
1053 yyerror2("unknown sensitivity %s used in level definition", id); in define_level()
1054 free(id); in define_level()
1059 id); in define_level()
1060 free(id); in define_level()
1063 free(id); in define_level()
1067 while ((id = queue_remove(id_queue))) { in define_level()
1071 if (id_has_dot(id)) { in define_level()
1072 char *id_start = id; in define_level()
1073 char *id_end = strchr(id, '.'); in define_level()
1084 free(id); in define_level()
1095 free(id); in define_level()
1102 free(id); in define_level()
1109 (hashtab_key_t) id); in define_level()
1111 yyerror2("unknown category %s", id); in define_level()
1112 free(id); in define_level()
1121 free(id); in define_level()
1126 free(id); in define_level()
1153 char *id; in expand_attrib() local
1163 while ((id = queue_remove(id_queue))) { in expand_attrib()
1164 free(id); in expand_attrib()
1171 while ((id = queue_remove(id_queue))) { in expand_attrib()
1172 if (!id) { in expand_attrib()
1177 if (!is_id_in_scope(SYM_TYPES, id)) { in expand_attrib()
1178 yyerror2("attribute %s is not within scope", id); in expand_attrib()
1182 attr = hashtab_search(policydbp->p_types.table, id); in expand_attrib()
1184 yyerror2("attribute %s is not declared", id); in expand_attrib()
1189 yyerror2("%s is a type, not an attribute", id); in expand_attrib()
1198 free(id); in expand_attrib()
1201 id = (char *) queue_remove(id_queue); in expand_attrib()
1202 if (!id) { in expand_attrib()
1207 if (!strcmp(id, "T")) { in expand_attrib()
1231 free(id); in expand_attrib()
1237 char *id; in add_aliases_to_type() local
1240 while ((id = queue_remove(id_queue))) { in add_aliases_to_type()
1241 if (id_has_dot(id)) { in add_aliases_to_type()
1242 free(id); in add_aliases_to_type()
1249 free(id); in add_aliases_to_type()
1256 ret = declare_symbol(SYM_TYPES, id, aliasdatum, in add_aliases_to_type()
1265 id); in add_aliases_to_type()
1279 aliasdatum = hashtab_search(policydbp->symtab[SYM_TYPES].table, id); in add_aliases_to_type()
1294 free(id); in add_aliases_to_type()
1302 char *id; in define_typealias() local
1306 while ((id = queue_remove(id_queue))) in define_typealias()
1307 free(id); in define_typealias()
1311 id = (char *)queue_remove(id_queue); in define_typealias()
1312 if (!id) { in define_typealias()
1317 if (!is_id_in_scope(SYM_TYPES, id)) { in define_typealias()
1318 yyerror2("type %s is not within scope", id); in define_typealias()
1319 free(id); in define_typealias()
1322 t = hashtab_search(policydbp->p_types.table, id); in define_typealias()
1325 "attribute", id); in define_typealias()
1326 free(id); in define_typealias()
1329 free(id); in define_typealias()
1335 char *id; in define_typeattribute() local
1339 while ((id = queue_remove(id_queue))) in define_typeattribute()
1340 free(id); in define_typeattribute()
1344 id = (char *)queue_remove(id_queue); in define_typeattribute()
1345 if (!id) { in define_typeattribute()
1350 if (!is_id_in_scope(SYM_TYPES, id)) { in define_typeattribute()
1351 yyerror2("type %s is not within scope", id); in define_typeattribute()
1352 free(id); in define_typeattribute()
1355 t = hashtab_search(policydbp->p_types.table, id); in define_typeattribute()
1357 yyerror2("unknown type %s", id); in define_typeattribute()
1358 free(id); in define_typeattribute()
1361 free(id); in define_typeattribute()
1363 while ((id = queue_remove(id_queue))) { in define_typeattribute()
1364 if (!is_id_in_scope(SYM_TYPES, id)) { in define_typeattribute()
1365 yyerror2("attribute %s is not within scope", id); in define_typeattribute()
1366 free(id); in define_typeattribute()
1369 attr = hashtab_search(policydbp->p_types.table, id); in define_typeattribute()
1372 yyerror2("attribute %s is not declared", id); in define_typeattribute()
1373 free(id); in define_typeattribute()
1378 yyerror2("%s is a type, not an attribute", id); in define_typeattribute()
1379 free(id); in define_typeattribute()
1383 if ((attr = get_local_type(id, attr->s.value, 1)) == NULL) { in define_typeattribute()
1444 char *bounds, *id; in define_typebounds() local
1447 while ((id = queue_remove(id_queue))) in define_typebounds()
1448 free(id); in define_typebounds()
1458 while ((id = queue_remove(id_queue))) { in define_typebounds()
1459 if (define_typebounds_helper(bounds, id)) in define_typebounds()
1461 free(id); in define_typebounds()
1470 char *id; in define_type() local
1479 if ((id = queue_remove(id_queue))) { in define_type()
1482 if ((delim = strrchr(id, '.')) in define_type()
1483 && (bounds = strdup(id))) { in define_type()
1484 bounds[(size_t)(delim - id)] = '\0'; in define_type()
1486 if (define_typebounds_helper(bounds, id)) in define_type()
1490 free(id); in define_type()
1494 while ((id = queue_remove(id_queue))) in define_type()
1495 free(id); in define_type()
1498 while ((id = queue_remove(id_queue))) in define_type()
1499 free(id); in define_type()
1513 while ((id = queue_remove(id_queue))) { in define_type()
1514 if (!is_id_in_scope(SYM_TYPES, id)) { in define_type()
1515 yyerror2("attribute %s is not within scope", id); in define_type()
1516 free(id); in define_type()
1519 attr = hashtab_search(policydbp->p_types.table, id); in define_type()
1522 yyerror2("attribute %s is not declared", id); in define_type()
1523 free(id); in define_type()
1528 yyerror2("%s is a type, not an attribute", id); in define_type()
1529 free(id); in define_type()
1533 if ((attr = get_local_type(id, attr->s.value, 1)) == NULL) { in define_type()
1555 static int set_types(type_set_t * set, char *id, int *add, char starallowed) in set_types() argument
1559 if (strcmp(id, "*") == 0) { in set_types()
1560 free(id); in set_types()
1571 if (strcmp(id, "~") == 0) { in set_types()
1572 free(id); in set_types()
1583 if (strcmp(id, "-") == 0) { in set_types()
1585 free(id); in set_types()
1589 if (!is_id_in_scope(SYM_TYPES, id)) { in set_types()
1590 yyerror2("type %s is not within scope", id); in set_types()
1591 free(id); in set_types()
1594 t = hashtab_search(policydbp->p_types.table, id); in set_types()
1596 yyerror2("unknown type %s", id); in set_types()
1597 free(id); in set_types()
1608 free(id); in set_types()
1613 free(id); in set_types()
1619 char *id; in define_compute_type_helper() local
1643 while ((id = queue_remove(id_queue))) { in define_compute_type_helper()
1644 if (set_types(&avrule->stypes, id, &add, 0)) in define_compute_type_helper()
1648 while ((id = queue_remove(id_queue))) { in define_compute_type_helper()
1649 if (set_types(&avrule->ttypes, id, &add, 0)) in define_compute_type_helper()
1657 id = (char *)queue_remove(id_queue); in define_compute_type_helper()
1658 if (!id) { in define_compute_type_helper()
1662 if (!is_id_in_scope(SYM_TYPES, id)) { in define_compute_type_helper()
1663 yyerror2("type %s is not within scope", id); in define_compute_type_helper()
1664 free(id); in define_compute_type_helper()
1668 (hashtab_key_t) id); in define_compute_type_helper()
1670 yyerror2("unknown type %s", id); in define_compute_type_helper()
1671 free(id); in define_compute_type_helper()
1674 free(id); in define_compute_type_helper()
1703 char *id; in define_compute_type() local
1707 while ((id = queue_remove(id_queue))) in define_compute_type()
1708 free(id); in define_compute_type()
1709 while ((id = queue_remove(id_queue))) in define_compute_type()
1710 free(id); in define_compute_type()
1711 while ((id = queue_remove(id_queue))) in define_compute_type()
1712 free(id); in define_compute_type()
1713 id = queue_remove(id_queue); in define_compute_type()
1714 free(id); in define_compute_type()
1727 char *id; in define_cond_compute_type() local
1731 while ((id = queue_remove(id_queue))) in define_cond_compute_type()
1732 free(id); in define_cond_compute_type()
1733 while ((id = queue_remove(id_queue))) in define_cond_compute_type()
1734 free(id); in define_cond_compute_type()
1735 while ((id = queue_remove(id_queue))) in define_cond_compute_type()
1736 free(id); in define_cond_compute_type()
1737 id = queue_remove(id_queue); in define_cond_compute_type()
1738 free(id); in define_cond_compute_type()
1750 char *id, *bool_value; in define_bool_tunable() local
1756 while ((id = queue_remove(id_queue))) in define_bool_tunable()
1757 free(id); in define_bool_tunable()
1761 id = (char *)queue_remove(id_queue); in define_bool_tunable()
1762 if (!id) { in define_bool_tunable()
1766 if (id_has_dot(id)) { in define_bool_tunable()
1767 free(id); in define_bool_tunable()
1774 free(id); in define_bool_tunable()
1780 ret = declare_symbol(SYM_BOOLS, id, datum, &value, &value); in define_bool_tunable()
1787 yyerror2("duplicate declaration of boolean %s", id); in define_bool_tunable()
1814 cond_destroy_bool(id, datum, NULL); in define_bool_tunable()
1916 char *id; in avrule_read_ioctls() local
1922 while ((id = queue_remove(id_queue))) { in avrule_read_ioctls()
1923 if (strcmp(id,"~") == 0) { in avrule_read_ioctls()
1925 free(id); in avrule_read_ioctls()
1927 } else if (strcmp(id,"-") == 0) { in avrule_read_ioctls()
1929 free(id); in avrule_read_ioctls()
1930 id = queue_remove(id_queue); in avrule_read_ioctls()
1931 r->range.high = (uint16_t) strtoul(id,NULL,0); in avrule_read_ioctls()
1936 free(id); in avrule_read_ioctls()
1950 rnew->range.low = (uint16_t) strtoul(id,NULL,0); in avrule_read_ioctls()
1952 free(id); in avrule_read_ioctls()
2042 char *id; in define_te_avtab_xperms_helper() local
2069 while ((id = queue_remove(id_queue))) { in define_te_avtab_xperms_helper()
2071 (&avrule->stypes, id, &add, in define_te_avtab_xperms_helper()
2078 while ((id = queue_remove(id_queue))) { in define_te_avtab_xperms_helper()
2079 if (strcmp(id, "self") == 0) { in define_te_avtab_xperms_helper()
2080 free(id); in define_te_avtab_xperms_helper()
2090 (&avrule->ttypes, id, &add, in define_te_avtab_xperms_helper()
2103 id = queue_head(id_queue); in define_te_avtab_xperms_helper()
2123 perdatum = hashtab_search(cladatum->permissions.table, id); in define_te_avtab_xperms_helper()
2128 id); in define_te_avtab_xperms_helper()
2133 " for class %s", id, in define_te_avtab_xperms_helper()
2136 } else if (!is_perm_in_scope (id, policydbp->p_class_val_to_name[i])) { in define_te_avtab_xperms_helper()
2138 " not within scope", id, in define_te_avtab_xperms_helper()
2474 char *id; in define_te_avtab_extended_perms() local
2480 while ((id = queue_remove(id_queue))) in define_te_avtab_extended_perms()
2481 free(id); in define_te_avtab_extended_perms()
2490 id = queue_remove(id_queue); in define_te_avtab_extended_perms()
2491 if (strcmp(id,"ioctl") == 0) { in define_te_avtab_extended_perms()
2492 free(id); in define_te_avtab_extended_perms()
2497 free(id); in define_te_avtab_extended_perms()
2505 char *id; in define_te_avtab_helper() local
2534 while ((id = queue_remove(id_queue))) { in define_te_avtab_helper()
2536 (&avrule->stypes, id, &add, in define_te_avtab_helper()
2543 while ((id = queue_remove(id_queue))) { in define_te_avtab_helper()
2544 if (strcmp(id, "self") == 0) { in define_te_avtab_helper()
2545 free(id); in define_te_avtab_helper()
2555 (&avrule->ttypes, id, &add, in define_te_avtab_helper()
2587 while ((id = queue_remove(id_queue))) { in define_te_avtab_helper()
2594 if (strcmp(id, "*") == 0) { in define_te_avtab_helper()
2600 if (strcmp(id, "~") == 0) { in define_te_avtab_helper()
2609 hashtab_search(cladatum->permissions.table, id); in define_te_avtab_helper()
2615 id); in define_te_avtab_helper()
2621 " for class %s", id, in define_te_avtab_helper()
2626 (id, policydbp->p_class_val_to_name[i])) { in define_te_avtab_helper()
2629 " not within scope", id, in define_te_avtab_helper()
2640 free(id); in define_te_avtab_helper()
2659 char *id; in define_cond_te_avtab() local
2665 while ((id = queue_remove(id_queue))) in define_cond_te_avtab()
2666 free(id); in define_cond_te_avtab()
2679 char *id; in define_te_avtab() local
2685 while ((id = queue_remove(id_queue))) in define_te_avtab()
2686 free(id); in define_te_avtab()
2705 char *id; in define_role_types() local
2709 while ((id = queue_remove(id_queue))) in define_role_types()
2710 free(id); in define_role_types()
2714 id = (char *)queue_remove(id_queue); in define_role_types()
2715 if (!id) { in define_role_types()
2720 if (!is_id_in_scope(SYM_ROLES, id)) { in define_role_types()
2721 yyerror2("role %s is not within scope", id); in define_role_types()
2722 free(id); in define_role_types()
2726 role = hashtab_search(policydbp->p_roles.table, id); in define_role_types()
2728 yyerror2("unknown role %s", id); in define_role_types()
2729 free(id); in define_role_types()
2732 role = get_local_role(id, role->s.value, (role->flavor == ROLE_ATTRIB)); in define_role_types()
2734 while ((id = queue_remove(id_queue))) { in define_role_types()
2735 if (set_types(&role->types, id, &add, 0)) in define_role_types()
2758 char *id; in define_role_attr() local
2762 while ((id = queue_remove(id_queue))) in define_role_attr()
2763 free(id); in define_role_attr()
2771 while ((id = queue_remove(id_queue))) { in define_role_attr()
2772 if (!is_id_in_scope(SYM_ROLES, id)) { in define_role_attr()
2773 yyerror2("attribute %s is not within scope", id); in define_role_attr()
2774 free(id); in define_role_attr()
2777 attr = hashtab_search(policydbp->p_roles.table, id); in define_role_attr()
2780 yyerror2("role attribute %s is not declared", id); in define_role_attr()
2781 free(id); in define_role_attr()
2786 yyerror2("%s is a regular role, not an attribute", id); in define_role_attr()
2787 free(id); in define_role_attr()
2791 if ((attr = get_local_role(id, attr->s.value, 1)) == NULL) { in define_role_attr()
2807 char *id; in define_roleattribute() local
2811 while ((id = queue_remove(id_queue))) in define_roleattribute()
2812 free(id); in define_roleattribute()
2816 id = (char *)queue_remove(id_queue); in define_roleattribute()
2817 if (!id) { in define_roleattribute()
2822 if (!is_id_in_scope(SYM_ROLES, id)) { in define_roleattribute()
2823 yyerror2("role %s is not within scope", id); in define_roleattribute()
2824 free(id); in define_roleattribute()
2827 r = hashtab_search(policydbp->p_roles.table, id); in define_roleattribute()
2830 yyerror2("unknown role %s", id); in define_roleattribute()
2831 free(id); in define_roleattribute()
2834 free(id); in define_roleattribute()
2836 while ((id = queue_remove(id_queue))) { in define_roleattribute()
2837 if (!is_id_in_scope(SYM_ROLES, id)) { in define_roleattribute()
2838 yyerror2("attribute %s is not within scope", id); in define_roleattribute()
2839 free(id); in define_roleattribute()
2842 attr = hashtab_search(policydbp->p_roles.table, id); in define_roleattribute()
2845 yyerror2("role attribute %s is not declared", id); in define_roleattribute()
2846 free(id); in define_roleattribute()
2851 yyerror2("%s is a regular role, not an attribute", id); in define_roleattribute()
2852 free(id); in define_roleattribute()
2856 if ((attr = get_local_role(id, attr->s.value, 1)) == NULL) { in define_roleattribute()
3089 static int set_roles(role_set_t * set, char *id) in set_roles() argument
3093 if (strcmp(id, "*") == 0) { in set_roles()
3094 free(id); in set_roles()
3099 if (strcmp(id, "~") == 0) { in set_roles()
3100 free(id); in set_roles()
3104 if (!is_id_in_scope(SYM_ROLES, id)) { in set_roles()
3105 yyerror2("role %s is not within scope", id); in set_roles()
3106 free(id); in set_roles()
3109 r = hashtab_search(policydbp->p_roles.table, id); in set_roles()
3111 yyerror2("unknown role %s", id); in set_roles()
3112 free(id); in set_roles()
3118 free(id); in set_roles()
3121 free(id); in set_roles()
3127 char *id; in define_role_trans() local
3140 while ((id = queue_remove(id_queue))) in define_role_trans()
3141 free(id); in define_role_trans()
3142 while ((id = queue_remove(id_queue))) in define_role_trans()
3143 free(id); in define_role_trans()
3145 while ((id = queue_remove(id_queue))) in define_role_trans()
3146 free(id); in define_role_trans()
3147 id = queue_remove(id_queue); in define_role_trans()
3148 free(id); in define_role_trans()
3158 while ((id = queue_remove(id_queue))) { in define_role_trans()
3159 if (set_roles(&roles, id)) in define_role_trans()
3163 while ((id = queue_remove(id_queue))) { in define_role_trans()
3164 if (set_types(&types, id, &add, 0)) in define_role_trans()
3186 id = (char *)queue_remove(id_queue); in define_role_trans()
3187 if (!id) { in define_role_trans()
3191 if (!is_id_in_scope(SYM_ROLES, id)) { in define_role_trans()
3192 yyerror2("role %s is not within scope", id); in define_role_trans()
3193 free(id); in define_role_trans()
3196 role = hashtab_search(policydbp->p_roles.table, id); in define_role_trans()
3198 yyerror2("unknown role %s used in transition definition", id); in define_role_trans()
3199 free(id); in define_role_trans()
3204 yyerror2("the new role %s must be a regular role", id); in define_role_trans()
3205 free(id); in define_role_trans()
3208 free(id); in define_role_trans()
3281 char *id; in define_role_allow() local
3285 while ((id = queue_remove(id_queue))) in define_role_allow()
3286 free(id); in define_role_allow()
3287 while ((id = queue_remove(id_queue))) in define_role_allow()
3288 free(id); in define_role_allow()
3299 while ((id = queue_remove(id_queue))) { in define_role_allow()
3300 if (set_roles(&ra->roles, id)) { in define_role_allow()
3306 while ((id = queue_remove(id_queue))) { in define_role_allow()
3307 if (set_roles(&ra->new_roles, id)) { in define_role_allow()
3326 char *id, *name = NULL; in define_filename_trans() local
3341 while ((id = queue_remove(id_queue))) in define_filename_trans()
3342 free(id); in define_filename_trans()
3344 while ((id = queue_remove(id_queue))) in define_filename_trans()
3345 free(id); in define_filename_trans()
3347 while ((id = queue_remove(id_queue))) in define_filename_trans()
3348 free(id); in define_filename_trans()
3350 id = queue_remove(id_queue); in define_filename_trans()
3351 free(id); in define_filename_trans()
3353 id = queue_remove(id_queue); in define_filename_trans()
3354 free(id); in define_filename_trans()
3365 while ((id = queue_remove(id_queue))) { in define_filename_trans()
3366 if (set_types(&stypes, id, &add, 0)) in define_filename_trans()
3371 while ((id = queue_remove(id_queue))) { in define_filename_trans()
3372 if (set_types(&ttypes, id, &add, 0)) in define_filename_trans()
3379 id = (char *)queue_remove(id_queue); in define_filename_trans()
3380 if (!id) { in define_filename_trans()
3384 if (!is_id_in_scope(SYM_TYPES, id)) { in define_filename_trans()
3385 yyerror2("type %s is not within scope", id); in define_filename_trans()
3386 free(id); in define_filename_trans()
3389 typdatum = hashtab_search(policydbp->p_types.table, id); in define_filename_trans()
3391 yyerror2("unknown type %s used in transition definition", id); in define_filename_trans()
3392 free(id); in define_filename_trans()
3395 free(id); in define_filename_trans()
3549 char *id; in define_constraint() local
3560 while ((id = queue_remove(id_queue))) in define_constraint()
3561 free(id); in define_constraint()
3562 while ((id = queue_remove(id_queue))) in define_constraint()
3563 free(id); in define_constraint()
3607 while ((id = queue_remove(id_queue))) { in define_constraint()
3608 if (!is_id_in_scope(SYM_CLASSES, id)) { in define_constraint()
3609 yyerror2("class %s is not within scope", id); in define_constraint()
3610 free(id); in define_constraint()
3615 (hashtab_key_t) id); in define_constraint()
3617 yyerror2("class %s is not defined", id); in define_constraint()
3619 free(id); in define_constraint()
3625 free(id); in define_constraint()
3651 free(id); in define_constraint()
3654 while ((id = queue_remove(id_queue))) { in define_constraint()
3665 id); in define_constraint()
3675 id); in define_constraint()
3679 " defined", id); in define_constraint()
3680 free(id); in define_constraint()
3689 free(id); in define_constraint()
3700 char *id; in define_validatetrans() local
3708 while ((id = queue_remove(id_queue))) in define_validatetrans()
3709 free(id); in define_validatetrans()
3749 while ((id = queue_remove(id_queue))) { in define_validatetrans()
3750 if (!is_id_in_scope(SYM_CLASSES, id)) { in define_validatetrans()
3751 yyerror2("class %s is not within scope", id); in define_validatetrans()
3752 free(id); in define_validatetrans()
3757 (hashtab_key_t) id); in define_validatetrans()
3759 yyerror2("class %s is not defined", id); in define_validatetrans()
3761 free(id); in define_validatetrans()
3767 free(id); in define_validatetrans()
3788 free(id); in define_validatetrans()
3802 char *id; in define_cexpr() local
3808 while ((id = queue_remove(id_queue))) in define_cexpr()
3809 free(id); in define_cexpr()
3874 while ((id = (char *)queue_remove(id_queue))) { in define_cexpr()
3876 if (!is_id_in_scope(SYM_USERS, id)) { in define_cexpr()
3878 id); in define_cexpr()
3887 id); in define_cexpr()
3889 yyerror2("unknown user %s", id); in define_cexpr()
3895 if (!is_id_in_scope(SYM_ROLES, id)) { in define_cexpr()
3897 id); in define_cexpr()
3906 id); in define_cexpr()
3908 yyerror2("unknown role %s", id); in define_cexpr()
3914 if (set_types(expr->type_names, id, &add, 0)) { in define_cexpr()
3930 free(id); in define_cexpr()
4046 char *id; in define_cond_expr() local
4051 while ((id = queue_remove(id_queue))) { in define_cond_expr()
4052 free(id); in define_cond_expr()
4117 id = (char *)queue_remove(id_queue); in define_cond_expr()
4118 if (!id) { in define_cond_expr()
4120 free(id); in define_cond_expr()
4124 if (!is_id_in_scope(SYM_BOOLS, id)) { in define_cond_expr()
4125 yyerror2("boolean %s is not within scope", id); in define_cond_expr()
4126 free(id); in define_cond_expr()
4133 (hashtab_key_t) id); in define_cond_expr()
4136 id); in define_cond_expr()
4138 free(id); in define_cond_expr()
4142 free(id); in define_cond_expr()
4151 static int set_user_roles(role_set_t * set, char *id) in set_user_roles() argument
4157 if (strcmp(id, "*") == 0) { in set_user_roles()
4158 free(id); in set_user_roles()
4163 if (strcmp(id, "~") == 0) { in set_user_roles()
4164 free(id); in set_user_roles()
4169 if (!is_id_in_scope(SYM_ROLES, id)) { in set_user_roles()
4170 yyerror2("role %s is not within scope", id); in set_user_roles()
4171 free(id); in set_user_roles()
4174 r = hashtab_search(policydbp->p_roles.table, id); in set_user_roles()
4176 yyerror2("unknown role %s", id); in set_user_roles()
4177 free(id); in set_user_roles()
4187 free(id); in set_user_roles()
4194 static int parse_categories(char *id, level_datum_t * levdatum, ebitmap_t * cats) in parse_categories() argument
4199 if (id_has_dot(id)) { in parse_categories()
4200 char *id_start = id; in parse_categories()
4201 char *id_end = strchr(id, '.'); in parse_categories()
4227 (hashtab_key_t) id); in parse_categories()
4229 yyerror2("unknown category %s", id); in parse_categories()
4254 static int parse_semantic_categories(char *id, level_datum_t * levdatum __attribute__ ((unused)), in parse_semantic_categories() argument
4261 if (id_has_dot(id)) { in parse_semantic_categories()
4262 char *id_start = id; in parse_semantic_categories()
4263 char *id_end = strchr(id, '.'); in parse_semantic_categories()
4285 (hashtab_key_t) id); in parse_semantic_categories()
4287 yyerror2("unknown category %s", id); in parse_semantic_categories()
4311 char *id; in define_user() local
4317 while ((id = queue_remove(id_queue))) in define_user()
4318 free(id); in define_user()
4320 while ((id = queue_remove(id_queue))) in define_user()
4321 free(id); in define_user()
4322 id = queue_remove(id_queue); in define_user()
4323 free(id); in define_user()
4325 while ((id = queue_remove(id_queue))) { in define_user()
4326 free(id); in define_user()
4328 id = queue_remove(id_queue); in define_user()
4329 if (!id) in define_user()
4331 free(id); in define_user()
4341 while ((id = queue_remove(id_queue))) { in define_user()
4342 if (set_user_roles(&usrdatum->roles, id)) in define_user()
4347 id = queue_remove(id_queue); in define_user()
4348 if (!id) { in define_user()
4355 (hashtab_key_t) id); in define_user()
4358 " level definition", id); in define_user()
4359 free(id); in define_user()
4362 free(id); in define_user()
4366 while ((id = queue_remove(id_queue))) { in define_user()
4367 if (parse_semantic_categories(id, levdatum, in define_user()
4369 free(id); in define_user()
4372 free(id); in define_user()
4375 id = queue_remove(id_queue); in define_user()
4380 (hashtab_key_t) id); in define_user()
4383 " range definition", id); in define_user()
4384 free(id); in define_user()
4387 free(id); in define_user()
4391 while ((id = queue_remove(id_queue))) { in define_user()
4392 if (parse_semantic_categories(id, levdatum, in define_user()
4394 free(id); in define_user()
4397 free(id); in define_user()
4400 id = queue_remove(id_queue); in define_user()
4401 if (!id) in define_user()
4418 char *id; in parse_security_context() local
4426 id = queue_remove(id_queue); in parse_security_context()
4427 free(id); /* user */ in parse_security_context()
4428 id = queue_remove(id_queue); in parse_security_context()
4429 free(id); /* role */ in parse_security_context()
4430 id = queue_remove(id_queue); in parse_security_context()
4431 free(id); /* type */ in parse_security_context()
4433 id = queue_remove(id_queue); in parse_security_context()
4434 free(id); in parse_security_context()
4436 while ((id = queue_remove(id_queue))) { in parse_security_context()
4437 free(id); in parse_security_context()
4439 id = queue_remove(id_queue); in parse_security_context()
4440 if (!id) in parse_security_context()
4442 free(id); in parse_security_context()
4457 id = queue_remove(id_queue); in parse_security_context()
4458 if (!id) { in parse_security_context()
4462 if (!is_id_in_scope(SYM_USERS, id)) { in parse_security_context()
4463 yyerror2("user %s is not within scope", id); in parse_security_context()
4464 free(id); in parse_security_context()
4468 (hashtab_key_t) id); in parse_security_context()
4470 yyerror2("user %s is not defined", id); in parse_security_context()
4471 free(id); in parse_security_context()
4477 free(id); in parse_security_context()
4480 id = (char *)queue_remove(id_queue); in parse_security_context()
4481 if (!id) { in parse_security_context()
4485 if (!is_id_in_scope(SYM_ROLES, id)) { in parse_security_context()
4486 yyerror2("role %s is not within scope", id); in parse_security_context()
4487 free(id); in parse_security_context()
4491 (hashtab_key_t) id); in parse_security_context()
4493 yyerror2("role %s is not defined", id); in parse_security_context()
4494 free(id); in parse_security_context()
4500 free(id); in parse_security_context()
4503 id = (char *)queue_remove(id_queue); in parse_security_context()
4504 if (!id) { in parse_security_context()
4508 if (!is_id_in_scope(SYM_TYPES, id)) { in parse_security_context()
4509 yyerror2("type %s is not within scope", id); in parse_security_context()
4510 free(id); in parse_security_context()
4514 (hashtab_key_t) id); in parse_security_context()
4516 yyerror2("type %s is not defined or is an attribute", id); in parse_security_context()
4517 free(id); in parse_security_context()
4523 free(id); in parse_security_context()
4527 id = (char *)queue_head(id_queue); in parse_security_context()
4528 if (!id) { in parse_security_context()
4534 id = (char *)queue_remove(id_queue); in parse_security_context()
4538 (hashtab_key_t) id); in parse_security_context()
4540 yyerror2("Sensitivity %s is not defined", id); in parse_security_context()
4541 free(id); in parse_security_context()
4544 free(id); in parse_security_context()
4548 while ((id = queue_remove(id_queue))) { in parse_security_context()
4549 if (parse_categories(id, levdatum, in parse_security_context()
4551 free(id); in parse_security_context()
4554 free(id); in parse_security_context()
4558 id = (char *)queue_remove(id_queue); in parse_security_context()
4559 if (!id) in parse_security_context()
4588 char *id; in define_initial_sid_context() local
4592 id = (char *)queue_remove(id_queue); in define_initial_sid_context()
4593 free(id); in define_initial_sid_context()
4598 id = (char *)queue_remove(id_queue); in define_initial_sid_context()
4599 if (!id) { in define_initial_sid_context()
4605 if (!strcmp(id, c->u.name)) in define_initial_sid_context()
4610 yyerror2("SID %s is not defined", id); in define_initial_sid_context()
4611 free(id); in define_initial_sid_context()
4615 yyerror2("The context for SID %s is multiply defined", id); in define_initial_sid_context()
4616 free(id); in define_initial_sid_context()
4620 free(id); in define_initial_sid_context()
4692 char *id; in define_pirq_context() local
4700 id = (char *) queue_remove(id_queue); in define_pirq_context()
4701 free(id); in define_pirq_context()
4746 char *id; in define_iomem_context() local
4754 id = (char *)queue_remove(id_queue); in define_iomem_context()
4755 free(id); in define_iomem_context()
4810 char *id; in define_ioport_context() local
4818 id = (char *)queue_remove(id_queue); in define_ioport_context()
4819 free(id); in define_ioport_context()
4874 char *id; in define_pcidevice_context() local
4882 id = (char *) queue_remove(id_queue); in define_pcidevice_context()
4883 free(id); in define_pcidevice_context()
4985 char *id; in define_port_context() local
4993 id = (char *)queue_remove(id_queue); in define_port_context()
4994 free(id); in define_port_context()
5006 id = (char *)queue_remove(id_queue); in define_port_context()
5007 if (!id) { in define_port_context()
5011 if ((strcmp(id, "tcp") == 0) || (strcmp(id, "TCP") == 0)) { in define_port_context()
5013 } else if ((strcmp(id, "udp") == 0) || (strcmp(id, "UDP") == 0)) { in define_port_context()
5015 } else if ((strcmp(id, "dccp") == 0) || (strcmp(id, "DCCP") == 0)) { in define_port_context()
5017 } else if ((strcmp(id, "sctp") == 0) || (strcmp(id, "SCTP") == 0)) { in define_port_context()
5020 yyerror2("unrecognized protocol %s", id); in define_port_context()
5048 yyerror2("duplicate portcon entry for %s %d-%d ", id, in define_port_context()
5054 "entry for %d-%d", id, low, high, low2, high2); in define_port_context()
5064 free(id); in define_port_context()
5068 free(id); in define_port_context()
5077 char *id; in define_ibpkey_context() local
5086 id = (char *)queue_remove(id_queue); in define_ibpkey_context()
5087 free(id); in define_ibpkey_context()
5099 id = queue_remove(id_queue); in define_ibpkey_context()
5100 if (!id) { in define_ibpkey_context()
5106 rc = inet_pton(AF_INET6, id, &subnet_prefix); in define_ibpkey_context()
5107 free(id); in define_ibpkey_context()
5182 char *id; in define_ibendport_context() local
5191 id = (char *)queue_remove(id_queue); in define_ibendport_context()
5192 free(id); in define_ibendport_context()
5319 char *id; in define_ipv4_node_context() local
5336 id = queue_remove(id_queue); in define_ipv4_node_context()
5337 if (!id) { in define_ipv4_node_context()
5343 rc = inet_pton(AF_INET, id, &addr); in define_ipv4_node_context()
5344 free(id); in define_ipv4_node_context()
5352 id = queue_remove(id_queue); in define_ipv4_node_context()
5353 if (!id) { in define_ipv4_node_context()
5359 rc = inet_pton(AF_INET, id, &mask); in define_ipv4_node_context()
5360 free(id); in define_ipv4_node_context()
5405 char *id; in define_ipv6_node_context() local
5422 id = queue_remove(id_queue); in define_ipv6_node_context()
5423 if (!id) { in define_ipv6_node_context()
5429 rc = inet_pton(AF_INET6, id, &addr); in define_ipv6_node_context()
5430 free(id); in define_ipv6_node_context()
5438 id = queue_remove(id_queue); in define_ipv6_node_context()
5439 if (!id) { in define_ipv6_node_context()
5445 rc = inet_pton(AF_INET6, id, &mask); in define_ipv6_node_context()
5446 free(id); in define_ipv6_node_context()
5679 char *id; in define_range_trans() local
5691 while ((id = queue_remove(id_queue))) in define_range_trans()
5692 free(id); in define_range_trans()
5693 while ((id = queue_remove(id_queue))) in define_range_trans()
5694 free(id); in define_range_trans()
5696 while ((id = queue_remove(id_queue))) in define_range_trans()
5697 free(id); in define_range_trans()
5698 id = queue_remove(id_queue); in define_range_trans()
5699 free(id); in define_range_trans()
5701 while ((id = queue_remove(id_queue))) { in define_range_trans()
5702 free(id); in define_range_trans()
5704 id = queue_remove(id_queue); in define_range_trans()
5705 if (!id) in define_range_trans()
5707 free(id); in define_range_trans()
5719 while ((id = queue_remove(id_queue))) { in define_range_trans()
5720 if (set_types(&rule->stypes, id, &add, 0)) in define_range_trans()
5724 while ((id = queue_remove(id_queue))) { in define_range_trans()
5725 if (set_types(&rule->ttypes, id, &add, 0)) in define_range_trans()
5747 id = (char *)queue_remove(id_queue); in define_range_trans()
5748 if (!id) { in define_range_trans()
5753 levdatum = hashtab_search(policydbp->p_levels.table, id); in define_range_trans()
5756 "definition", id); in define_range_trans()
5757 free(id); in define_range_trans()
5760 free(id); in define_range_trans()
5764 while ((id = queue_remove(id_queue))) { in define_range_trans()
5765 if (parse_semantic_categories(id, levdatum, in define_range_trans()
5767 free(id); in define_range_trans()
5770 free(id); in define_range_trans()
5773 id = (char *)queue_remove(id_queue); in define_range_trans()
5774 if (!id) in define_range_trans()