Re: [PATCH] python: replace aliases with corresponding type names

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

 



On Fri, Nov 9, 2018 at 9:53 AM Vit Mojzis <vmojzis@xxxxxxxxxx> wrote:
>
> On 05. 11. 18 21:51, Nicolas Iooss wrote:
> > On Tue, Oct 30, 2018 at 4:27 PM Vit Mojzis <vmojzis@xxxxxxxxxx> wrote:
> >> Aliases are not used in the selinux database. When user enters a type
> >> alias as a parameter it should be converted to the corresponding type
> >> in order to be processed correctly further in the userspace logic.
> >>
> >> Fixes e.g.:
> >>
> >> \#sepolicy transition -s phpfpm_t
> >> /* where phpfpm_t is a type alias of httpd_t */
> >>
> >> Traceback (most recent call last):
> >>    File "/usr/bin/sepolicy", line 691, in <module>
> >>      args.func(args)
> >>    File "/usr/bin/sepolicy", line 458, in transition
> >>      mytrans = setrans(args.source, args.target)
> >>    File "/usr/lib/python3.6/site-packages/sepolicy/transition.py", line 48, in __init__
> >>      self._process(self.source)
> >>    File "/usr/lib/python3.6/site-packages/sepolicy/transition.py", line 54, in _process
> >>      trans = _get_trans(source)
> >>    File "/usr/lib/python3.6/site-packages/sepolicy/transition.py", line 36, in _get_trans
> >>      src_list = [src] + list(filter(lambda x: x['name'] == src, sepolicy.get_all_types_info()))[0]['attributes']
> >> IndexError: list index out of range
> >> ---
> >>   python/semanage/seobject.py          | 43 ++++++++++++++++++++--------
> >>   python/sepolicy/sepolicy.py          | 11 ++++---
> >>   python/sepolicy/sepolicy/__init__.py | 14 ++++-----
> >>   3 files changed, 45 insertions(+), 23 deletions(-)
> >>
> > [...]
> >> diff --git a/python/sepolicy/sepolicy/__init__.py b/python/sepolicy/sepolicy/__init__.py
> >> index b18683e4..7db43957 100644
> >> --- a/python/sepolicy/sepolicy/__init__.py
> >> +++ b/python/sepolicy/sepolicy/__init__.py
> >> @@ -172,7 +172,7 @@ def info(setype, name=None):
> >>           results = list(q.results())
> >>
> >>           if name and len(results) < 1:
> >> -            # type not found, try alias
> >> +            #type not found, try alias
> >>               q.name = None
> >>               q.alias = name
> >>               results = list(q.results())
> > Hi, your patch looks good to me, but the comments you are using do not
> > follow PEP-8 (https://www.python.org/dev/peps/pep-0008/#block-comments)
> > and raise warnings in some linters that I am using. For example,
> > flake8 reports:
> >
> > python/sepolicy/sepolicy/__init__.py:172:13: E265 block comment should
> > start with '# '
> > python/sepolicy/sepolicy/__init__.py:1072:9: E265 block comment should
> > start with '# '
> >
> > I would like to apply the patch with the spaces added between "#" and
> > the comment line. Does it suits you?
>
>
> Sure, whatever needs fixing.
>
> Thank you :)

All right, I merged this patch. Thanks!
Nicolas




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

  Powered by Linux