Blame SOURCES/0029-python-semanage-fix-moduleRecords.customized.patch

c33c08
From 7cc31c4799dd94ed516a39d853744bd1ffb6dc69 Mon Sep 17 00:00:00 2001
c33c08
From: Vit Mojzis <vmojzis@redhat.com>
c33c08
Date: Mon, 30 Sep 2019 09:49:04 +0200
c33c08
Subject: [PATCH] python/semanage: fix moduleRecords.customized()
c33c08
c33c08
Return value of "customized" has to be iterable.
c33c08
c33c08
Fixes:
c33c08
   "semanage export" with no modules in the system (eg. monolithic policy)
c33c08
   crashes:
c33c08
c33c08
   Traceback (most recent call last):
c33c08
     File "/usr/sbin/semanage", line 970, in <module>
c33c08
       do_parser()
c33c08
     File "/usr/sbin/semanage", line 949, in do_parser
c33c08
       args.func(args)
c33c08
     File "/usr/sbin/semanage", line 771, in handleExport
c33c08
       for c in OBJECT.customized():
c33c08
   TypeError: 'NoneType' object is not iterable
c33c08
c33c08
Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
c33c08
---
c33c08
 python/semanage/seobject.py | 2 +-
c33c08
 1 file changed, 1 insertion(+), 1 deletion(-)
c33c08
c33c08
diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
c33c08
index 3959abc8..16edacaa 100644
c33c08
--- a/python/semanage/seobject.py
c33c08
+++ b/python/semanage/seobject.py
c33c08
@@ -380,7 +380,7 @@ class moduleRecords(semanageRecords):
c33c08
     def customized(self):
c33c08
         all = self.get_all()
c33c08
         if len(all) == 0:
c33c08
-            return
c33c08
+            return []
c33c08
         return ["-d %s" % x[0] for x in [t for t in all if t[1] == 0]]
c33c08
 
c33c08
     def list(self, heading=1, locallist=0):
c33c08
-- 
c33c08
2.21.0
c33c08