From patchwork Mon Sep 26 14:22:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janis Danisevskis X-Patchwork-Id: 9350779 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 DB885607D6 for ; Mon, 26 Sep 2016 14:28:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCC0828AE1 for ; Mon, 26 Sep 2016 14:28:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C05A928AFF; Mon, 26 Sep 2016 14:28: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=-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 53B9028AE1 for ; Mon, 26 Sep 2016 14:28:09 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.30,400,1470700800"; d="scan'208";a="19545628" IronPort-PHdr: =?us-ascii?q?9a23=3AtpaFAhIR28gfo0Rn89mcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgVLP3xwZ3uMQTl6Ol3ixeRBMOAuqgC0rGd7fGocFdDyK7JiGoFfp1IWk1Nou?= =?us-ascii?q?QttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXsq3G/pQQfBg/4fVIs?= =?us-ascii?q?YL+kQMiL1I/phqibwN76W01wnj2zYLd/fl2djD76kY0ou7ZkMbs70RDTo3FFKK?= =?us-ascii?q?x8zGJsIk+PzV6nvp/jtKN592xsn95pt4sZCeSpSZ8/V6BVAA4rOGEtvoWr6UGC?= =?us-ascii?q?HkOz4S4HX2EXlAdYKxTU5xH9GJHqu231sfQ5kDKXNMv6V7c1VXGm7rx3YAP5gy?= =?us-ascii?q?cAcTgi+SfYjdI0xLlXuzq9thd/xMjSe4jTO/1gOuvfYtgTX3YbdtpAXCxGRIWn?= =?us-ascii?q?Zs0ACPRFdeRUpo/8vHMBqhyxAQTqD+TqmRFSgXqj/6Q80v9pPQjA3RctAckNsW?= =?us-ascii?q?+c+Nf5PaETSsi8yqXSyjTPKfhR3GGuu8Dzbhk9rKTUDvpLes3LxBx0Tw4=3D?= X-IPAS-Result: =?us-ascii?q?A2GnBACnL+lX/wHyM5BdGwEBAQMBAQEJAQEBFgEBAQMBAQE?= =?us-ascii?q?JAQEBgxIBAQEBAR6BRQ60RYY1JYdiTAEBAQEBAQEBAgECWyeCMgQDAxUFOTwBA?= =?us-ascii?q?QEBAQEjAg1fAgEDAQIPKAYBAQwgCwECAwkBARcFJAgIAwEtAwEFAQsDDgcHCwU?= =?us-ascii?q?YBAGIKaQKgTI+MopWhTABAQWHeQEBCAEBAQEbCBCEF4IQiGgCEQGFegGZeo9qi?= =?us-ascii?q?VYlhW5Ijl0xgRFUgwsOHIFRcYU4DxdhgScBAQE?= 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:55 +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 u8QERsn6025245; Mon, 26 Sep 2016 10:27:54 -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 u8QENCPo252936 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 u8QENCOg024768 for ; Mon, 26 Sep 2016 10:23:12 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1CuAADcLulXfzTXVdFdHAEBBAEBCgEBgz0BAQEBAYFjDrRFgi6EE4YeAoFbTAECAQEBAQECEwEBCQsLCReFEwIBAxIuAQE3AQ8dNDQBBQEODgcSIogppAWBMj4yilaFMAEBBYgAAQEBAQEFAgEcCBCEF4IQiGiCfAuDB5l7j2qJVoYTSI5dMYERg18OHIFRcYU4gi4BAQE X-IPAS-Result: A1CuAADcLulXfzTXVdFdHAEBBAEBCgEBgz0BAQEBAYFjDrRFgi6EE4YeAoFbTAECAQEBAQECEwEBCQsLCReFEwIBAxIuAQE3AQ8dNDQBBQEODgcSIogppAWBMj4yilaFMAEBBYgAAQEBAQEFAgEcCBCEF4IQiGiCfAuDB5l7j2qJVoYTSI5dMYERg18OHIFRcYU4gi4BAQE X-IronPort-AV: E=Sophos;i="5.30,400,1470715200"; d="scan'208";a="5728779" 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; 26 Sep 2016 10:23:02 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3Axgp4JxQAZwGx/bRgSG5Yftml4Npsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa65YBON2/xhgRfzUJnB7Loc0qyN4vqmADdLv8fJmUtBWaQEbwUCh8?= =?us-ascii?q?QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYsExnyfTB4?= =?us-ascii?q?Ov7yUtaLyZ/mjabroNaNMk1hv3mUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO?= =?us-ascii?q?9MxGlldhq5lhf44dqsrtY4q3wD88Qa8NRcXKnAcq85VeYQTGh+cjN92Mq+rhTH?= =?us-ascii?q?TA2S9lMAQ24WlVxOGAGD4xbkGt/qvyL8uvB62SXfOcztUZgoSD+i6OFtUxauhy?= =?us-ascii?q?AZc3Yi/Hr/lt17jKUdpgmo4RN43cqcYp6ePeBiJIvBbNgaQixHRc8XWCtfRsu+?= =?us-ascii?q?Y4IJDvEpMuFfoI3w4VAJqEiQHw6pUcHmzD5TzlP/26wh3vo6EgDdlFgiE9sIsW?= =?us-ascii?q?/8pdP5LqATXaa+y6yenmaLVO9fxTqosNuASRsmu/zZAep9?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0H4AQAzLulXfzTXVdFdHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBgxIBAQEBAYFjDrRFgi6EE4YeAoFbTAEBAQEBAQEBAgECEAEBCQs?= =?us-ascii?q?LCRcxgjIKGjk8AQEBAQEBIwINXwIBAxIuAQE3AQ8dNDQBBQEODgcSIogppAWBM?= =?us-ascii?q?j4yilaFMAEBBYgAAQEBAQEFAgEcCBCEF4IQiGiGDpl7j2qJVoYTSI5dMYERg18?= =?us-ascii?q?OHIFRcYU4gi4BAQE?= X-IPAS-Result: =?us-ascii?q?A0H4AQAzLulXfzTXVdFdHAEBBAEBCgEBFwEBBAEBCgEBgxI?= =?us-ascii?q?BAQEBAYFjDrRFgi6EE4YeAoFbTAEBAQEBAQEBAgECEAEBCQsLCRcxgjIKGjk8A?= =?us-ascii?q?QEBAQEBIwINXwIBAxIuAQE3AQ8dNDQBBQEODgcSIogppAWBMj4yilaFMAEBBYg?= =?us-ascii?q?AAQEBAQEFAgEcCBCEF4IQiGiGDpl7j2qJVoYTSI5dMYERg18OHIFRcYU4gi4BA?= =?us-ascii?q?QE?= X-IronPort-AV: E=Sophos;i="5.30,400,1470700800"; d="scan'208";a="17962191" Received: from mail-lf0-f52.google.com ([209.85.215.52]) by emsm-gh1-uea10.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 26 Sep 2016 14:22:59 +0000 Received: by mail-lf0-f52.google.com with SMTP id y6so144057191lff.1 for ; Mon, 26 Sep 2016 07:22:59 -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=KZad1/u4CHZZRRiX1jHEKKSpY9VCVTBQe5DQXD/W2ot0mIx92Ao0BxMsje3Xeg8Q55 LYmgKE9mx/rxzuxTDlXXj/T6aPpCzY3xBGbbctd0dIeZERGHWvLIe9/ZC+o0th9UKTj5 K0v2IhwVNvDq/J+Z0KP+dHUNuXMJYChSda83ZwkdHOLAyyLqOpgZ4WciGEyaacskluTP wUVrMuBVtpNyNDM2ICEqBk86RlY3FmtVZEwnrsOz4F1bRW/slFXvltUoVagtX6yPpCMP vk6n1uAQwtg4MGpaMpkODGAoI8PvPP1hB63zUspIoNoK6+QExmbqOHnC6gwgw2Ds1R9i 82WA== 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=O4r+V3NMn7UvzRToOwmZ4lkfcc0el1RAcU5KlwdKRrJW9Nej5EfNhCY/Knf7j52UOY wLM5htqLOFQ7Tx0citAgcRllSS8rQEG8fL+9cDY51/ZWe8bvzfZPzJsO5HQwJOnsvtF0 kr2D8ZNm0yk7G1TRFp+V+zk2oUELLqKd6rn3ZvUoXWiZZjAKILH/8qhCaXJWWrxHH/WI zx+zDvFnKRcJnvwpv2oeARzBZW2QmnYgYgiTq6yMLcBWifXo287esHmiRqsOLjhw3vrM /jU+9dQ3eiO0VOzUOOpgDyhAGNOjWIax645X0nFJj1yH3+WTUYGPUfSbEpyHW9QlZG8z qGiQ== X-Gm-Message-State: AA6/9RnlzxZol9VJVeIDeBH5F0SyHF6ZR6ZQBhEXPUHdm4kMUvqmdT8pRXFtuGXer+k88A== X-Received: by 10.194.54.138 with SMTP id j10mr7512689wjp.198.1474899777021; Mon, 26 Sep 2016 07:22:57 -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.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Sep 2016 07:22:56 -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: Mon, 26 Sep 2016 15:22:35 +0100 Message-Id: <1474899756-93610-2-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 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]); }