All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <plautrba@redhat.com>
To: selinux@tycho.nsa.gov
Subject: [PATCH 10/19] sepolicy: Adapt to new the semodule list output
Date: Wed,  3 May 2017 12:30:27 +0200	[thread overview]
Message-ID: <20170503103036.17514-11-plautrba@redhat.com> (raw)
In-Reply-To: <20170503103036.17514-1-plautrba@redhat.com>

semodule in policycoreutils-2.4 changed the list format. With this
patch, org.selinux.semodule_list uses 'semodule --list=full' and the
code using this was adapted to the new format.

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1281309

Fixes:
File "/usr/lib64/python3.4/site-packages/sepolicy/gui.py", line 670, in lockdown_init
  self.enable_unconfined_button.set_active(not self.module_dict["unconfined"]["Disabled"])
KeyError: 'unconfined'

Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
 dbus/selinux_server.py          | 4 ++--
 gui/polgengui.py                | 2 +-
 python/sepolicy/sepolicy/gui.py | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/dbus/selinux_server.py b/dbus/selinux_server.py
index 8bd1fe5b..aae8b5fa 100644
--- a/dbus/selinux_server.py
+++ b/dbus/selinux_server.py
@@ -46,13 +46,13 @@ class selinux_server(slip.dbus.service.Object):
         return buf
 
     #
-    # The semodule_list method will return the output of semodule -l, using the customized polkit,
+    # The semodule_list method will return the output of semodule --list=full, using the customized polkit,
     # since this is a readonly behaviour
     #
     @slip.dbus.polkit.require_auth("org.selinux.semodule_list")
     @dbus.service.method("org.selinux", in_signature='', out_signature='s')
     def semodule_list(self):
-        p = Popen(["/usr/sbin/semodule", "-l"], stdout=PIPE, stderr=PIPE)
+        p = Popen(["/usr/sbin/semodule", "--list=full"], stdout=PIPE, stderr=PIPE)
         buf = p.stdout.read()
         output = p.communicate()
         if p.returncode and p.returncode != 0:
diff --git a/gui/polgengui.py b/gui/polgengui.py
index 1d262a95..7460cce2 100644
--- a/gui/polgengui.py
+++ b/gui/polgengui.py
@@ -679,7 +679,7 @@ class childWindow:
                     entry.set_text("")
                     return False
             if name in self.all_modules:
-                if self.verify(_("Module %s.pp already loaded in current policy.\nDo you want to continue?") % name, _("Verify Name")) == gtk.RESPONSE_NO:
+                if self.verify(_("Module %s already loaded in current policy.\nDo you want to continue?") % name, _("Verify Name")) == gtk.RESPONSE_NO:
                     entry.set_text("")
                     return False
 
diff --git a/python/sepolicy/sepolicy/gui.py b/python/sepolicy/sepolicy/gui.py
index c9dd4c1c..e361aa1c 100644
--- a/python/sepolicy/sepolicy/gui.py
+++ b/python/sepolicy/sepolicy/gui.py
@@ -673,9 +673,9 @@ class SELinuxGui():
         self.module_dict = {}
         for m in self.dbus.semodule_list().split("\n"):
             mod = m.split()
-            if len(mod) < 2:
+            if len(mod) < 3:
                 continue
-            self.module_dict[mod[0]] = {"version": mod[1], "Disabled": (len(mod) > 2)}
+            self.module_dict[mod[1]] = { "priority": mod[0], "Disabled" : (len(mod) > 3) }
 
         self.enable_unconfined_button.set_active(not self.module_dict["unconfined"]["Disabled"])
         self.enable_permissive_button.set_active(not self.module_dict["permissivedomains"]["Disabled"])
-- 
2.12.2

  parent reply	other threads:[~2017-05-03 10:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-03 10:30 Several sepolicy fixes from Fedora Petr Lautrbach
2017-05-03 10:30 ` [PATCH 01/19] policycoreutils/sepolicy: Add documentation for MCS separated domains Petr Lautrbach
2017-05-03 10:30 ` [PATCH 02/19] sepolicy: Fix spelling mistakes in commands in generated manpages Petr Lautrbach
2017-05-03 10:30 ` [PATCH 03/19] sepolicy: Add manpages for typealiased types Petr Lautrbach
2017-05-03 10:30 ` [PATCH 04/19] sepolicy: Move svirt man page out of libvirt into its own Petr Lautrbach
2017-05-03 10:30 ` [PATCH 05/19] policycoreutils/sepolicy: boolean.png is in help/ Petr Lautrbach
2017-05-03 10:30 ` [PATCH 06/19] Fix up generation of application policy Petr Lautrbach
2017-05-03 10:30 ` [PATCH 07/19] sepolicy: ptrace should be a part of deny_ptrace boolean in TEMPLATETYPE_admin Petr Lautrbach
2017-05-03 10:30 ` [PATCH 08/19] sepolicy: We should be creating _exec interfaces when we create the domtrans interface Petr Lautrbach
2017-05-03 10:30 ` [PATCH 09/19] Fix typo in executable.py template Petr Lautrbach
2017-05-03 10:30 ` Petr Lautrbach [this message]
2017-05-03 10:30 ` [PATCH 11/19] sepolicy: Don't return filter(), use [ ] notation instead Petr Lautrbach
2017-05-03 10:30 ` [PATCH 12/19] sepolicy: Simplify policy types detection Petr Lautrbach
2017-05-03 10:30 ` [PATCH 13/19] sepolicy/generate.py: Fix string formatting Petr Lautrbach
2017-05-03 10:30 ` [PATCH 14/19] policycoreutils/sepolicy: Define our own cmp() Petr Lautrbach
2017-05-03 10:30 ` [PATCH 15/19] dbus: Use text streams in selinux_server.py Petr Lautrbach
2017-05-03 10:30 ` [PATCH 16/19] sepolicy: setools.*Query wants a list in ruletype Petr Lautrbach
2017-05-03 10:30 ` [PATCH 17/19] sepolicy: Fix several issues in 'sepolicy manpage -a' Petr Lautrbach
2017-05-03 10:30 ` [PATCH 18/19] sepolicy: info() should provide attributes for a TYPE Petr Lautrbach
2017-05-03 10:30 ` [PATCH 19/19] sepolicy/gui: Update text strings to use better gettext templates Petr Lautrbach
2017-05-05 17:06   ` Stephen Smalley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170503103036.17514-11-plautrba@redhat.com \
    --to=plautrba@redhat.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.