Re: [PATCH v2] sepolgen-ifgen: allow M4 escaped filenames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 17, 2024 at 2:34 PM James Carter <jwcart2@xxxxxxxxx> wrote:
>
> On Tue, Aug 27, 2024 at 7:32 AM Petr Lautrbach <lautrbach@xxxxxxxxxx> wrote:
> >
> > When a file name in type transition rule used in an interface is same as
> > a keyword, it needs to be M4 escaped so that the keyword is not expanded
> > by M4, e.g.
> >
> > -       filetrans_pattern($1, virt_var_run_t, virtinterfaced_var_run_t, dir, "interface")
> > +       filetrans_pattern($1, virt_var_run_t, virtinterfaced_var_run_t, dir, ``"interface"'')
> >
> > But sepolgen-ifgen could not parse such string:
> >
> >     # sepolgen-ifgen
> >     Illegal character '`'
> >
> > This change allows M4 escaping inside quoted strings and fixed described
> > problem.
> >
> > https://bugzilla.redhat.com/show_bug.cgi?id=2254206
> >
> > Signed-off-by: Petr Lautrbach <lautrbach@xxxxxxxxxx>
>
> Sorry, I don't know how I missed this patch earlier.
>
> Acked-by: James Carter <jwcart2@xxxxxxxxx>
>

Merged.
Thanks,
Jim

> > ---
> >
> > change to v1:
> >
> > - use ``"..."'' instead of "``..''" - sugested in https://github.com/SELinuxProject/selint/pull/291 by
> >   @cgzones
> >
> > - controls right number of openning and closing quotes
> >
> >  python/sepolgen/src/sepolgen/refparser.py | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/python/sepolgen/src/sepolgen/refparser.py b/python/sepolgen/src/sepolgen/refparser.py
> > index e261d3f78f87..c8a3eb54d679 100644
> > --- a/python/sepolgen/src/sepolgen/refparser.py
> > +++ b/python/sepolgen/src/sepolgen/refparser.py
> > @@ -486,7 +486,7 @@ def p_interface_call_param(p):
> >                              | nested_id_set
> >                              | TRUE
> >                              | FALSE
> > -                            | FILENAME
> > +                            | quoted_filename
> >      '''
> >      # Intentionally let single identifiers pass through
> >      # List means set, non-list identifier
> > @@ -1027,6 +1027,11 @@ def p_optional_semi(p):
> >                     | empty'''
> >      pass
> >
> > +def p_quoted_filename(p):
> > +    '''quoted_filename : TICK quoted_filename SQUOTE
> > +                       | FILENAME
> > +    '''
> > +    p[0] = p[1]
> >
> >  #
> >  # Interface to the parser
> > --
> > 2.46.0
> >
> >





[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux