python/semanage: Fix export of ibendport entries

Replace nonexistent switch "-x" by "-z" (entry name).
Fix invalid index (the dictionary key is a 2-tuple).
Add MLS/MCS range (present in all entries).

Fixes:
 #semanage ibendport -E
  File "/usr/sbin/semanage", line 1049, in <module>
    do_parser()
  File "/usr/sbin/semanage", line 1028, in do_parser
    args.func(args)
  File "/usr/sbin/semanage", line 605, in handleIbendport
    for i in OBJECT.customized():
  File "/usr/lib64/python2.7/site-packages/seobject/__init__.py", line 1806, in customized
    l.append("-a -t %s -x %s %s" % (ddict[k][0], k[2], k[0]))
  IndexError: tuple index out of range

Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
This commit is contained in:
Vit Mojzis 2017-11-10 16:28:44 +01:00 committed by Petr Lautrbach
parent ebbf42d408
commit 2927532b1c

View File

@ -1788,7 +1788,7 @@ class ibendportRecords(semanageRecords):
keys = ddict.keys() keys = ddict.keys()
keys.sort() keys.sort()
for k in keys: for k in keys:
l.append("-a -t %s -x %s %s" % (ddict[k][0], k[2], k[0])) l.append("-a -t %s -r %s -z %s %s" % (ddict[k][0], ddict[k][1], k[1], k[0]))
return l return l
def list(self, heading=1, locallist=0): def list(self, heading=1, locallist=0):