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

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