From patchwork Tue Sep 27 15:51:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miroslav Grepl X-Patchwork-Id: 9352143 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 29FD760757 for ; Tue, 27 Sep 2016 15:54:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C412291F2 for ; Tue, 27 Sep 2016 15:54:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10C982928A; Tue, 27 Sep 2016 15:54:10 +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=-1.9 required=2.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received: from emsm-gh1-uea10.nsa.gov (emsm-gh1-uea10.nsa.gov [8.44.101.8]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6142B291F2 for ; Tue, 27 Sep 2016 15:54:08 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.30,405,1470700800"; d="scan'208";a="18012698" IronPort-PHdr: =?us-ascii?q?9a23=3AEo8Vrxde9BrZxbhbuzvU6jzjlGMj4u6mDksu8pMi?= =?us-ascii?q?zoh2WeGdxc6+bB7h7PlgxGXEQZ/co6odzbGH6ea5BCdQvd6oizMrSNR0TRgLiM?= =?us-ascii?q?EbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpQAbFhi3Dwdp?= =?us-ascii?q?POO9QteU1JXtkbnvsM2PKyxzxxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP?= =?us-ascii?q?5Xz247bXianhL7+9vitMU7q3cYhuglv/Jkfe26Ov1gDO8QMDNzKG0x5cv2pTHf?= =?us-ascii?q?XACP4T0aSWxQnR1WUCbf6xSve5brtTD+v/Q19zOXJcm+GbU7Qzm6649xRRPogT?= =?us-ascii?q?tBPDk8pjKEwvdshb5W9Ury7yd0xJTZNcTMbPc=3D?= X-IPAS-Result: =?us-ascii?q?A2H+BAB8lepX/wHyM5BdHAEBBAEBCgEBGAEFAQsBgxQBAQE?= =?us-ascii?q?BAR6BU7p/JYdlTAEBAQEBAQEBAgECWyeCMgQDEwWCEQIEAQI3FCAOAwkBARcII?= =?us-ascii?q?QgIAwEtFREOCwUYBIgsvnEBJIY3hiKCRgIRAWiFEgWONItCj2AKiX2FbQKQaFS?= =?us-ascii?q?FCHCEKQ8XYYEnAQEB?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea10.nsa.gov with ESMTP; 27 Sep 2016 15:54:05 +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 u8RFs3TK016563; Tue, 27 Sep 2016 11:54:04 -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 u8RFpOT5270064 for ; Tue, 27 Sep 2016 11:51:24 -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 u8RFpLrP016437 for ; Tue, 27 Sep 2016 11:51:24 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1A1AQBQlOpXhxy3hNFdHAEBBAEBCgEBgz8BAQEBAYFxpTKRRIQVhh4CgV5MAQIBAQEBAQITAQEBCgsJCRmFEQIBA3kQIDFXGYhNvmUBAQEHJ4Y3hiKCRnyFEgWONItCj2AKj2oCkGiDf4FdPDSEKYIuAQEB X-IPAS-Result: A1A1AQBQlOpXhxy3hNFdHAEBBAEBCgEBgz8BAQEBAYFxpTKRRIQVhh4CgV5MAQIBAQEBAQITAQEBCgsJCRmFEQIBA3kQIDFXGYhNvmUBAQEHJ4Y3hiKCRnyFEgWONItCj2AKj2oCkGiDf4FdPDSEKYIuAQEB X-IronPort-AV: E=Sophos;i="5.30,405,1470715200"; d="scan'208";a="5731415" Received: from emsm-gh1-uea11.corp.nsa.gov (HELO emsm-gh1-uea11.nsa.gov) ([10.208.41.37]) by goalie.tycho.ncsc.mil with ESMTP; 27 Sep 2016 11:51:24 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3AbD4ythyblGDcl0vXCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?0ekVIJqq85mqBkHD//Il1AaPBtSBrasZwLqK+4nbGkU4qa6bt34DdJEeHzQksu?= =?us-ascii?q?4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2WVTerzWI4CIIHV2nbEwu?= =?us-ascii?q?d76zQ9OZ35j//tvx0qWbWx9Piju5bOE6BzSNhiKViPMrh5B/IL060BrDrygAUe?= =?us-ascii?q?1XwWR1OQDbxE6ktY/jtKJkpj9dv/Mn6t5oTbTxf6N+S6dRSjshLTMb/sru4DzC?= =?us-ascii?q?VwyU4nICGkoMnwJMS1zA4wv3RpPZqCb2tuNhniKdOJulHvgPRT2+4vIzG1fTgy?= =?us-ascii?q?AdOmth/Q=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0F1AQD5lOpXhxy3hNFdHAEBBAEBCgEBG?= =?us-ascii?q?AYMgxUBAQEBAYFxpTKRRIQVhh4CgV5MAQEBAQEBAQECAQIQAQEBCgsJCRkvgjI?= =?us-ascii?q?YghgCAQN5ECAxVxmITb5lAQEBBwIBJIY3hiKCRnyFEgWONItCj2AKj2oCkGiDf?= =?us-ascii?q?4FdPDSEKYIuAQEB?= X-IPAS-Result: =?us-ascii?q?A0F1AQD5lOpXhxy3hNFdHAEBBAEBCgEBGAYMgxUBAQEBAYF?= =?us-ascii?q?xpTKRRIQVhh4CgV5MAQEBAQEBAQECAQIQAQEBCgsJCRkvgjIYghgCAQN5ECAxV?= =?us-ascii?q?xmITb5lAQEBBwIBJIY3hiKCRnyFEgWONItCj2AKj2oCkGiDf4FdPDSEKYIuAQE?= =?us-ascii?q?B?= X-IronPort-AV: E=Sophos;i="5.30,405,1470700800"; d="scan'208";a="19590800" Received: from mx1.redhat.com ([209.132.183.28]) by emsm-gh1-uea11.nsa.gov with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2016 15:51:23 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B6D29ADAF9 for ; Tue, 27 Sep 2016 15:51:22 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-200-19.brq.redhat.com [10.40.200.19]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8RFpHlk023781; Tue, 27 Sep 2016 11:51:21 -0400 From: Miroslav Grepl To: selinux@tycho.nsa.gov Subject: [PATCH] libsemanage: Do not always print a module name warning Date: Tue, 27 Sep 2016 17:51:13 +0200 Message-Id: <20160927155113.19322-2-mgrepl@redhat.com> In-Reply-To: <20160927155113.19322-1-mgrepl@redhat.com> References: <20160927155113.19322-1-mgrepl@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 27 Sep 2016 15:51:22 +0000 (UTC) X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP From: Miroslav Grep 7a728e46 commit supposed to add a warning when a module name is different than a filename, but this warning is printed always. This commit fixes it. Fixes: $ semodule -X 400 -i testmod.pp Warning: SELinux userspace will refer to the module from testmod.pp as testmod rather than testmod Signed-off-by: Miroslav Grepl --- libsemanage/src/direct_api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c index 4320f43..3719cb1 100644 --- a/libsemanage/src/direct_api.c +++ b/libsemanage/src/direct_api.c @@ -1619,7 +1619,9 @@ static int semanage_direct_install_file(semanage_handle_t * sh, if ((retval = parse_module_headers(sh, data, data_len, &module_name, &version)) != 0) goto cleanup; - fprintf(stderr, "Warning: SELinux userspace will refer to the module from %s as %s rather than %s\n", install_filename, module_name, filename); + if (strcmp(module_name, filename) != 0) + fprintf(stderr, "Warning: SELinux userspace will refer to the module from %s as %s rather than %s\n", install_filename, module_name, filename); + free(version); } retval = semanage_direct_install(sh, data, data_len, module_name, lang_ext);