libsepol/cil: Do not check flavor when checking for duplicate parameters

A parameter of a macro was only considered to be a duplicate if it
matched both the name and flavor of another parameter. While it is
true that CIL is able to differentiate between those two parameters,
there is no reason to use the same name for two macro parameters and
it is better to return an error for what is probably an error.

Remove the check of the flavors when checking for duplicate parameters.

Signed-off-by: James Carter <jwcart2@gmail.com>
Acked-by: Ondrej Mosnacek <omosnace@redhat.com>
This commit is contained in:
James Carter 2020-03-04 16:28:31 -05:00 committed by Ondrej Mosnacek
parent 04c42b9d70
commit 879d222c4f

View File

@ -5304,11 +5304,9 @@ int cil_gen_macro(struct cil_db *db, struct cil_tree_node *parse_current, struct
struct cil_list_item *curr_param;
cil_list_for_each(curr_param, macro->params) {
if (param->str == ((struct cil_param*)curr_param->data)->str) {
if (param->flavor == ((struct cil_param*)curr_param->data)->flavor) {
cil_log(CIL_ERR, "Duplicate parameter\n");
cil_destroy_param(param);
goto exit;
}
cil_log(CIL_ERR, "Duplicate parameter\n");
cil_destroy_param(param);
goto exit;
}
}