selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Vit Mojzis <vmojzis@redhat.com>, selinux@vger.kernel.org
Subject: Re: [PATCH] python/semanage: fix moduleRecords.customized()
Date: Tue, 1 Oct 2019 14:28:49 -0400	[thread overview]
Message-ID: <83f5cfdc-a0a8-47f8-0a6d-2889a4d2c13f@tycho.nsa.gov> (raw)
In-Reply-To: <20190930074904.25219-1-vmojzis@redhat.com>

On 9/30/19 3:49 AM, Vit Mojzis wrote:
> Return value of "customized" has to be iterable.
> 
> Fixes:
>     "semanage export" with no modules in the system (eg. monolithic policy)
>     crashes:
> 
>     Traceback (most recent call last):
>       File "/usr/sbin/semanage", line 970, in <module>
>         do_parser()
>       File "/usr/sbin/semanage", line 949, in do_parser
>         args.func(args)
>       File "/usr/sbin/semanage", line 771, in handleExport
>         for c in OBJECT.customized():
>     TypeError: 'NoneType' object is not iterable
> 
> Signed-off-by: Vit Mojzis <vmojzis@redhat.com>

Thanks, both patches applied.

> ---
>   python/semanage/seobject.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
> index 5e9e3eb5..f4c29854 100644
> --- a/python/semanage/seobject.py
> +++ b/python/semanage/seobject.py
> @@ -380,7 +380,7 @@ class moduleRecords(semanageRecords):
>       def customized(self):
>           all = self.get_all()
>           if len(all) == 0:
> -            return
> +            return []
>           return ["-d %s" % x[0] for x in [t for t in all if t[1] == 0]]
>   
>       def list(self, heading=1, locallist=0):
> 


      reply	other threads:[~2019-10-01 18:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-27 14:42 [PATCH] python/semaange: fix moduleRecords.customized() Vit Mojzis
2019-09-28 10:10 ` Nicolas Iooss
2019-09-30  7:49   ` [PATCH] python/semanage: " Vit Mojzis
2019-10-01 18:28     ` Stephen Smalley [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83f5cfdc-a0a8-47f8-0a6d-2889a4d2c13f@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    --cc=vmojzis@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).