diff mbox series

checkpolicy: mention class name on invalid permission

Message ID 20220426105914.15817-1-cgzones@googlemail.com (mailing list archive)
State Accepted
Commit 5645f803e1c3
Headers show
Series checkpolicy: mention class name on invalid permission | expand

Commit Message

Christian Göttsche April 26, 2022, 10:59 a.m. UTC
When a permission for a constraint statement cannot be found also
mention the related class name.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 checkpolicy/policy_define.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Petr Lautrbach May 4, 2022, 4:55 p.m. UTC | #1
Christian Göttsche <cgzones@googlemail.com> writes:

> When a permission for a constraint statement cannot be found also
> mention the related class name.
>
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

Acked-by: Petr Lautrbach <plautrba@redhat.com>


> ---
>  checkpolicy/policy_define.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
> index 16b78346..a4c24115 100644
> --- a/checkpolicy/policy_define.c
> +++ b/checkpolicy/policy_define.c
> @@ -3627,7 +3627,7 @@ int define_constraint(constraint_expr_t * expr)
>  				}
>  				if (!perdatum) {
>  					yyerror2("permission %s is not"
> -						 " defined", id);
> +						 " defined for class %s", id, policydbp->p_class_val_to_name[i]);
>  					free(id);
>  					ebitmap_destroy(&classmap);
>  					return -1;
> -- 
> 2.36.0
Petr Lautrbach May 4, 2022, 5:07 p.m. UTC | #2
Petr Lautrbach <plautrba@redhat.com> writes:

> Christian Göttsche <cgzones@googlemail.com> writes:
>
>> When a permission for a constraint statement cannot be found also
>> mention the related class name.
>>
>> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> Acked-by: Petr Lautrbach <plautrba@redhat.com>
>

Merged, thanks!


>
>> ---
>>  checkpolicy/policy_define.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
>> index 16b78346..a4c24115 100644
>> --- a/checkpolicy/policy_define.c
>> +++ b/checkpolicy/policy_define.c
>> @@ -3627,7 +3627,7 @@ int define_constraint(constraint_expr_t * expr)
>>  				}
>>  				if (!perdatum) {
>>  					yyerror2("permission %s is not"
>> -						 " defined", id);
>> +						 " defined for class %s", id, policydbp->p_class_val_to_name[i]);
>>  					free(id);
>>  					ebitmap_destroy(&classmap);
>>  					return -1;
>> -- 
>> 2.36.0
diff mbox series

Patch

diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
index 16b78346..a4c24115 100644
--- a/checkpolicy/policy_define.c
+++ b/checkpolicy/policy_define.c
@@ -3627,7 +3627,7 @@  int define_constraint(constraint_expr_t * expr)
 				}
 				if (!perdatum) {
 					yyerror2("permission %s is not"
-						 " defined", id);
+						 " defined for class %s", id, policydbp->p_class_val_to_name[i]);
 					free(id);
 					ebitmap_destroy(&classmap);
 					return -1;