mirror of
https://github.com/topjohnwu/selinux.git
synced 2024-12-02 16:46:18 +00:00
libsepol/cil: Use the macro FLAVOR() whenever possible
In cil_symtab.h, the macro FLAVOR() is defined. It refers to the flavor of the first node in the list of nodes that declare the datum. (The flavors of every node should be the same.) While the macro was used in many places, it was not used everywhere that it could be. Change all the remaining places to use FLAVOR(). Signed-off-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
parent
2aac859a95
commit
d16a1e4647
@ -44,8 +44,8 @@ struct cil_args_find {
|
||||
|
||||
static int cil_type_match_any(struct cil_symtab_datum *d1, struct cil_symtab_datum *d2)
|
||||
{
|
||||
enum cil_flavor f1 = ((struct cil_tree_node*)d1->nodes->head->data)->flavor;
|
||||
enum cil_flavor f2 = ((struct cil_tree_node*)d2->nodes->head->data)->flavor;
|
||||
enum cil_flavor f1 = FLAVOR(d1);
|
||||
enum cil_flavor f2 = FLAVOR(d2);
|
||||
|
||||
if (f1 != CIL_TYPEATTRIBUTE && f2 != CIL_TYPEATTRIBUTE) {
|
||||
struct cil_type *t1 = (struct cil_type *)d1;
|
||||
@ -81,8 +81,8 @@ static int cil_type_match_any(struct cil_symtab_datum *d1, struct cil_symtab_dat
|
||||
static int cil_type_matches(ebitmap_t *matches, struct cil_symtab_datum *d1, struct cil_symtab_datum *d2)
|
||||
{
|
||||
int rc = SEPOL_OK;
|
||||
enum cil_flavor f1 = ((struct cil_tree_node*)d1->nodes->head->data)->flavor;
|
||||
enum cil_flavor f2 = ((struct cil_tree_node*)d2->nodes->head->data)->flavor;
|
||||
enum cil_flavor f1 = FLAVOR(d1);
|
||||
enum cil_flavor f2 = FLAVOR(d2);
|
||||
|
||||
if (f1 != CIL_TYPEATTRIBUTE && f2 != CIL_TYPEATTRIBUTE) {
|
||||
struct cil_type *t1 = (struct cil_type *)d1;
|
||||
|
@ -1482,7 +1482,7 @@ static void __mark_neverallow_attrs(struct cil_list *expr_list)
|
||||
|
||||
cil_list_for_each(curr, expr_list) {
|
||||
if (curr->flavor == CIL_DATUM) {
|
||||
if (NODE(curr->data)->flavor == CIL_TYPEATTRIBUTE) {
|
||||
if (FLAVOR(curr->data) == CIL_TYPEATTRIBUTE) {
|
||||
struct cil_typeattribute *attr = curr->data;
|
||||
if (strstr(DATUM(attr)->name, TYPEATTR_INFIX)) {
|
||||
__mark_neverallow_attrs(attr->expr_list);
|
||||
|
@ -505,7 +505,7 @@ int cil_resolve_aliasactual(struct cil_tree_node *current, void *extra_args, enu
|
||||
if (rc != SEPOL_OK) {
|
||||
goto exit;
|
||||
}
|
||||
if (NODE(alias_datum)->flavor != alias_flavor) {
|
||||
if (FLAVOR(alias_datum) != alias_flavor) {
|
||||
cil_log(CIL_ERR, "%s is not an alias\n",alias_datum->name);
|
||||
rc = SEPOL_ERR;
|
||||
goto exit;
|
||||
@ -516,7 +516,7 @@ int cil_resolve_aliasactual(struct cil_tree_node *current, void *extra_args, enu
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (NODE(actual_datum)->flavor != flavor && NODE(actual_datum)->flavor != alias_flavor) {
|
||||
if (FLAVOR(actual_datum) != flavor && FLAVOR(actual_datum) != alias_flavor) {
|
||||
cil_log(CIL_ERR, "%s is a %s, but aliases a %s\n", alias_datum->name, cil_node_to_string(NODE(alias_datum)), cil_node_to_string(NODE(actual_datum)));
|
||||
rc = SEPOL_ERR;
|
||||
goto exit;
|
||||
@ -2573,7 +2573,7 @@ int cil_resolve_bounds(struct cil_tree_node *current, void *extra_args, enum cil
|
||||
if (rc != SEPOL_OK) {
|
||||
goto exit;
|
||||
}
|
||||
if (NODE(parent_datum)->flavor == attr_flavor) {
|
||||
if (FLAVOR(parent_datum) == attr_flavor) {
|
||||
cil_log(CIL_ERR, "Bounds parent %s is an attribute\n", bounds->parent_str);
|
||||
rc = SEPOL_ERR;
|
||||
goto exit;
|
||||
@ -2584,7 +2584,7 @@ int cil_resolve_bounds(struct cil_tree_node *current, void *extra_args, enum cil
|
||||
if (rc != SEPOL_OK) {
|
||||
goto exit;
|
||||
}
|
||||
if (NODE(child_datum)->flavor == attr_flavor) {
|
||||
if (FLAVOR(child_datum) == attr_flavor) {
|
||||
cil_log(CIL_ERR, "Bounds child %s is an attribute\n", bounds->child_str);
|
||||
rc = SEPOL_ERR;
|
||||
goto exit;
|
||||
|
Loading…
Reference in New Issue
Block a user