From patchwork Mon Sep 26 14:22:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janis Danisevskis X-Patchwork-Id: 9350777 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 7865C607D6 for ; Mon, 26 Sep 2016 14:28:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6732828AE1 for ; Mon, 26 Sep 2016 14:28:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B67628AFF; Mon, 26 Sep 2016 14:28:07 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from emsm-gh1-uea11.nsa.gov (smtp.nsa.gov [8.44.101.9]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44CA028AE1 for ; Mon, 26 Sep 2016 14:28:05 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.30,400,1470700800"; d="scan'208";a="19545621" IronPort-PHdr: =?us-ascii?q?9a23=3AizNN1BzGHZYUf2fXCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?0OwXIJqq85mqBkHD//Il1AaPBtSBrasfwLSH+4nbGkU4qa6bt34DdJEeHzQksu?= =?us-ascii?q?4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2WVTerzWI4CIIHV2nbEwu?= =?us-ascii?q?d76zQ9WZ0ZX//tvx0qWbWx9Piju5bOE6BzSNhiKViPMrh5B/IL060BrDrygAUe?= =?us-ascii?q?1XwWR1OQDbxE6ktY+N5porzwB887JkrpYBApPBeL4kQLBiAT8nKzp9pJGz9EqL?= =?us-ascii?q?cQza/XYYU2MLgjJUEgPF61f8RZ63vSzk8qJm1SCcMdfxTLxxXTW58493WRToj2?= =?us-ascii?q?EBLDd//2bJzoRrgLlzvAOqpxs5xZXdJo6SKr42fLzWdMkGH0JdT81RUGpHGYr6?= =?us-ascii?q?YIwRS6IDMe9erpLVqFwJoh+zQwKrAbDB0DhN013/26whm8goFwDd0RI7HNMV+C?= =?us-ascii?q?DWoNzzNbw6WOa51q7JwXPIaPYAimS105TBbh10+aLEZrl3a8eEkhEi?= X-IPAS-Result: =?us-ascii?q?A2H5AwCnL+lX/wHyM5BdGgEBAQECAQEBAQgBAQEBFgEBAQM?= =?us-ascii?q?BAQEJAQEBgxIBAQEBAR6BRQ60RYY4IodiTAEBAQEBAQEBAgECWyeCMgQDAxUFO?= =?us-ascii?q?TwBAQEBAQEjAg1fAgEDAQIPKAYBAQwgCwECAwkBARcFJAgIAwEtAwEFAQsDDgc?= =?us-ascii?q?HCwUYBAGIKaQKgTI+MopWhTABAQWHeQEBAQcBAQEBGwgQhBeCEIhqEQGFepl7j?= =?us-ascii?q?2qJViWFbkiOXTGBEVSDCw4cgVFxhToNFwdagScBAQE?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.nsa.gov with ESMTP; 26 Sep 2016 14:27:48 +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 u8QERjEc025215; Mon, 26 Sep 2016 10:27:46 -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 u8QENCNM252931 for ; Mon, 26 Sep 2016 10:23:12 -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 u8QENCOf024768 for ; Mon, 26 Sep 2016 10:23:12 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1CrAADcLulXhq/cVdFdHAEBBAEBCgEBgz0BAQEBAYFjDrRFgi6EE4YeAoFbTAECAQEBAQECEwEBAQgLCwkZhRECAQMSLgEBNwEPHTQ0AQUBDg4HEiKIKaQFgTI+MopWhTABAQWIAAEBAQEBAQQCARwIEIQXghCLZAuDB5l7j2qJVoYTSI5dMYERg18OEQuBUXGFOiuCAQEBAQ X-IPAS-Result: A1CrAADcLulXhq/cVdFdHAEBBAEBCgEBgz0BAQEBAYFjDrRFgi6EE4YeAoFbTAECAQEBAQECEwEBAQgLCwkZhRECAQMSLgEBNwEPHTQ0AQUBDg4HEiKIKaQFgTI+MopWhTABAQWIAAEBAQEBAQQCARwIEIQXghCLZAuDB5l7j2qJVoYTSI5dMYERg18OEQuBUXGFOiuCAQEBAQ X-IronPort-AV: E=Sophos;i="5.30,400,1470715200"; d="scan'208";a="5728782" 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; 26 Sep 2016 10:23:03 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3A/cOUHhNuvbHWPFelDqkl6mtUPXoX/o7sNwtQ0KIM?= =?us-ascii?q?zox0Kfj8rarrMEGX3/hxlliBBdydsKMezbON+P6xEUU7or+5+EgYd5JNUxJXwe?= =?us-ascii?q?43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkIt?= =?us-ascii?q?f6KuS9SU1p/8ibH60qaQSj0AvCC6b7J2IUf+hiTqne5Sv7FfLL0swADCuHpCdr?= =?us-ascii?q?ce72ppIVWOg0S0vZ/or9ZVyCNKp/8tzcNLUL2gN+RkFf0LRAghZns44MztqAnr?= =?us-ascii?q?URqE5nxaVH4f1BVPHUyN9xzzWJvrtSr28+58wzWyIdz9TbdyXy+rqahsVlugky?= =?us-ascii?q?scHyIo+2HQzMprheRUpwzl7x5gyIfOfNu9KOt1fqSbe8gTA2VGQIIZVSBIBIKn?= =?us-ascii?q?R4QICOUFMKBTqIyuiUEJqE6cDA+tH6vDwzlJnXLoxq47yKx1Ew3P2g07N9sIvG?= =?us-ascii?q?7TrdmzP6AXB7PmhJLUxCnOOqsFkQz275LFJ0x5rA=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0H0AQCcLulXhq/cVdFdHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBgxIBAQEBAYFjDrRFgi6EE4YeAoFbTAEBAQEBAQEBAgECEAEBAQg?= =?us-ascii?q?LCwkZL4IyCho5PAEBAQEBASMCDV8CAQMSLgEBNwEPHTQ0AQUBDg4HEiKIKaQEg?= =?us-ascii?q?TI+MopWhTABAQWIAAEBAQEBAQQCARwIEIQXghCLZAuDB5l7j2qJVoYTSI5dMYE?= =?us-ascii?q?Rg18OEQuBUXGFOiuCAQEBAQ?= X-IPAS-Result: =?us-ascii?q?A0H0AQCcLulXhq/cVdFdHAEBBAEBCgEBFwEBBAEBCgEBgxI?= =?us-ascii?q?BAQEBAYFjDrRFgi6EE4YeAoFbTAEBAQEBAQEBAgECEAEBAQgLCwkZL4IyCho5P?= =?us-ascii?q?AEBAQEBASMCDV8CAQMSLgEBNwEPHTQ0AQUBDg4HEiKIKaQEgTI+MopWhTABAQW?= =?us-ascii?q?IAAEBAQEBAQQCARwIEIQXghCLZAuDB5l7j2qJVoYTSI5dMYERg18OEQuBUXGFO?= =?us-ascii?q?iuCAQEBAQ?= X-IronPort-AV: E=Sophos;i="5.30,400,1470700800"; d="scan'208";a="19545402" Received: from mail-qk0-f175.google.com ([209.85.220.175]) by emsm-gh1-uea11.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 26 Sep 2016 14:23:02 +0000 Received: by mail-qk0-f175.google.com with SMTP id g67so104600259qkd.0 for ; Mon, 26 Sep 2016 07:23:02 -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:in-reply-to:references; bh=jtFq/lZCWtojhRD4MFFVEOZohBI+oBVw8bvlHIZlG9o=; b=l8RJTdr2SqMlXl39PWuDuk9aqlnhM1eLhRv5zX+XBrJZXmJjT6YCa+ZX4iz9GNPF+i VaRomMqa3bwFh8vrNesZMNfI0nbxoLr7guxBaJ+OJMUV8V94cbRickMiNzrrDSmCWtaw PN8l+U9AI4DlaUZv13k9XWbrmE7JCPmLBBEHvLmKHPETO29PpJSQxFpNFt5yUTPmKVXY r2zfXrYrJ7aexeK95dsJKeyqcHdS7CG2og/+8C9RZv3eMw1Z/9dt/Rtexay8LliErvic U/Yx3EJ7Zam6tSaqnmj0Fm8JhF4Tjru/x2rf0Qpu9dql1n5Sln1OQ/S7JK556c/8Qa1z FCzQ== 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:in-reply-to :references; bh=jtFq/lZCWtojhRD4MFFVEOZohBI+oBVw8bvlHIZlG9o=; b=ONMuexmZm2nfxjJGT7cnStsy4VmSSaC2FNkmxtGyJW64Etqq4OhLcZ2c7v4t7y/HMM PJovR6xmkAgrY3gr5tA35vFeyLsV26+dMBMsCONHze+icHlZWxNrghOfJR1b7FNWfilH YctZg8HYmEtg6W7Mss50jWds3obo9X5dKVUe3PDpcSBb+jfaOPrIzRDiWpgVuG3M09n/ L/FOUU2GZfIsePhlJZScbTLL/Qy2o/RPxTXnKcTr+sK11GA5cNM37PhuDbFeT5cJ4k0i oIVJzYdV90VpXzY+3Ggd0C2IodML7h4Lax6TtJFZ8wkzXlVjW9rsiZ6/1s4FXOwkI2Tb 6LVg== X-Gm-Message-State: AA6/9RmmN6Let0BAmiGp1h5YoQcYTMnhnxPTaDBIsWK/iMtY62C1xgGFHjtfu+8uWN2ccg== X-Received: by 10.194.112.131 with SMTP id iq3mr6490064wjb.123.1474899780428; Mon, 26 Sep 2016 07:23:00 -0700 (PDT) Received: from jdanis.lon.corp.google.com ([100.120.40.90]) by smtp.gmail.com with ESMTPSA id o2sm22677563wjo.3.2016.09.26.07.22.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Sep 2016 07:22:59 -0700 (PDT) From: Janis Danisevskis To: selinux@tycho.nsa.gov, seandroid-list@tycho.nsa.gov, sds@tycho.nsa.gov, jwcart2@tycho.nsa.gov, jdanis@google.com Subject: [PATCH 3/3] libselinux: sefcontext_compile invert semantics of "-r" flag Date: Mon, 26 Sep 2016 15:22:36 +0100 Message-Id: <1474899756-93610-3-git-send-email-jdanis@android.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1474899756-93610-1-git-send-email-jdanis@android.com> References: <1474899756-93610-1-git-send-email-jdanis@android.com> X-Mailman-Approved-At: Mon, 26 Sep 2016 10:24:56 -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 The "-r" flag of sefcontext_compile now causes it to omit the precompiled regular expressions from the output. Signed-off-by: Janis Danisevskis --- libselinux/utils/sefcontext_compile.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libselinux/utils/sefcontext_compile.c b/libselinux/utils/sefcontext_compile.c index 8c48d32..b2746c7 100644 --- a/libselinux/utils/sefcontext_compile.c +++ b/libselinux/utils/sefcontext_compile.c @@ -276,10 +276,12 @@ 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 from 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" + " not portable across architectures. Use this flag\n\t" + " if you know that you build for an incompatible\n\t" + " architecture to save space. When linked against\n\t" + " PCRE1 this flag is ignored.)\n\t" "-i Print regular expression info end exit. That is, back\n\t" " end version and architecture identifier.\n\t" " Arch identifier format (PCRE2):\n\t" @@ -294,7 +296,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; @@ -315,7 +317,7 @@ int main(int argc, char *argv[]) policy_file = optarg; break; case 'r': - do_write_precompregex = 1; + do_write_precompregex = 0; break; case 'i': printf("%s (%s)\n", regex_version(),