From patchwork Sun Oct 1 16:15:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Iooss X-Patchwork-Id: 9979771 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EFA6A60365 for ; Sun, 1 Oct 2017 16:17:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB5A828750 for ; Sun, 1 Oct 2017 16:17:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF3C7288A8; Sun, 1 Oct 2017 16:17:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from ucol19pa09.eemsg.mail.mil (ucol19pa09.eemsg.mail.mil [214.24.24.82]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31BA628750 for ; Sun, 1 Oct 2017 16:17:24 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.42,464,1500940800"; d="scan'208";a="538954350" Received: from emsm-gh1-uea10.ncsc.mil ([214.29.60.2]) by ucol19pa09.eemsg.mail.mil with ESMTP/TLS/AES256-SHA; 01 Oct 2017 16:17:23 +0000 Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by EMSM-GH1-UEA10.NCSC.MIL with ESMTP; 01 Oct 2017 16:17:22 +0000 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id v91GHHRo018169; Sun, 1 Oct 2017 12:17:19 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id v91GHGWN049795 for ; Sun, 1 Oct 2017 12:17:16 -0400 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id v91GHGO0018167 for ; Sun, 1 Oct 2017 12:17:16 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A1AVAwDVE9FZf3QbGNZcHQYMgzMoZ24nj?= =?us-ascii?q?wyObJo+EwiJVVcBAgEBAQEBAhMBAQsWhXYGgQlRVxmIXoFSAwEBp3GEEYdPgy1?= =?us-ascii?q?HgTuBUYFqiHiFKAWRQI9ygi6FMIx6giFbkBqKE4tBgTmBZTIhMoUbDHmBUHSJT?= =?us-ascii?q?wEBAQ?= X-IPAS-Result: =?us-ascii?q?A1AVAwDVE9FZf3QbGNZcHQYMgzMoZ24njwyObJo+EwiJVVc?= =?us-ascii?q?BAgEBAQEBAhMBAQsWhXYGgQlRVxmIXoFSAwEBp3GEEYdPgy1HgTuBUYFqiHiFK?= =?us-ascii?q?AWRQI9ygi6FMIx6giFbkBqKE4tBgTmBZTIhMoUbDHmBUHSJTwEBAQ?= X-IronPort-AV: E=Sophos;i="5.42,464,1500955200"; d="scan'208";a="68897" Received: from emsm-gh1-uea10.ncsc.mil ([214.29.60.34]) by goalie.tycho.ncsc.mil with ESMTP; 01 Oct 2017 12:17:13 -0400 Received: from upbd19pa12.eemsg.mail.mil ([214.24.27.116]) by EMSM-GH1-UEA10.NCSC.MIL with ESMTP; 01 Oct 2017 16:17:13 +0000 X-EEMSG-check-005: 0 X-EEMSG-check-006: 000-001;6d4a1d93-0eb4-4ae7-abd5-74f4d8c50282 Authentication-Results: UPDC3CPA03.eemsg.mail.mil; dkim=neutral (message not signed) header.i=none X-EEMSG-check-008: 425766774|UPDC3CPA03_EEMSG_MP19.csd.disa.mil X-EEMSG-SBRS: 3.5 X-EEMSG-ORIG-IP: 129.104.30.34 X-EEMSG-check-002: true X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CtAQALFNFZhyIeaIFcHQEFAQsBgzKBD24njwyObJo+EwiJVUMUAQIBAQEBAQEBEwEBAQoLCQgoL4UZBoEJUVcZiF6BUgQBp3GEEYdPgy1HgTuBUYFqiHiFKAWRQI9ygi6FMIx6giFbkBqKE4tBgTk2gS8yITKFGwyCSXSJTwEBAQ X-IPAS-Result: A0CtAQALFNFZhyIeaIFcHQEFAQsBgzKBD24njwyObJo+EwiJVUMUAQIBAQEBAQEBEwEBAQoLCQgoL4UZBoEJUVcZiF6BUgQBp3GEEYdPgy1HgTuBUYFqiHiFKAWRQI9ygi6FMIx6giFbkBqKE4tBgTk2gS8yITKFGwyCSXSJTwEBAQ Received: from mx1.polytechnique.org ([129.104.30.34]) by UPDC3CPA03.eemsg.mail.mil with ESMTP; 01 Oct 2017 16:17:10 +0000 Received: from localhost.localdomain (32.206.133.77.rev.sfr.net [77.133.206.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id 06866561235 for ; Sun, 1 Oct 2017 18:15:39 +0200 (CEST) From: Nicolas Iooss To: selinux@tycho.nsa.gov Date: Sun, 1 Oct 2017 18:15:15 +0200 Message-Id: <20171001161517.16407-2-nicolas.iooss@m4x.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171001161517.16407-1-nicolas.iooss@m4x.org> References: <20171001161517.16407-1-nicolas.iooss@m4x.org> X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Sun Oct 1 18:15:39 2017 +0200 (CEST)) X-Org-Mail: nicolas.iooss.2010@polytechnique.org Subject: [PATCH 2/4] gui: fix parsing of "semodule -lfull" in tab Modules X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP The output of "semodule -lfull" changed from "module version" to "priority module kind". Update system-config-selinux to use this new format in its tab "Policy Module". Signed-off-by: Nicolas Iooss --- gui/modulesPage.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/gui/modulesPage.py b/gui/modulesPage.py index c7fde9ea1ef8..34c5d9e3c488 100644 --- a/gui/modulesPage.py +++ b/gui/modulesPage.py @@ -58,7 +58,8 @@ class modulesPage(semanagePage): self.module_filter.connect("activate", self.filter_changed) self.audit_enabled = False - self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING) + self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, + GObject.TYPE_STRING) self.view.set_model(self.store) self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Module Name"), Gtk.CellRendererText(), text=0) @@ -66,7 +67,7 @@ class modulesPage(semanagePage): col.set_resizable(True) self.view.append_column(col) self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) - col = Gtk.TreeViewColumn(_("Version"), Gtk.CellRendererText(), text=1) + col = Gtk.TreeViewColumn(_("Priority"), Gtk.CellRendererText(), text=1) self.enable_audit_button = xml.get_object("enableAuditButton") self.enable_audit_button.connect("clicked", self.enable_audit) self.new_button = xml.get_object("newModuleButton") @@ -74,6 +75,11 @@ class modulesPage(semanagePage): col.set_sort_column_id(1) col.set_resizable(True) self.view.append_column(col) + self.store.set_sort_column_id(2, Gtk.SortType.ASCENDING) + col = Gtk.TreeViewColumn(_("Kind"), Gtk.CellRendererText(), text=2) + col.set_sort_column_id(2) + col.set_resizable(True) + self.view.append_column(col) self.store.set_sort_func(1, self.sort_int, "") status, self.policy_type = selinux.selinux_getpolicytype() @@ -95,16 +101,17 @@ class modulesPage(semanagePage): self.filter = filter self.store.clear() try: - fd = Popen("semodule -l", shell=True, stdout=PIPE).stdout + fd = Popen("semodule -lfull", shell=True, stdout=PIPE).stdout l = fd.readlines() fd.close() for i in l: - module, ver, newline = i.split('\t') - if not (self.match(module, filter) or self.match(ver, filter)): + priority, module, kind = i.decode('utf-8').split() + if not (self.match(module, filter) or self.match(priority, filter)): continue iter = self.store.append() self.store.set_value(iter, 0, module.strip()) - self.store.set_value(iter, 1, ver.strip()) + self.store.set_value(iter, 1, priority.strip()) + self.store.set_value(iter, 2, kind.strip()) except: pass self.view.get_selection().select_path((0,))