All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] python/semaange: fix moduleRecords.customized()
@ 2019-09-27 14:42 Vit Mojzis
  2019-09-28 10:10 ` Nicolas Iooss
  0 siblings, 1 reply; 4+ messages in thread
From: Vit Mojzis @ 2019-09-27 14:42 UTC (permalink / raw)
  To: selinux

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>
---
 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):
-- 
2.21.0


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

* Re: [PATCH] python/semaange: fix moduleRecords.customized()
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Iooss @ 2019-09-28 10:10 UTC (permalink / raw)
  To: Vit Mojzis; +Cc: SElinux list

On Fri, Sep 27, 2019 at 4:42 PM Vit Mojzis <vmojzis@redhat.com> 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>

This looks good to me, but there is a misspelling in the subject of
the patch: semaange -> semanage.

Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>

Thanks!
Nicolas

> ---
>  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):
> --
> 2.21.0
>


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

* [PATCH] python/semanage: fix moduleRecords.customized()
  2019-09-28 10:10 ` Nicolas Iooss
@ 2019-09-30  7:49   ` Vit Mojzis
  2019-10-01 18:28     ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: Vit Mojzis @ 2019-09-30  7:49 UTC (permalink / raw)
  To: selinux

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>
---
 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):
-- 
2.21.0


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

* Re: [PATCH] python/semanage: fix moduleRecords.customized()
  2019-09-30  7:49   ` [PATCH] python/semanage: " Vit Mojzis
@ 2019-10-01 18:28     ` Stephen Smalley
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Smalley @ 2019-10-01 18:28 UTC (permalink / raw)
  To: Vit Mojzis, selinux

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):
> 


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

end of thread, other threads:[~2019-10-01 18:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.