From patchwork Fri Jun 3 00:19:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Brindle X-Patchwork-Id: 9151331 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 76D4A607D9 for ; Fri, 3 Jun 2016 00:20:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68B8025404 for ; Fri, 3 Jun 2016 00:20:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D36D28328; Fri, 3 Jun 2016 00:20: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=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from emsm-gh1-uea11.nsa.gov (smtp.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 A6F5926D19 for ; Fri, 3 Jun 2016 00:20:32 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.26,409,1459814400"; d="scan'208";a="16616097" IronPort-PHdr: =?us-ascii?q?9a23=3AqjOB/RDeSAXUYMkWoDgrUyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSP78pcbcNUDSrc9gkEXOFd2CrakU2qyI6uu4AyQp2tWojjMrSNR0TRgLiM?= =?us-ascii?q?EbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpQAbFhi3Dwdp?= =?us-ascii?q?POO9QteU1JTmkb7rsMWJKyxzxxODIppKZC2sqgvQssREyaBDEY0WjiXzn31TZu?= =?us-ascii?q?5NznlpL1/A1zz158O34YIxu38I46FpytREGZneU+x4COUATWduD2dg/8DvtB/e?= =?us-ascii?q?XUPb/XYYU2MLgjJUEgPF61f8RZ63vSzk4LlTwi6faO/xVrApUHyI9aZtRBvlwH?= =?us-ascii?q?MNLT8//GXaotVthbhYux+qugZ+35+Sa4aQYqktNpjBdM8XEDISFv1aUDZMV8bl?= =?us-ascii?q?N4Y=3D?= X-IPAS-Result: =?us-ascii?q?A2F7AwDQzFBX/wHyM5BegzqBU7w4IocxTAEBAQEBAQICYie?= =?us-ascii?q?CMH4sCEgBHQEEAg8oBgEBDCAMAgMJAhcpCAgDAS0DAQUBCxcICwUYBAGIDaNQg?= =?us-ascii?q?TE+MYpUhSgBAQWNFwgQhAuKaxEBhXaYPY4iiTElhUICjg0wgQ9UhApSiUeBNQE?= =?us-ascii?q?BAQ?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.nsa.gov with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2016 00:20:07 +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 u530JOlK029376; Thu, 2 Jun 2016 20:19:37 -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 u530JMVZ067536 for ; Thu, 2 Jun 2016 20:19:22 -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 u530JLxL029374 for ; Thu, 2 Jun 2016 20:19:21 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1B2AgBWzFBXfTDAVdFehQ24O4QIhhKBNkwBAQEBAQETAQEJCwsJIYR3ARUuAQE3AYEUAQUBIjWIDaNQgTE+MYpUhSgBAQWMbAEBAQcfCBCEC5BzmD2OIokxhWcCjg0wgQ+CToIQUop8AQEB X-IPAS-Result: A1B2AgBWzFBXfTDAVdFehQ24O4QIhhKBNkwBAQEBAQETAQEJCwsJIYR3ARUuAQE3AYEUAQUBIjWIDaNQgTE+MYpUhSgBAQWMbAEBAQcfCBCEC5BzmD2OIokxhWcCjg0wgQ+CToIQUop8AQEB X-IronPort-AV: E=Sophos;i="5.26,409,1459828800"; d="scan'208";a="5486395" 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; 02 Jun 2016 20:19:20 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3AJ0AdmxxAn9zsL9LXCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?0e8RIJqq85mqBkHD//Il1AaPBtWKrawdwLKM+4nbGkU+or+5+EgYd5JNUxJXwe?= =?us-ascii?q?43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkIt?= =?us-ascii?q?f6KuSt+U0Z38j7r60qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYe?= =?us-ascii?q?VcyDAgD1uSmxHh+pX4p8Y7oGwD884motVNVaT8YrRwGadVCDUgLnAd+NzgtR6F?= =?us-ascii?q?SxCGoHQbTDNFvABPBl3n6wr6Q565mDH7sOZ51WHON9f3S7wwVBy78q5xSwTlgz?= =?us-ascii?q?odNiIotmrQj5oj3+pgvBu9qkknkMbva4aPOa8mcw=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0HuAQDfy1BXfTDAVdFehQ24O4QIhhKBN?= =?us-ascii?q?kwBAQEBAQECAg8BAQkLCwkhL4IwfiwISAEBHAEVLgEBNwGBFAEFASI1iA2jS4E?= =?us-ascii?q?xPjGKVIUoAQEFjG0BAQEHHwgQhAuQc5g9jiKJMYVnAo4NMIEPgk6CEFKKfAEBA?= =?us-ascii?q?Q?= X-IPAS-Result: =?us-ascii?q?A0HuAQDfy1BXfTDAVdFehQ24O4QIhhKBNkwBAQEBAQECAg8?= =?us-ascii?q?BAQkLCwkhL4IwfiwISAEBHAEVLgEBNwGBFAEFASI1iA2jS4ExPjGKVIUoAQEFj?= =?us-ascii?q?G0BAQEHHwgQhAuQc5g9jiKJMYVnAo4NMIEPgk6CEFKKfAEBAQ?= X-IronPort-AV: E=Sophos;i="5.26,409,1459814400"; d="scan'208";a="16616085" Received: from mail-qg0-f48.google.com ([209.85.192.48]) by emsm-gh1-uea11.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 03 Jun 2016 00:19:20 +0000 Received: by mail-qg0-f48.google.com with SMTP id q32so4618793qgq.3 for ; Thu, 02 Jun 2016 17:19:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quarksecurity.com; s=google; h=from:to:cc:subject:date:message-id; bh=slQw7SD0cX1kVMay2CgJaR8XO3/ilQYDwicBgbF7x9w=; b=eI9TXzDsBfb/5TNZYcPwPoQh3FaqYC5A5DQB2QpNNX/Frv3t1U3kH1p+PVjdLDbpA6 xu/eu/GMoxQwAptl9p/Dye0z2Ziw5SKbRMuFfFSmsIPTOcJJfVaVb20pUExLJ69r6qxP +n4j2FMJpGl09uAEvGdPOl3kk/KmJjc0K2qP4= 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=slQw7SD0cX1kVMay2CgJaR8XO3/ilQYDwicBgbF7x9w=; b=AeQ8q0LoTEDOtZnlsC91iKpRxXPt1/A4zz75V4NSf9HIuq7MmwQUW3I22lq+y8H8l5 b3ozGyxKIAwmVAJT59r3WjSJ9v7YsNdG7IHb85W45rjOpj+7r08H0Xu9mfcBwTHnxnRN XWbJIB/EMdWbH2i30ZOoFfzaT/EiCV23tOSiATy8bh3FsdAYKhevf6K0X/QFn9Hb635+ InA/dp31ovRS9Og9Fh5e6vvhamYwSzpGpgatnSIdJCnkNEnGYRGscmPxddZjQ1hReouh fmbSpiih/xMArI0cYkkX9CfCnS+6cqDeTWL6YqQR/fsnlrMXgeXtrQ/t5ZoEei/DoSkD J1Xg== X-Gm-Message-State: ALyK8tJbELEsye4I1LlbIApDJu3yP05Fh7g9u0NAqVsyKu0HPUT5WsWtMCzr+iLEd4TIcMSY X-Received: by 10.140.88.74 with SMTP id s68mr784102qgd.17.1464913160018; Thu, 02 Jun 2016 17:19:20 -0700 (PDT) Received: from charmzilla.localdomain ([50.253.7.1]) by smtp.gmail.com with ESMTPSA id k61sm868958qtd.5.2016.06.02.17.19.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 17:19:19 -0700 (PDT) From: Joshua Brindle To: selinux Subject: [PATCH] Modify audit2why analyze function to use loaded policy Date: Thu, 2 Jun 2016 20:19:12 -0400 Message-Id: <1464913152-28265-1-git-send-email-brindle@quarksecurity.com> X-Mailer: git-send-email 2.1.0 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: MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP Class and perms should come from the policy being used for analysis, not the system policy so use sepol_ interfaces Change-Id: Ia0590ed2514249fd98810a8d4fe87f8bf5280561 --- libselinux/src/audit2why.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libselinux/src/audit2why.c b/libselinux/src/audit2why.c index 12745b3..abe1701 100644 --- a/libselinux/src/audit2why.c +++ b/libselinux/src/audit2why.c @@ -343,8 +343,8 @@ static PyObject *analyze(PyObject *self __attribute__((unused)) , PyObject *args if (rc < 0) RETURN(BADTCON) - tclass = string_to_security_class(tclassstr); - if (!tclass) + rc = sepol_string_to_security_class(tclassstr, &tclass); + if (rc < 0) RETURN(BADTCLASS) /* Convert the permission list to an AV. */ @@ -365,8 +365,8 @@ static PyObject *analyze(PyObject *self __attribute__((unused)) , PyObject *args permstr = PyString_AsString( strObj ); #endif - perm = string_to_av_perm(tclass, permstr); - if (!perm) + rc = sepol_string_to_av_perm(tclass, permstr, &perm); + if (rc < 0) RETURN(BADPERM) av |= perm;