From patchwork Thu Sep 22 14:43:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Zaman X-Patchwork-Id: 9345439 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 40E18607D0 for ; Thu, 22 Sep 2016 14:45:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FBE52AB13 for ; Thu, 22 Sep 2016 14:45:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FBD12AB7A; Thu, 22 Sep 2016 14:45:49 +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-uea10.nsa.gov (emsm-gh1-uea10.nsa.gov [8.44.101.8]) (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 CC7FB2AB13 for ; Thu, 22 Sep 2016 14:45:46 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.30,378,1470700800"; d="scan'208";a="17861868" IronPort-PHdr: =?us-ascii?q?9a23=3A4YF1sxaErcv1yrc8h+WJmPD/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZpci9bnLW6fgltlLVR4KTs6sC0LuM9fi8EjNRqb+681k6OKRWUBEEjc?= =?us-ascii?q?hE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZv?= =?us-ascii?q?IaytQ8iJ3p7xj7z5pMybSj4LrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYe?= =?us-ascii?q?VcyDAgD1uSmxHh+pX4p8Y7oGxtofZpy+psGeW/Jvx5HvRkC2E9PmQ04tD7nQXS?= =?us-ascii?q?RguIoH0HWyMZlQQbLRLC6UTYV4z2tGPIv+903mHOP8TtSrYcQTm44aZtSRjuzi?= =?us-ascii?q?wAMmhqoynslsVsgfcD81qarBtlztuROdmY?= X-IPAS-Result: =?us-ascii?q?A2FlBgBC7uNX/wHyM5BeHQEFAQsBGQYMgn0TAQEBAQEegVO?= =?us-ascii?q?6dSCBe4VzTAEBAQEBAQEBAgECWyeCMgQDEwV5Wz8BBAIPKAYBAQwgDAIDCQIXK?= =?us-ascii?q?QgIAwEtAwEFAQsfCwUYBAGIKQGgeoEyPjKKVoUwAQEFiCkIEIQXingCEQGFeo8?= =?us-ascii?q?vikuPaGWIcSWFbQJIjloxgRFUgwsOHIFdZQGFLA8XYYEnAQEB?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea10.nsa.gov with ESMTP; 22 Sep 2016 14:45:16 +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 u8MEiDs5011527; Thu, 22 Sep 2016 10:44:27 -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 u8MEiBU5125780 for ; Thu, 22 Sep 2016 10:44:11 -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 u8MEiBNC011523 for ; Thu, 22 Sep 2016 10:44:11 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1B+AgAV7eNXekLcVdFeg1gTAQEBAQGBcbZphBOGHoFpTAECAQEBAQECEwEBCQsMCBmFEwEVLgEBNwGBFAEFATUiiCkBoHeBMj4yilaFMAEBBYgBASgIEIQXiniCfAuDB48vikuPaGWIcYYSAkiOWjGBEYNtHIFdZQGFLIIuAQEB X-IPAS-Result: A1B+AgAV7eNXekLcVdFeg1gTAQEBAQGBcbZphBOGHoFpTAECAQEBAQECEwEBCQsMCBmFEwEVLgEBNwGBFAEFATUiiCkBoHeBMj4yilaFMAEBBYgBASgIEIQXiniCfAuDB48vikuPaGWIcYYSAkiOWjGBEYNtHIFdZQGFLIIuAQEB X-IronPort-AV: E=Sophos;i="5.30,378,1470715200"; d="scan'208";a="5722078" 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; 22 Sep 2016 10:44:10 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3Aol0nKxI7e7GITB/icdmcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgUKf7xwZ3uMQTl6Ol3ixeRBMOAuqgC07ad7PuocFdDyK7JiGoFfp1IWk1Nou?= =?us-ascii?q?QttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXsq3G/pQQfBg/4fVIs?= =?us-ascii?q?YL+kQMiK04/ojKibwN76W01wnj2zYLd/fl2djD76kY0ou7ZkMbs70RDTo3FFKK?= =?us-ascii?q?x8zGJsIk+PzV6nvp/jtM0rzyMFoP8l9shdQY3mbq84SvpeFz1gPGcrt+PxshyW?= =?us-ascii?q?bwKU4X1UYGwTmxwAVwrM9xb8do/8qCX7sOt63m+ROsigHuN8Yiir86o+EEygsy?= =?us-ascii?q?wALTNsqGw=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0FcBACW7eNXekLcVdFeg1gTAQEBAQGBc?= =?us-ascii?q?bZphBOCFIQKgWlMAQEBAQEBAQECAQIQAQEJCwwIGS+CMhiBAFs/ARUuAQE3AYE?= =?us-ascii?q?UAQUBNSKIKQGgeIEyPjKKVoUwAQEFiAABKAgQhBeKeIJ8C4MHjy+KS49oZYhxh?= =?us-ascii?q?hICSI5aMYERg20cgV1lAYUsgi4BAQE?= X-IPAS-Result: =?us-ascii?q?A0FcBACW7eNXekLcVdFeg1gTAQEBAQGBcbZphBOCFIQKgWl?= =?us-ascii?q?MAQEBAQEBAQECAQIQAQEJCwwIGS+CMhiBAFs/ARUuAQE3AYEUAQUBNSKIKQGge?= =?us-ascii?q?IEyPjKKVoUwAQEFiAABKAgQhBeKeIJ8C4MHjy+KS49oZYhxhhICSI5aMYERg20?= =?us-ascii?q?cgV1lAYUsgi4BAQE?= X-IronPort-AV: E=Sophos;i="5.30,378,1470700800"; d="scan'208";a="19467169" Received: from mail-pa0-f66.google.com ([209.85.220.66]) by emsm-gh1-uea11.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 22 Sep 2016 14:44:08 +0000 Received: by mail-pa0-f66.google.com with SMTP id oz2so3771162pac.0 for ; Thu, 22 Sep 2016 07:44:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=perfinion-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=i6ajs20PpLZhzOR1BaC62lOo5psaHQ+TVB0Ryo4yLPU=; b=EftwlfAabi2bw+P5PyDMnht2qSOrItlkSaSfb5kG8kjJHo12UzbblbnlzoDP19y4kU ux+pFsTcaYnooIumR+GOMc22unNZHSXvyorpt0XcHz53EizRYitiPiKWG+y500s9ubYk uH0gfLaS74iD3dNE+wGdQiFfBBxJtHn1O3mirDM7raCKl9yawTblfNc+gNo2Amjj7jOx 7lrc8ch5e4ThRwyhvivSJ3b8L36TMugb0POlgoxxih7jPjHFCJYt7VOq+zGM7PcPN05x /xrWxQSiZnZaKItTQongjEUMXSMzbXHEH+D9GKDJJaAK3ZHSIrsK3nRONo93FW3ZsqxE NNAA== 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=i6ajs20PpLZhzOR1BaC62lOo5psaHQ+TVB0Ryo4yLPU=; b=FSkXSWAadW1KTuza6ixesd6i7/rIxiwzbn8vxbZOFVd4dAXu7tNwCiMnLuZ0mu78l9 Jqqzzxjgd6aeHfoiLVCEgwj3mmX+EdMy5JUAVXJEHTxUF8p2cCS9Y5YJgNo6dFTL4qpf zY/xFYDa3u5pG1PnHixPPB3wlps+WjvhCxxZf++/gb9mXri7Qh1KtwxpXCavTNFOcbKV 8F5ItuHfDzQdbKsl46SJuIPjIL6lbGizQ+msmfaANH1dIn9TcKyhQlOiJsy2ZKCGsK3d Ij8e1XXAeuqMciNyNYdM5AeKCHBhMCP3tuBKzzjec3wsIGEjiKbzqnQzmMQbJn9mOBol w/jw== X-Gm-Message-State: AE9vXwNEksAl6lmdi+ruK+JQVAsRfgRyEnD656KuUmdq+vfGwwihGVLPGZIZLz9Qlg7VHA== X-Received: by 10.66.157.166 with SMTP id wn6mr3973796pab.42.1474555447309; Thu, 22 Sep 2016 07:44:07 -0700 (PDT) Received: from localhost ([2404:e800:e600:57b:e014:183:951f:342c]) by smtp.gmail.com with ESMTPSA id mz4sm4797718pab.21.2016.09.22.07.44.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Sep 2016 07:44:06 -0700 (PDT) From: Jason Zaman To: selinux@tycho.nsa.gov Subject: [PATCH] libselinux: Add openrc_contexts functions Date: Thu, 22 Sep 2016 22:43:57 +0800 Message-Id: <1474555437-7557-1-git-send-email-jason@perfinion.com> X-Mailer: git-send-email 2.7.3 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 The file will initially contain: run_init=run_init_t There can not be any spaces around the = since OpenRC's existing config files and the methods it uses require it. Signed-off-by: Jason Zaman --- libselinux/include/selinux/selinux.h | 1 + libselinux/src/file_path_suffixes.h | 1 + libselinux/src/selinux_config.c | 10 +++++++++- libselinux/src/selinux_internal.h | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h index 3d8673f..45dd6ca 100644 --- a/libselinux/include/selinux/selinux.h +++ b/libselinux/include/selinux/selinux.h @@ -543,6 +543,7 @@ extern const char *selinux_virtual_image_context_path(void); extern const char *selinux_lxc_contexts_path(void); extern const char *selinux_x_context_path(void); extern const char *selinux_sepgsql_context_path(void); +extern const char *selinux_openrc_contexts_path(void); extern const char *selinux_openssh_contexts_path(void); extern const char *selinux_snapperd_contexts_path(void); extern const char *selinux_systemd_contexts_path(void); diff --git a/libselinux/src/file_path_suffixes.h b/libselinux/src/file_path_suffixes.h index 95b228b..2d3ca49 100644 --- a/libselinux/src/file_path_suffixes.h +++ b/libselinux/src/file_path_suffixes.h @@ -23,6 +23,7 @@ S_(BINPOLICY, "/policy/policy") S_(VIRTUAL_DOMAIN, "/contexts/virtual_domain_context") S_(VIRTUAL_IMAGE, "/contexts/virtual_image_context") S_(LXC_CONTEXTS, "/contexts/lxc_contexts") + S_(OPENRC_CONTEXTS, "/contexts/openrc_contexts") S_(OPENSSH_CONTEXTS, "/contexts/openssh_contexts") S_(SNAPPERD_CONTEXTS, "/contexts/snapperd_contexts") S_(SYSTEMD_CONTEXTS, "/contexts/systemd_contexts") diff --git a/libselinux/src/selinux_config.c b/libselinux/src/selinux_config.c index c519a77..88bcc85 100644 --- a/libselinux/src/selinux_config.c +++ b/libselinux/src/selinux_config.c @@ -51,7 +51,8 @@ #define OPENSSH_CONTEXTS 28 #define SYSTEMD_CONTEXTS 29 #define SNAPPERD_CONTEXTS 30 -#define NEL 31 +#define OPENRC_CONTEXTS 31 +#define NEL 32 /* Part of one-time lazy init */ static pthread_once_t once = PTHREAD_ONCE_INIT; @@ -493,6 +494,13 @@ const char *selinux_lxc_contexts_path(void) hidden_def(selinux_lxc_contexts_path) +const char *selinux_openrc_contexts_path(void) +{ + return get_path(OPENRC_CONTEXTS); +} + +hidden_def(selinux_openrc_contexts_path) + const char *selinux_openssh_contexts_path(void) { return get_path(OPENSSH_CONTEXTS); diff --git a/libselinux/src/selinux_internal.h b/libselinux/src/selinux_internal.h index 9b9145c..3d5c9fb 100644 --- a/libselinux/src/selinux_internal.h +++ b/libselinux/src/selinux_internal.h @@ -83,6 +83,7 @@ hidden_proto(selinux_mkload_policy) hidden_proto(selinux_media_context_path) hidden_proto(selinux_x_context_path) hidden_proto(selinux_sepgsql_context_path) + hidden_proto(selinux_openrc_contexts_path) hidden_proto(selinux_openssh_contexts_path) hidden_proto(selinux_snapperd_contexts_path) hidden_proto(selinux_systemd_contexts_path)