From patchwork Wed Sep 28 10:28:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janis Danisevskis X-Patchwork-Id: 9353759 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 703E960756 for ; Wed, 28 Sep 2016 11:44:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D2F02950F for ; Wed, 28 Sep 2016 11:44:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4ED5D29511; Wed, 28 Sep 2016 11:44:33 +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 (emsm-gh1-uea11.nsa.gov [8.44.101.9]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 697502950F for ; Wed, 28 Sep 2016 11:44:32 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.30,409,1470700800"; d="scan'208";a="19614905" IronPort-PHdr: =?us-ascii?q?9a23=3AQ+kErRS23LN06+6ZpWjOzVJJ/dpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa65YhWN2/xhgRfzUJnB7Loc0qyN4vqmADNLusfJmUtBWaQEbwUCh8?= =?us-ascii?q?QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYsExnyfTB4?= =?us-ascii?q?Ov7yUtaLyZ/mjabrpNaIMk1hv3mUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO?= =?us-ascii?q?9MxGlldhq5lhf44dqsrtY4q3wD888784Z8dYmyP+FhFf0LOg8hKXw46Pfmvhjb?= =?us-ascii?q?F0PPuiNdAS0qlU9TDgzE6gzqdovguSv98Oxm0W+VOtOyBas5UDKu9aBqRFrsiT?= =?us-ascii?q?wbHyIo+2HQzMprheRUpwzl7wdz2KbIcYqVM7x4ZaqbctQEASJDQc1YTTAbKp+t?= =?us-ascii?q?ZIsISewaNKBXqJe571kCpB2/HiGjA+TgzjIOjXjzjoMg1OF0MwjA3RdoM9sIsW?= =?us-ascii?q?/Zss72NbxaBeK5xa/J1h3Kaf9M3jbxroPPd0Zy8rm3QbtsfJ+JmgEUHATfgwDL?= =?us-ascii?q?8YE=3D?= X-IPAS-Result: =?us-ascii?q?A2FoBABmrOtX/wHyM5BcGwEBAQMBAQEJAQEBFwEBBAEBCgE?= =?us-ascii?q?BgxQBAQEBAR6BRQ60EIY7IodqTAEBAQEBAQEBAgECWyeCMgQDAxUFORBVAg1fA?= =?us-ascii?q?gEDAQIPKAYBAQwgCwECAwkBARcFJAgIAwEtAwEFAQsDDgcHCwUYBAGIK6RegTI?= =?us-ascii?q?+MopWhTABAQWIMgEBAQcBAQEBGwgQhBeCEIhqEQGFepl7j22JViWFb0iOXzGBE?= =?us-ascii?q?VSDDw4cgVFxhFsNFwdagSgBAQE?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.nsa.gov with ESMTP; 28 Sep 2016 11:44:29 +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 u8SBiT9d005534; Wed, 28 Sep 2016 07:44:29 -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 u8SASlSd294778 for ; Wed, 28 Sep 2016 06:28:47 -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 u8SASkc9030046 for ; Wed, 28 Sep 2016 06:28:46 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1BXAwCqmutXfy1SfUpcHAEBBAEBCgEBgz8BAQEBAYFjDrQQgi+EFYYeAoFhTAECAQEBAQECEwEBCQsLCReFEwIBAxIuAQE3AQ8dNDQBBQEODgcSIogrpGeBMj4yilaFMAEBBYg0AQEBAQEBBAIBHAgQhBeCEItkC4MHmXuPbYlWhhRIjl8xgRGDYw4cgVFxhFsrggEBAQE X-IPAS-Result: A1BXAwCqmutXfy1SfUpcHAEBBAEBCgEBgz8BAQEBAYFjDrQQgi+EFYYeAoFhTAECAQEBAQECEwEBCQsLCReFEwIBAxIuAQE3AQ8dNDQBBQEODgcSIogrpGeBMj4yilaFMAEBBYg0AQEBAQEBBAIBHAgQhBeCEItkC4MHmXuPbYlWhhRIjl8xgRGDYw4cgVFxhFsrggEBAQE X-IronPort-AV: E=Sophos;i="5.30,409,1470715200"; d="scan'208";a="5733099" 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; 28 Sep 2016 06:28:46 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3AR3G3OBFeW2zE+OlULOlrXp1GYnF86YWxBRYc798d?= =?us-ascii?q?s5kLTJ74o8uwAkXT6L1XgUPTWs2DsrQf2rCQ6v+rAzBIyK3CmUhKSIZLWR4BhJ?= =?us-ascii?q?detC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBy?= =?us-ascii?q?brysXNWD1YLuiKvop9X6WEZhvHKFe7R8LRG7/036l/I9ps9cEJs30QbDuXBSeu?= =?us-ascii?q?5blitCLFOXmAvgtI/rpMYwuxJrvOg9+sJ6XK77Z/5wDeAATWduD2dg/8DvtB/e?= =?us-ascii?q?XSOT93AcVSMQiRMODA/bqFnhU573vjH9t+Y43CiBIeXqXLs0XnKk9K4tRxj2zG?= =?us-ascii?q?8cOyUR7HDciss2irlS5h2muVg3wZHfaZuJbtJib6jdepUcXmMHUcFPE2RDDoq6?= =?us-ascii?q?bpAnAO0GMuJV6YL6ogggtxy7UCulAuL0ghNBgH7t0LMh0OU6WVXE0AUmHskmuX?= =?us-ascii?q?LYttL0OOEZVuXjn/qA9inKc/4DgWS104PPaB10/amB?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0F3AwBZmutXfy1SfUpcHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBgxQBAQEBAYFjDrQQgi+EFYYeAoFhTAEBAQEBAQEBAgECEAEBCQs?= =?us-ascii?q?LCRcxgjIKGjkQVQINXwIBAxIuAQE3AQ8dNDQBBQEODgcSIogrpGuBMj4yilaFM?= =?us-ascii?q?AEBBYg0AQEBAQEBBAIBHAgQhBeCEItkC4MHmXuPbYlWhhRIjl8xgRGDYw4cgVF?= =?us-ascii?q?xhFsrggEBAQE?= X-IPAS-Result: =?us-ascii?q?A0F3AwBZmutXfy1SfUpcHAEBBAEBCgEBFwEBBAEBCgEBgxQ?= =?us-ascii?q?BAQEBAYFjDrQQgi+EFYYeAoFhTAEBAQEBAQEBAgECEAEBCQsLCRcxgjIKGjkQV?= =?us-ascii?q?QINXwIBAxIuAQE3AQ8dNDQBBQEODgcSIogrpGuBMj4yilaFMAEBBYg0AQEBAQE?= =?us-ascii?q?BBAIBHAgQhBeCEItkC4MHmXuPbYlWhhRIjl8xgRGDYw4cgVFxhFsrggEBAQE?= X-IronPort-AV: E=Sophos;i="5.30,409,1470700800"; d="scan'208";a="18041362" Received: from mail-wm0-f45.google.com ([74.125.82.45]) by emsm-gh1-uea10.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 28 Sep 2016 10:28:44 +0000 Received: by mail-wm0-f45.google.com with SMTP id l132so227608474wmf.0 for ; Wed, 28 Sep 2016 03:28:44 -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=h+MA3PZmWc2GlqXY7NjnSE+lKgwOAFmpDstpurEmsKtCvzQFD3AD3M8yeMbI2Z77Dq 572FXNLJIzFalqFVQ6gErjJ6LTt5M7rb2tr5jdtZcjrxidWHtfNQWsdWCwqg+PZrZuYX YIQmAbVLKiN3XU+Llw5wZCII4HKJg4wVlqkqMHyqhkD175oZ0GcqhLY7ALXnCCnR9LwM 5fAvGylF/Cd0ZMoNcvl8n6lJDGZuJ+7aHYmV7r5j83Pzq/t0Ijihrk5yGdSfOyLW+qAB H1SQOfkylfNITrUhw6ddftADb6ycyQdmkQtkeg3clOmbA2R0wcttJNjB2IlBc5P2ayK1 8QUg== 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=mEpgSVMZ3J9vL2UR1tFYWFef6YSU8h4TbqfXWt3fN5DGAwIflmqTp9RCnE561t9I5R spJ+wpk4qoKs+OsjDARGYqPPqFPKfq/Qse9/wqXzV7aHpQtv3DVZ/go/Wh7T8ubgtJy2 P1GwnEgVDmiR61jefm0ft/irHIWqzebAsQ8AKaEu5HINEYjU9fxNJzXhifXPuH5PO9F6 ep9gnEfBEkXV6UBUW7wK9wl/KVCqfjEGDpMd0WTQyh7mukQ3gMmGUAtpZG0AKu5C7D0T ZlNkYy0ctoGqBKgFUsX84VaiRJ5LF53nG6WVbmv/60752xwdLjRD4S+LWbeT0+RXzJ+/ BpHA== X-Gm-Message-State: AA6/9Rn8sD2oii1Kv4g7oeajmOKXaPJzZQppprhPi6Ue52IzQwzld01J0mR9NfSs3/6ptA== X-Received: by 10.194.71.104 with SMTP id t8mr10617152wju.17.1475058523795; Wed, 28 Sep 2016 03:28:43 -0700 (PDT) Received: from jdanis.lon.corp.google.com ([100.120.40.90]) by smtp.gmail.com with ESMTPSA id 123sm8036318wmj.5.2016.09.28.03.28.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Sep 2016 03:28:43 -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: Wed, 28 Sep 2016 11:28:32 +0100 Message-Id: <1475058512-76102-3-git-send-email-jdanis@android.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1475058512-76102-1-git-send-email-jdanis@android.com> References: <1475058512-76102-1-git-send-email-jdanis@android.com> X-Mailman-Approved-At: Wed, 28 Sep 2016 07:39:52 -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(),