All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libsepol: fix missing double quotes in typetransition CIL rule
@ 2022-08-25 13:27 Juraj Marcin
  2022-08-29 18:49 ` James Carter
  0 siblings, 1 reply; 3+ messages in thread
From: Juraj Marcin @ 2022-08-25 13:27 UTC (permalink / raw)
  To: selinux

CIL Reference Guide defines typetransition rule with double quotes
around object name, but those are not present in the format string.

This patch fixes this issue, so the CIL output produced by
sepol_kernel_policydb_to_cil() is in the correct format.

Signed-off-by: Juraj Marcin <juraj@jurajmarcin.com>
---
 libsepol/src/kernel_to_cil.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libsepol/src/kernel_to_cil.c b/libsepol/src/kernel_to_cil.c
index 5a1336a3..ad4121d5 100644
--- a/libsepol/src/kernel_to_cil.c
+++ b/libsepol/src/kernel_to_cil.c
@@ -1894,7 +1894,7 @@ static int map_filename_trans_to_str(hashtab_key_t key, void *data, void *arg)
 		ebitmap_for_each_positive_bit(&datum->stypes, node, bit) {
 			src = pdb->p_type_val_to_name[bit];
 			rc = strs_create_and_add(strs,
-						 "(typetransition %s %s %s %s %s)",
+						 "(typetransition %s %s %s \"%s\" %s)",
 						 5, src, tgt, class, filename, new);
 			if (rc)
 				return rc;
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] libsepol: fix missing double quotes in typetransition CIL rule
  2022-08-25 13:27 [PATCH] libsepol: fix missing double quotes in typetransition CIL rule Juraj Marcin
@ 2022-08-29 18:49 ` James Carter
  2022-09-01 19:57   ` James Carter
  0 siblings, 1 reply; 3+ messages in thread
From: James Carter @ 2022-08-29 18:49 UTC (permalink / raw)
  To: Juraj Marcin; +Cc: selinux

On Thu, Aug 25, 2022 at 9:45 AM Juraj Marcin <juraj@jurajmarcin.com> wrote:
>
> CIL Reference Guide defines typetransition rule with double quotes
> around object name, but those are not present in the format string.
>
> This patch fixes this issue, so the CIL output produced by
> sepol_kernel_policydb_to_cil() is in the correct format.
>
> Signed-off-by: Juraj Marcin <juraj@jurajmarcin.com>

Despite what the CIL Reference Guide says, the quotes are not
required, but it is best practice to use them.

 Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  libsepol/src/kernel_to_cil.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libsepol/src/kernel_to_cil.c b/libsepol/src/kernel_to_cil.c
> index 5a1336a3..ad4121d5 100644
> --- a/libsepol/src/kernel_to_cil.c
> +++ b/libsepol/src/kernel_to_cil.c
> @@ -1894,7 +1894,7 @@ static int map_filename_trans_to_str(hashtab_key_t key, void *data, void *arg)
>                 ebitmap_for_each_positive_bit(&datum->stypes, node, bit) {
>                         src = pdb->p_type_val_to_name[bit];
>                         rc = strs_create_and_add(strs,
> -                                                "(typetransition %s %s %s %s %s)",
> +                                                "(typetransition %s %s %s \"%s\" %s)",
>                                                  5, src, tgt, class, filename, new);
>                         if (rc)
>                                 return rc;
> --
> 2.37.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libsepol: fix missing double quotes in typetransition CIL rule
  2022-08-29 18:49 ` James Carter
@ 2022-09-01 19:57   ` James Carter
  0 siblings, 0 replies; 3+ messages in thread
From: James Carter @ 2022-09-01 19:57 UTC (permalink / raw)
  To: Juraj Marcin; +Cc: selinux

On Mon, Aug 29, 2022 at 2:49 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Thu, Aug 25, 2022 at 9:45 AM Juraj Marcin <juraj@jurajmarcin.com> wrote:
> >
> > CIL Reference Guide defines typetransition rule with double quotes
> > around object name, but those are not present in the format string.
> >
> > This patch fixes this issue, so the CIL output produced by
> > sepol_kernel_policydb_to_cil() is in the correct format.
> >
> > Signed-off-by: Juraj Marcin <juraj@jurajmarcin.com>
>
> Despite what the CIL Reference Guide says, the quotes are not
> required, but it is best practice to use them.
>
>  Acked-by: James Carter <jwcart2@gmail.com>
>

Merged.
Thanks,
Jim


> > ---
> >  libsepol/src/kernel_to_cil.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libsepol/src/kernel_to_cil.c b/libsepol/src/kernel_to_cil.c
> > index 5a1336a3..ad4121d5 100644
> > --- a/libsepol/src/kernel_to_cil.c
> > +++ b/libsepol/src/kernel_to_cil.c
> > @@ -1894,7 +1894,7 @@ static int map_filename_trans_to_str(hashtab_key_t key, void *data, void *arg)
> >                 ebitmap_for_each_positive_bit(&datum->stypes, node, bit) {
> >                         src = pdb->p_type_val_to_name[bit];
> >                         rc = strs_create_and_add(strs,
> > -                                                "(typetransition %s %s %s %s %s)",
> > +                                                "(typetransition %s %s %s \"%s\" %s)",
> >                                                  5, src, tgt, class, filename, new);
> >                         if (rc)
> >                                 return rc;
> > --
> > 2.37.1
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-01 19:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25 13:27 [PATCH] libsepol: fix missing double quotes in typetransition CIL rule Juraj Marcin
2022-08-29 18:49 ` James Carter
2022-09-01 19:57   ` James Carter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.