-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This patch looks good to me. acked. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7dHVcACgkQrlYvE4MpobOjzQCg0E79DfUmXqlv34u0HKYwFJkM 0jYAoNzY5UqVxCVDkEOvVQ8+TX8qFOHK =kuWE -----END PGP SIGNATURE-----
>From d6730016a2167e4a0aa947c7c81752e913176427 Mon Sep 17 00:00:00 2001 From: Dan Walsh <dwalsh@xxxxxxxxxx> Date: Tue, 29 Nov 2011 15:56:20 -0500 Subject: [PATCH 36/48] policycoreutils: semanage: Make sure semanage fcontext -l -C prints even if local keys are not defined Signed-off-by: Eric Paris <eparis@xxxxxxxxxx> --- policycoreutils/semanage/seobject.py | 25 +++++++++++-------------- 1 files changed, 11 insertions(+), 14 deletions(-) diff --git a/policycoreutils/semanage/seobject.py b/policycoreutils/semanage/seobject.py index 5e70fae..61ea3cf 100644 --- a/policycoreutils/semanage/seobject.py +++ b/policycoreutils/semanage/seobject.py @@ -1836,21 +1836,18 @@ class fcontextRecords(semanageRecords): def list(self, heading = 1, locallist = 0 ): fcon_dict = self.get_all(locallist) keys = fcon_dict.keys() - if len(keys) == 0: - return - keys.sort() - - if heading: - print "%-50s %-18s %s\n" % (_("SELinux fcontext"), _("type"), _("Context")) - for k in keys: - if fcon_dict[k]: - if is_mls_enabled: - print "%-50s %-18s %s:%s:%s:%s " % (k[0], k[1], fcon_dict[k][0], fcon_dict[k][1], fcon_dict[k][2], translate(fcon_dict[k][3],False)) + if len(keys) != 0: + keys.sort() + if heading: + print "%-50s %-18s %s\n" % (_("SELinux fcontext"), _("type"), _("Context")) + for k in keys: + if fcon_dict[k]: + if is_mls_enabled: + print "%-50s %-18s %s:%s:%s:%s " % (k[0], k[1], fcon_dict[k][0], fcon_dict[k][1], fcon_dict[k][2], translate(fcon_dict[k][3],False)) + else: + print "%-50s %-18s %s:%s:%s " % (k[0], k[1], fcon_dict[k][0], fcon_dict[k][1],fcon_dict[k][2]) else: - print "%-50s %-18s %s:%s:%s " % (k[0], k[1], fcon_dict[k][0], fcon_dict[k][1],fcon_dict[k][2]) - else: - print "%-50s %-18s <<None>>" % (k[0], k[1]) - + print "%-50s %-18s <<None>>" % (k[0], k[1]) if len(self.equiv_dist): if not locallist: -- 1.7.7.4