From patchwork Wed Sep 28 10:28:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janis Danisevskis X-Patchwork-Id: 9353755 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 8EFA760756 for ; Wed, 28 Sep 2016 11:42:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8097C28791 for ; Wed, 28 Sep 2016 11:42:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74F9029508; Wed, 28 Sep 2016 11:42:24 +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 B6A1E28791 for ; Wed, 28 Sep 2016 11:42:23 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.30,409,1470700800"; d="scan'208";a="19614807" IronPort-PHdr: =?us-ascii?q?9a23=3Ash6IyhwzxCcE3rPXCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?0OwXIJqq85mqBkHD//Il1AaPBtSBrasbwLGH+4nbGkU4qa6bt34DdJEeHzQksu?= =?us-ascii?q?4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2WVTerzWI4CIIHV2nbEwu?= =?us-ascii?q?d76zQ9GZ1JX//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?A2H1BAA4q+tX/wHyM5BcHAEBBAEBCgEBFwEBBAEBCgEBgxQ?= =?us-ascii?q?BAQEBAR6BRQ60EIY4JYdqTAEBAQEBAQEBAgECWyeCMgQDAxUFORBVAg1fAgEDA?= =?us-ascii?q?QIPKAYBAQwgCwECAwkBARcFJAgIAwEtAwEFAQsDDgcHCwUYBAGIK6RdgTI+Mop?= =?us-ascii?q?WhTABAQWIMgEBCAEBAQEbCBCEF4IQiGgCEQGFegGZeo9tiVYlhW9Ijl8xgRFUg?= =?us-ascii?q?w8OHIFRcYRZDxdhgSgBAQE?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.nsa.gov with ESMTP; 28 Sep 2016 11:42:20 +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 u8SBfSFl005295; Wed, 28 Sep 2016 07:41:39 -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 u8SASknB294769 for ; Wed, 28 Sep 2016 06:28:46 -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 u8SASj7e030021 for ; Wed, 28 Sep 2016 06:28:45 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1BXAwCqmutXfzRSfUpcHAEBBAEBCgEBgz8BAQEBAYFjDrQQgi+EFYYeAoFhTAECAQEBAQECEwEBCQsLCReFEwIBAxIuAQE3AQ8dNDQBBQEODgcSIogrpGeBMj4yilaFMAEBBYg0AQEBAQEFAgEcCBCEF4IQiGiCfAuDB5l7j22JVoYUSI5fMYERg2MOHIFRcYRZgi4BAQE X-IPAS-Result: A1BXAwCqmutXfzRSfUpcHAEBBAEBCgEBgz8BAQEBAYFjDrQQgi+EFYYeAoFhTAECAQEBAQECEwEBCQsLCReFEwIBAxIuAQE3AQ8dNDQBBQEODgcSIogrpGeBMj4yilaFMAEBBYg0AQEBAQEFAgEcCBCEF4IQiGiCfAuDB5l7j22JVoYUSI5fMYERg2MOHIFRcYRZgi4BAQE X-IronPort-AV: E=Sophos;i="5.30,409,1470715200"; d="scan'208";a="5733095" 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; 28 Sep 2016 06:28:45 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3Ahq5JOB8Y8QyAKv9uRHKM819IXTAuvvDOBiVQ1KB8?= =?us-ascii?q?1+0cTK2v8tzYMVDF4r011RmSDN+dsq0P0baempujcFRI2YyGvnEGfc4EfD4+ou?= =?us-ascii?q?JSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47AblHf6ke/8SQVUk2mc1Ek?= =?us-ascii?q?fKKsRcWI04ye7KObw9XreQJGhT6wM/tZDS6dikHvjPQQmpZoMa0ryxHE8TNicu?= =?us-ascii?q?VSwn50dxrIx06vrvGL+4R//ihqtvkg75QIEfmiPvdwcbsNFzkiMmYo9OX3pBLD?= =?us-ascii?q?Sk2J/XJaXWII1lJTDgHD4Av9X5u0tirhqsJhySKaOovwVrlyVjO8q+9wRATAlD?= =?us-ascii?q?YMNzl/9nrezMN3kuYTog2qrgZjmabIcYqVM7x4ZaqbctQEASJDUs9XVjdpDYS7?= =?us-ascii?q?YI8CSeEGOLV2tY748nkHqxqlTSWlAuL0xyFThX7tlfk43+0nEBru1QosBdUPvD?= =?us-ascii?q?Lfq9CjZ/Raavy80KSdlWaLVPhRwzqotNDF?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0F3AwDImutXfzRSfUpcHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBgxQBAQEBAYFjDrQQgi+EFYYeAoFhTAEBAQEBAQEBAgECEAEBCQs?= =?us-ascii?q?LCRcxgjIKGjkQVQINXwIBAxIuAQE3AQ8dNDQBBQEODgcSIogrpGeBMj4yilaFM?= =?us-ascii?q?AEBBYg0AQEBAQEFAgEcCBCEF4IQiGiGDpl7j22JVoYUSI5fMYERg2MOHIFRcYR?= =?us-ascii?q?Zgi4BAQE?= X-IPAS-Result: =?us-ascii?q?A0F3AwDImutXfzRSfUpcHAEBBAEBCgEBFwEBBAEBCgEBgxQ?= =?us-ascii?q?BAQEBAYFjDrQQgi+EFYYeAoFhTAEBAQEBAQEBAgECEAEBCQsLCRcxgjIKGjkQV?= =?us-ascii?q?QINXwIBAxIuAQE3AQ8dNDQBBQEODgcSIogrpGeBMj4yilaFMAEBBYg0AQEBAQE?= =?us-ascii?q?FAgEcCBCEF4IQiGiGDpl7j22JVoYUSI5fMYERg2MOHIFRcYRZgi4BAQE?= X-IronPort-AV: E=Sophos;i="5.30,409,1470700800"; d="scan'208";a="19613269" Received: from mail-wm0-f52.google.com ([74.125.82.52]) by emsm-gh1-uea11.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 28 Sep 2016 10:28:44 +0000 Received: by mail-wm0-f52.google.com with SMTP id b130so63288340wmc.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=ttwuxWzMA+Wi5Bc3Wf4cl/IVDAv/zJtviWCtB3qNAKA=; b=brNuIfhDGlxXKNRIhzrGU7Pg/EuekwYpjR7G8KejLP60SH6adYkMnbk6cQvfGLAFy7 sWGp2cHVNFuuiy94uiDqyHd4UbDshfBcMZNQNE2wxN+AAbu3nReJyCOyAo7et3CEB72z xGKq8KtDk9utI9wTNgK46u8ipLUDEhi0TrC2Dv2ANIVokJoa0Qh1WDawck3ZZ9p9jYbi dafkAwdBVpOIVzlFHCCk7lN/71nnahkhg7dAgIX6yep+rDJ732/B89xt5afDKadl091F /NTn48cSFr3vSpCsXGOyVoz8V5n9u5li5e2lqZX0xd+q8++Tht+G/28BzAUQ0LwYhWPq OZIA== 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=ttwuxWzMA+Wi5Bc3Wf4cl/IVDAv/zJtviWCtB3qNAKA=; b=MGSsWG8JxQEUh4jiHqP8DEQEwzugO2JleuIk++Sri1lMm+sH7z3NB+DseOfg9hEQOS kRqw98hor7wCGgqxNu/n5Vv/Fus8E7YX9lXvkvRsb7ALnHHxK5Fnq6NUrVTloY/uK9Te TUd3v/qPtE5ojcg+O/0juy9KC5vhJeGVLy0SHGYer8XRxmw4cGx45I7791L/3AsOx2pa 9wuHGuYENapkz2psbWJfpxo6HBLi018DcYmS4juxPIFw35eupjAd5Jx7EmNMlbjnkwqG lrTHT6Itr9mqNe4aP4izh6PeegyBhUJ2V1o0uYV6bRTYIt2xEW2dE1D2+wGnp5aMzSPA UrQg== X-Gm-Message-State: AA6/9RnCbrCbWVDJUU36olju35t+P6XFTilvD0McQSb2HrV9C9zwCjS3oymtdUwc9BjbPw== X-Received: by 10.28.66.1 with SMTP id p1mr7141781wma.53.1475058522881; Wed, 28 Sep 2016 03:28:42 -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:42 -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 2/3] libselinux: sefcontext_compile: Add "-i" flag Date: Wed, 28 Sep 2016 11:28:31 +0100 Message-Id: <1475058512-76102-2-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 Adds the "-i" flag, which prints the version and architecture identifier of the regular expression back end. Signed-off-by: Janis Danisevskis --- libselinux/utils/sefcontext_compile.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libselinux/utils/sefcontext_compile.c b/libselinux/utils/sefcontext_compile.c index d91db9a..8c48d32 100644 --- a/libselinux/utils/sefcontext_compile.c +++ b/libselinux/utils/sefcontext_compile.c @@ -280,6 +280,11 @@ static void usage(const char *progname) " (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" + "-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" + " --, e.g.,\n\t" + " \"8-8-el\" for x86_64.\n\t" "fc_file The text based file contexts file to be processed.\n", progname); exit(EXIT_FAILURE); @@ -301,7 +306,7 @@ int main(int argc, char *argv[]) if (argc < 2) usage(argv[0]); - while ((opt = getopt(argc, argv, "o:p:r")) > 0) { + while ((opt = getopt(argc, argv, "io:p:r")) > 0) { switch (opt) { case 'o': out_file = optarg; @@ -312,6 +317,10 @@ int main(int argc, char *argv[]) case 'r': do_write_precompregex = 1; break; + case 'i': + printf("%s (%s)\n", regex_version(), + regex_arch_string()); + return 0; default: usage(argv[0]); }