From patchwork Wed Oct 4 15:36:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vit Mojzis X-Patchwork-Id: 9985085 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 2489D6028E for ; Wed, 4 Oct 2017 16:07:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 157E828B4D for ; Wed, 4 Oct 2017 16:07:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A30728B50; Wed, 4 Oct 2017 16:07:17 +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 USFB19PA13.eemsg.mail.mil (uphb19pa10.eemsg.mail.mil [214.24.26.84]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3434728B4D for ; Wed, 4 Oct 2017 16:07:15 +0000 (UTC) Received: from emsm-gh1-uea11.ncsc.mil ([214.29.60.3]) by USFB19PA13.eemsg.mail.mil with ESMTP/TLS/AES256-SHA; 04 Oct 2017 16:07:15 +0000 Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.NCSC.MIL with ESMTP; 04 Oct 2017 16:05:30 +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 v94G3uXH001210; Wed, 4 Oct 2017 12:04:21 -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 v94G3tS1126824 for ; Wed, 4 Oct 2017 12:03:55 -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 v94G3t9J001208 for ; Wed, 4 Oct 2017 12:03:55 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A1DhBAAbBdVZWyIbGNZdHQEFAQsBgzIoA?= =?us-ascii?q?yNBbiePDY50mjQKExCFGAKEW1cBAgEBAQEBAgYaFYV3BoEJUUMUGYhegVIDDag?= =?us-ascii?q?Ciy4BCyaDLYICgVGGY4Fhgh6FCCAFoTKHXox6DYJviF2HPUiVDIE5gWVTJRVJh?= =?us-ascii?q?U+BUHQBiUMBAQE?= X-IPAS-Result: =?us-ascii?q?A1DhBAAbBdVZWyIbGNZdHQEFAQsBgzIoAyNBbiePDY50mjQ?= =?us-ascii?q?KExCFGAKEW1cBAgEBAQEBAgYaFYV3BoEJUUMUGYhegVIDDagCiy4BCyaDLYICg?= =?us-ascii?q?VGGY4Fhgh6FCCAFoTKHXox6DYJviF2HPUiVDIE5gWVTJRVJhU+BUHQBiUMBAQE?= X-IronPort-AV: E=Sophos;i="5.42,477,1500955200"; d="scan'208";a="72152" Received: from emsm-gh1-uea11.ncsc.mil ([214.29.60.35]) by goalie.tycho.ncsc.mil with ESMTP; 04 Oct 2017 12:03:51 -0400 Received: from upbd19pa01.eemsg.mail.mil ([214.24.27.34]) by emsm-gh1-uea11.NCSC.MIL with ESMTP; 04 Oct 2017 16:03:43 +0000 X-EEMSG-check-005: 0 X-EEMSG-check-006: 000-001;09d710e6-e173-4b93-b1c2-537ed6616e57 Authentication-Results: UPDC3CPA04.eemsg.mail.mil; dkim=neutral (message not signed) header.i=none X-EEMSG-check-008: 192564697|UPDC3CPA04_EEMSG_MP20.csd.disa.mil X-EEMSG-check-001: false X-EEMSG-SBRS: 3.5 X-EEMSG-ORIG-IP: 209.132.183.28 X-EEMSG-check-002: true X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BRAACrBNVZhxy3hNFdg2IoAWZuJ48NjnSYIoISChOFKAKEWz8YAwEBAQEBAQETAQEBCA0JCCgvhRkGgQlRVxmIXoFSqBOLYIMtggKBUYZjiQcgBaEyh16Meg2Cb4hdhz1IlQyBOR+BRlMlFUmFKoF1PjeJQwEBAQ X-IPAS-Result: A0BRAACrBNVZhxy3hNFdg2IoAWZuJ48NjnSYIoISChOFKAKEWz8YAwEBAQEBAQETAQEBCA0JCCgvhRkGgQlRVxmIXoFSqBOLYIMtggKBUYZjiQcgBaEyh16Meg2Cb4hdhz1IlQyBOR+BRlMlFUmFKoF1PjeJQwEBAQ Received: from mx1.redhat.com ([209.132.183.28]) by UPDC3CPA04.eemsg.mail.mil with ESMTP; 04 Oct 2017 15:36:26 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C35179705 for ; Wed, 4 Oct 2017 15:36:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1C35179705 Received: from Thinkpad_450.redhat.com (unknown [10.40.205.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BAAE6FDC7 for ; Wed, 4 Oct 2017 15:36:16 +0000 (UTC) From: Vit Mojzis To: selinux@tycho.nsa.gov Date: Wed, 4 Oct 2017 17:36:04 +0200 Message-Id: <20171004153604.5817-3-vmojzis@redhat.com> In-Reply-To: <20171004153604.5817-1-vmojzis@redhat.com> References: <1dcea489-7584-e7a3-aa50-99a974440734@redhat.com> <20171004153604.5817-1-vmojzis@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 04 Oct 2017 15:36:18 +0000 (UTC) Subject: [PATCH 3/3] python/semanage: Enable listing file_contexts.homedirs 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 Include entries from file_contexts.homedirs when listing file contexts via "semanage fcontext -l" "semanage fcontext -l" so far ignored content of file_contexts.homedirs file, which is confusing for users (more specific rules may be ignored in favor of rules unseen to the user since file_contexts.homedirs has higher priority than file_contexts). Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1409813 Signed-off-by: Vit Mojzis Reviewed-by: Stephen Smalley --- python/semanage/seobject.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py index 70fd192..1385315 100644 --- a/python/semanage/seobject.py +++ b/python/semanage/seobject.py @@ -2566,10 +2566,15 @@ class fcontextRecords(semanageRecords): if rc < 0: raise ValueError(_("Could not list file contexts")) + (rc, fchomedirs) = semanage_fcontext_list_homedirs(self.sh) + if rc < 0: + raise ValueError(_("Could not list file contexts for home directories")) + (rc, fclocal) = semanage_fcontext_list_local(self.sh) if rc < 0: raise ValueError(_("Could not list local file contexts")) + self.flist += fchomedirs self.flist += fclocal ddict = {}