From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/openrc:0.31.x commit in: src/rc/
Date: Mon, 18 Sep 2017 18:07:19 +0000 (UTC) [thread overview]
Message-ID: <1505748522.fbab2affd2d5309ed4b5416e0e239902d77b4232.williamh@OpenRC> (raw)
commit: fbab2affd2d5309ed4b5416e0e239902d77b4232
Author: Jason Zaman <jason <AT> perfinion <DOT> com>
AuthorDate: Sun Sep 17 13:15:13 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 15:28:42 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=fbab2aff
selinux: use openrc contexts path to get contexts
The minimum requirement for libselinux is now >=2.6
The refpolicy and the gentoo policy contain the
contexts since version 2.20170204-r4
src/rc/rc-selinux.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/rc/rc-selinux.c b/src/rc/rc-selinux.c
index 2eb631a6..514ca5e5 100644
--- a/src/rc/rc-selinux.c
+++ b/src/rc/rc-selinux.c
@@ -39,7 +39,6 @@
#include "rc-selinux.h"
/* the context files for selinux */
-#define RUN_INIT_FILE "run_init_type"
#define INITRC_FILE "initrc_context"
#ifdef HAVE_AUDIT
@@ -299,6 +298,26 @@ static int read_context_file(const char *filename, char **context)
return ret;
}
+static int read_run_init_context(char **context)
+{
+ int ret = -1;
+ RC_STRINGLIST *list;
+ char *value = NULL;
+
+ list = rc_config_list(selinux_openrc_contexts_path());
+ if (list == NULL)
+ return ret;
+
+ value = rc_config_value(list, "run_init");
+ if (value != NULL && strlen(value) > 0) {
+ *context = xstrdup(value);
+ ret = 0;
+ }
+
+ rc_stringlist_free(list);
+ return ret;
+}
+
void selinux_setup(char **argv)
{
char *new_context = NULL;
@@ -312,7 +331,7 @@ void selinux_setup(char **argv)
return;
}
- if (read_context_file(RUN_INIT_FILE, &run_init_t) != 0) {
+ if (read_run_init_context(&run_init_t) != 0) {
/* assume a reasonable default, rather than bailing out */
run_init_t = xstrdup("run_init_t");
ewarn("Assuming SELinux run_init type is %s", run_init_t);
next reply other threads:[~2017-09-18 18:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-18 18:07 William Hubbs [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-09-18 18:07 [gentoo-commits] proj/openrc:0.31.x commit in: src/rc/ William Hubbs
2017-09-18 18:07 William Hubbs
2017-09-18 18:07 William Hubbs
2017-09-18 18:07 William Hubbs
2017-09-18 18:07 William Hubbs
2017-09-18 22:06 William Hubbs
2017-09-18 22:06 William Hubbs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1505748522.fbab2affd2d5309ed4b5416e0e239902d77b4232.williamh@OpenRC \
--to=williamh@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox