diff mbox series

libsepol/cil: Allow validatetrans rules to be resolved

Message ID 20190521112206.5403-1-richard_c_haines@btinternet.com (mailing list archive)
State Accepted
Headers show
Series libsepol/cil: Allow validatetrans rules to be resolved | expand

Commit Message

Richard Haines May 21, 2019, 11:22 a.m. UTC
When validatetrans rule is in CIL policy it errors with:
u3, r3, and t3 can only be used with mlsvalidatetrans rules

Will now resolve these examples:
(validatetrans binder (and (and (eq t1 t1_t) (eq t2 t2_t)) (eq t3 t3_t)))
(mlsvalidatetrans file (and (and (eq t1 t1_t) (eq t2 t2_t))
    (and (eq t3 t3_t) (domby h1 h2))))

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
---
 libsepol/cil/src/cil_verify.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

James Carter May 21, 2019, 5:59 p.m. UTC | #1
On 5/21/19 7:22 AM, Richard Haines wrote:
> When validatetrans rule is in CIL policy it errors with:
> u3, r3, and t3 can only be used with mlsvalidatetrans rules
> 
> Will now resolve these examples:
> (validatetrans binder (and (and (eq t1 t1_t) (eq t2 t2_t)) (eq t3 t3_t)))
> (mlsvalidatetrans file (and (and (eq t1 t1_t) (eq t2 t2_t))
>      (and (eq t3 t3_t) (domby h1 h2))))
> 
> Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>

Acked-by: James Carter <jwcart2@tycho.nsa.gov>

> ---
>   libsepol/cil/src/cil_verify.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libsepol/cil/src/cil_verify.c b/libsepol/cil/src/cil_verify.c
> index 1036d73..1a21cf4 100644
> --- a/libsepol/cil/src/cil_verify.c
> +++ b/libsepol/cil/src/cil_verify.c
> @@ -221,8 +221,8 @@ int cil_verify_constraint_leaf_expr_syntax(enum cil_flavor l_flavor, enum cil_fl
>   			cil_log(CIL_ERR, "l1, l2, h1, and h2 cannot be used on the left side with a string or list on the right side\n");
>   			goto exit;
>   		} else if (l_flavor == CIL_CONS_U3 || l_flavor == CIL_CONS_R3 || l_flavor == CIL_CONS_T3) {
> -			if (expr_flavor != CIL_MLSVALIDATETRANS) {
> -				cil_log(CIL_ERR, "u3, r3, and t3 can only be used with mlsvalidatetrans rules\n");
> +			if (expr_flavor != CIL_VALIDATETRANS && expr_flavor != CIL_MLSVALIDATETRANS) {
> +				cil_log(CIL_ERR, "u3, r3, and t3 can only be used with (mls)validatetrans rules\n");
>   				goto exit;
>   			}
>   		}
>
James Carter May 23, 2019, 2:05 p.m. UTC | #2
On 5/21/19 1:59 PM, jwcart2 wrote:
> On 5/21/19 7:22 AM, Richard Haines wrote:
>> When validatetrans rule is in CIL policy it errors with:
>> u3, r3, and t3 can only be used with mlsvalidatetrans rules
>>
>> Will now resolve these examples:
>> (validatetrans binder (and (and (eq t1 t1_t) (eq t2 t2_t)) (eq t3 t3_t)))
>> (mlsvalidatetrans file (and (and (eq t1 t1_t) (eq t2 t2_t))
>>      (and (eq t3 t3_t) (domby h1 h2))))
>>
>> Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
> 
> Acked-by: James Carter <jwcart2@tycho.nsa.gov>
> 

Applied.
Thanks,
Jim

>> ---
>>   libsepol/cil/src/cil_verify.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libsepol/cil/src/cil_verify.c b/libsepol/cil/src/cil_verify.c
>> index 1036d73..1a21cf4 100644
>> --- a/libsepol/cil/src/cil_verify.c
>> +++ b/libsepol/cil/src/cil_verify.c
>> @@ -221,8 +221,8 @@ int cil_verify_constraint_leaf_expr_syntax(enum cil_flavor 
>> l_flavor, enum cil_fl
>>               cil_log(CIL_ERR, "l1, l2, h1, and h2 cannot be used on the left 
>> side with a string or list on the right side\n");
>>               goto exit;
>>           } else if (l_flavor == CIL_CONS_U3 || l_flavor == CIL_CONS_R3 || 
>> l_flavor == CIL_CONS_T3) {
>> -            if (expr_flavor != CIL_MLSVALIDATETRANS) {
>> -                cil_log(CIL_ERR, "u3, r3, and t3 can only be used with 
>> mlsvalidatetrans rules\n");
>> +            if (expr_flavor != CIL_VALIDATETRANS && expr_flavor != 
>> CIL_MLSVALIDATETRANS) {
>> +                cil_log(CIL_ERR, "u3, r3, and t3 can only be used with 
>> (mls)validatetrans rules\n");
>>                   goto exit;
>>               }
>>           }
>>
> 
>
diff mbox series

Patch

diff --git a/libsepol/cil/src/cil_verify.c b/libsepol/cil/src/cil_verify.c
index 1036d73..1a21cf4 100644
--- a/libsepol/cil/src/cil_verify.c
+++ b/libsepol/cil/src/cil_verify.c
@@ -221,8 +221,8 @@  int cil_verify_constraint_leaf_expr_syntax(enum cil_flavor l_flavor, enum cil_fl
 			cil_log(CIL_ERR, "l1, l2, h1, and h2 cannot be used on the left side with a string or list on the right side\n");
 			goto exit;
 		} else if (l_flavor == CIL_CONS_U3 || l_flavor == CIL_CONS_R3 || l_flavor == CIL_CONS_T3) {
-			if (expr_flavor != CIL_MLSVALIDATETRANS) {
-				cil_log(CIL_ERR, "u3, r3, and t3 can only be used with mlsvalidatetrans rules\n");
+			if (expr_flavor != CIL_VALIDATETRANS && expr_flavor != CIL_MLSVALIDATETRANS) {
+				cil_log(CIL_ERR, "u3, r3, and t3 can only be used with (mls)validatetrans rules\n");
 				goto exit;
 			}
 		}