From patchwork Fri Sep 16 13:08:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janis Danisevskis X-Patchwork-Id: 9335855 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 DB0896077F for ; Fri, 16 Sep 2016 13:59:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEAE829FC3 for ; Fri, 16 Sep 2016 13:59:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C387D29FC5; Fri, 16 Sep 2016 13:59:56 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from emsm-gh1-uea11.nsa.gov (emsm-gh1-uea11.nsa.gov [8.44.101.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F223529FC3 for ; Fri, 16 Sep 2016 13:59:55 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.30,344,1470700800"; d="scan'208";a="19307035" IronPort-PHdr: =?us-ascii?q?9a23=3A1TKUuxR86PpP2mJLUjrTg2fV2dpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa65YhKN2/xhgRfzUJnB7Loc0qyN4vmmBjNLv8fJ8ChbNscdD1ld0Y?= =?us-ascii?q?RetjdjKfbNMVf8Iv/uYn5yN+V5f3ghwUuGN1NIEt31fVzYry76xzcTHhLiKVg9?= =?us-ascii?q?fbytScbshsi6n9q/54fUK10RwmHsOPUtc17o/E2R7pBQ2to6bP5pi1PgmThhQ6?= =?us-ascii?q?xu32RmJFaezV7Xx/yb29pdyRlWoO8r7MVaUK/3LOwSRL1cCyk6YShuvJW4/STZ?= =?us-ascii?q?SUOzwldUEiBPylsbNTPC9g33Uq38uSri7KI9hHHbboXKSuUvVDCj6bp7YAP5gy?= =?us-ascii?q?cAcTgi+SfYjdI0xLlWqRStvRt+z8vQYZqJHOZvdaPaO9UBTCxOWdgVHzdNGaug?= =?us-ascii?q?foAPCKwHJu8eoI7j4xMMshC3HxX2LP/+wT9PwHnt1Os11PpyPxvB2VkCFtQPqz?= =?us-ascii?q?z4pdP0L6oMSuO01+GczznKafJN8T775JLPcxxnqvaJC+EjOfHNwFUiQluWxm6b?= =?us-ascii?q?rpboamjN2w=3D=3D?= X-IPAS-Result: =?us-ascii?q?A2GzBADQ+dtX/wHyM5BdGwEBAQMBAQEJAQEBFgEBAQMBAQE?= =?us-ascii?q?JAQEBgw8BAQEBAR6BU7Qjhjcih1tMAQEBAQEBAQECAQJbJ4IyBAMDFQU5EFUCD?= =?us-ascii?q?WEBBAIPKAYBAQwgCwECAwkCFykICAMBLQMBBQELGAcLBRgEAYgopi6BMj4yila?= =?us-ascii?q?FLwEBBYdrAQsBHAgQhBaCEIhqEQGFeJlyj12JVCWFawJIjlIxgRFUgnING4FRc?= =?us-ascii?q?YVnDRcHWoEnAQEB?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.nsa.gov with ESMTP; 16 Sep 2016 13:59:53 +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 u8GDxqMl028350; Fri, 16 Sep 2016 09:59:52 -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 u8GD8tlr283091 for ; Fri, 16 Sep 2016 09:08: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 u8GD8p1n022898 for ; Fri, 16 Sep 2016 09:08:54 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1D/AQBP7ttXhi1SfUpdHAEBBAEBCgEBgzoBAQEBAYFxtCOCLoQShh6BVkwBAgEBAQEBAhMBAQEICwsJGYUTARUuAQE3AYEUAQUBIzSIKKYngTI+MopWhS8BAQWHbAEBCB8IEIQWghCLYguDB5lyj12JVIYQAkiOUjGBEYNGDREKgVFxhWcrggEBAQE X-IPAS-Result: A1D/AQBP7ttXhi1SfUpdHAEBBAEBCgEBgzoBAQEBAYFxtCOCLoQShh6BVkwBAgEBAQEBAhMBAQEICwsJGYUTARUuAQE3AYEUAQUBIzSIKKYngTI+MopWhS8BAQWHbAEBCB8IEIQWghCLYguDB5lyj12JVIYQAkiOUjGBEYNGDREKgVFxhWcrggEBAQE X-IronPort-AV: E=Sophos;i="5.30,344,1470715200"; d="scan'208";a="5709884" Received: from emsm-gh1-uea10.corp.nsa.gov (HELO emsm-gh1-uea10.nsa.gov) ([10.208.41.36]) by goalie.tycho.ncsc.mil with ESMTP; 16 Sep 2016 09:08:54 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3AE38hfhLS/xRTQJYNLdmcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgVL/7xwZ3uMQTl6Ol3ixeRBMOAuqsC1LWd7v+oGTRZp83Q6DZaKN0EfiRGoP?= =?us-ascii?q?1epxYnDs+BBB+zB9/RRAt+Iv5/UkR49WqwK0lfFZW2TVTTpnqv8WxaQU2nZkJL?= =?us-ascii?q?L+j4UrTfk96wn7jrvcaCOkMX23HgPvsydEzw9lSJ8JFOwMNLEeUY8lPxuHxGeu?= =?us-ascii?q?BblytDBGm4uFLC3Pq254Np6C9KuvgspIZqWKT+eLkkH/QDVGx1e1YO49f3uBX5?= =?us-ascii?q?QACO/iFUEjlO00kAPw+Q9xz+X5HsogPmp+F932+cJsSwQrcqHXy54q5tRAXviS?= =?us-ascii?q?tCMz8i7EnLm8dwi+RduxvnqBthh8bPbJq9KOt1fqSbe8gTA2VGQIIZVTNKC5mg?= =?us-ascii?q?NaMTHuEBOqBetIC7qFwQ/jWkAgz5JurpyyQAqnbw3LY3zf8iEBqOiA4sFtQPq1?= =?us-ascii?q?zdqtnvM6YeF+uyyf+bnn34c/pK1GKlu8DzeRc7rKTQBb8=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0EbAgCc7dtXhi1SfUpdHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBgw8BAQEBAYFxtCOCLoQShh6BVkwBAQEBAQEBAQIBAhABAQEICws?= =?us-ascii?q?JGS+CMgoaORBVAg1hARUuAQE3AYEUAQUBIzSIKKYngTI+MopWhS8BAQWHbAEBC?= =?us-ascii?q?B8IEIQWghCLYguDB5lyj12JVIYQAkiOUjGBEYNGDREKgVFxhWcrggEBAQE?= X-IPAS-Result: =?us-ascii?q?A0EbAgCc7dtXhi1SfUpdHAEBBAEBCgEBFwEBBAEBCgEBgw8?= =?us-ascii?q?BAQEBAYFxtCOCLoQShh6BVkwBAQEBAQEBAQIBAhABAQEICwsJGS+CMgoaORBVA?= =?us-ascii?q?g1hARUuAQE3AYEUAQUBIzSIKKYngTI+MopWhS8BAQWHbAEBCB8IEIQWghCLYgu?= =?us-ascii?q?DB5lyj12JVIYQAkiOUjGBEYNGDREKgVFxhWcrggEBAQE?= X-IronPort-AV: E=Sophos;i="5.30,344,1470700800"; d="scan'208";a="17657822" Received: from mail-wm0-f45.google.com ([74.125.82.45]) by emsm-gh1-uea10.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 16 Sep 2016 13:08:53 +0000 Received: by mail-wm0-f45.google.com with SMTP id k186so40693059wmd.0 for ; Fri, 16 Sep 2016 06:08:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20120917; h=from:to:cc:subject:date:message-id; bh=OkoTBClGm2pdVonfUwOMuHiKdxDIzTQQ9dQPEr9LutY=; b=er0MyQr4nqSy7qIYVQeCWcIQplFB/IID8Hj+GQvefbtD0RErCYciFK9RJtEc92MecK O8T8ffc6E1FK9ecq2IX6kTLggqBMG7MQHqwiX2q872OhY6U6jn3tX4k8aypiB6gg2LYe AlRu00hU1f8FB0mvasOsG7aXkeNHxLgyWxX62+Jl33oHasKtYdma3nC6W1V9oo4GijBz QRPrK5GrALJR3NOOcXv8bQP4mFx7YBaqcl+fX4Ye20C+9VRWzGDTOu0azxtMAItunIYu Xepv9nteQRBZJZbd53FwBb5/7vHN30g6MHdIA9kTwcs5k5Y8hC/ruy5iyiRisEcTCssR DgPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=OkoTBClGm2pdVonfUwOMuHiKdxDIzTQQ9dQPEr9LutY=; b=Wrq/Y/WPrbEqVNMveeLYQCWv7OrKBaWSmPIdf+1PRKeTI77ZBiHE+BlG5JdEv3AWgJ uVROl/eL2hAW5SsVoYQoqnepMxiwR/ynS0z2MMTvsU4cz4V3oqeK9LBB/6KZytwXU5U+ IA7A2D0FT9Sdgtreoc3TWlEcsvC3Hj/5eCKkklTP6Nj6/Oc36l5zbRt6ECem1gku9pWT X5bIa9NQwpt2IyFVcrlh4yvSeA+2+8WI+iV7XaTdkFIJAdYFVbIyRTsQzUhPlLILcy62 nwMz5mMAl/dUYlPTBvv1doThaGMDIdxfrqwvv6Rm37yNJkaeU8f74zL4y1WiLQ9ghYEE QIxw== X-Gm-Message-State: AE9vXwPYgTIWOHu602ZnRerBHGIBTd8Ro9YxDf077xjhRmuHnE05SU5yRB/LSIAT3d2W+A== X-Received: by 10.194.3.45 with SMTP id 13mr12703568wjz.103.1474031331329; Fri, 16 Sep 2016 06:08:51 -0700 (PDT) Received: from jdanis.lon.corp.google.com ([100.120.40.90]) by smtp.gmail.com with ESMTPSA id u64sm7332001wmd.20.2016.09.16.06.08.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Sep 2016 06:08:50 -0700 (PDT) From: Janis Danisevskis To: selinux@tycho.nsa.gov, seandroid-list@tycho.nsa.gov, sds@tycho.nsa.gov, jwcart2@tycho.nsa.gov Subject: [PATCH] Change semantic of -r in sefcontext_compile Date: Fri, 16 Sep 2016 14:08:48 +0100 Message-Id: <1474031328-29743-1-git-send-email-jdanis@android.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 X-Mailman-Approved-At: Fri, 16 Sep 2016 09:59:50 -0400 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: Cc: Janis Danisevskis MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP This patch reestablishes the default behavior of sefcontext_compile to include precompiled regular expressions in the output. If linked against PCRE2 the flag "-r" now causes the precompiled regular expressions to be omitted from the output. --- libselinux/utils/sefcontext_compile.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libselinux/utils/sefcontext_compile.c b/libselinux/utils/sefcontext_compile.c index 770ec4c..c1284d5 100644 --- a/libselinux/utils/sefcontext_compile.c +++ b/libselinux/utils/sefcontext_compile.c @@ -263,12 +263,10 @@ static void usage(const char *progname) " will be fc_file with the .bin suffix appended.\n\t" "-p Optional binary policy file that will be used to\n\t" " validate contexts defined in the fc_file.\n\t" - "-r Include precompiled regular expressions in the output.\n\t" + "-r Omit precompiled regular expressions in the output.\n\t" " (PCRE2 only. Compiled PCRE2 regular expressions are\n\t" " not portable across architectures. When linked against\n\t" " PCRE this flag is ignored)\n\t" - " Omit precompiled regular expressions (only meaningful\n\t" - " when using PCRE2 regular expression back-end).\n\t" "fc_file The text based file contexts file to be processed.\n", progname); exit(EXIT_FAILURE); @@ -278,7 +276,7 @@ int main(int argc, char *argv[]) { const char *path = NULL; const char *out_file = NULL; - int do_write_precompregex = 0; + int do_write_precompregex = 1; char stack_path[PATH_MAX + 1]; char *tmp = NULL; int fd, rc, opt; @@ -299,7 +297,7 @@ int main(int argc, char *argv[]) policy_file = optarg; break; case 'r': - do_write_precompregex = 1; + do_write_precompregex = 0; break; default: usage(argv[0]);