From: Janis Danisevskis <jdanis@android.com>
To: selinux@tycho.nsa.gov, seandroid-list@tycho.nsa.gov,
sds@tycho.nsa.gov, jwcart2@tycho.nsa.gov
Cc: Janis Danisevskis <jdanis@android.com>
Subject: [PATCH 3/3] libselinux: makes android label back ends configurable
Date: Thu, 29 Sep 2016 12:39:19 +0100 [thread overview]
Message-ID: <1475149159-21757-3-git-send-email-jdanis@android.com> (raw)
In-Reply-To: <1475149159-21757-1-git-send-email-jdanis@android.com>
Android label back ends are not configurable by NO_ANDROID_BACKEND,
which is set if on ANDROID_HOST != y.
Signed-off-by: Janis Danisevskis <jdanis@android.com>
---
libselinux/src/Makefile | 3 +++
libselinux/src/label.c | 10 ++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index cba8383..7169230 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -87,6 +87,9 @@ DISABLE_FLAGS+= -DNO_MEDIA_BACKEND -DNO_DB_BACKEND -DNO_X_BACKEND \
SRCS= callbacks.c freecon.c label.c label_file.c \
label_backends_android.c regex.c label_support.c \
matchpathcon.c setrans_client.c sha1.c
+else
+DISABLE_FLAGS+= -DNO_ANDROID_BACKEND
+SRCS:= $(filter-out label_backends_android.c, $(SRCS))
endif
SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(DISABLE_FLAGS)
diff --git a/libselinux/src/label.c b/libselinux/src/label.c
index eb0e766..60639cf 100644
--- a/libselinux/src/label.c
+++ b/libselinux/src/label.c
@@ -35,6 +35,12 @@
#define CONFIG_DB_BACKEND(fnptr) &fnptr
#endif
+#ifdef NO_ANDROID_BACKEND
+#define CONFIG_ANDROID_BACKEND(fnptr) NULL
+#else
+#define CONFIG_ANDROID_BACKEND(fnptr) (&(fnptr))
+#endif
+
typedef int (*selabel_initfunc)(struct selabel_handle *rec,
const struct selinux_opt *opts,
unsigned nopts);
@@ -44,8 +50,8 @@ static selabel_initfunc initfuncs[] = {
CONFIG_MEDIA_BACKEND(selabel_media_init),
CONFIG_X_BACKEND(selabel_x_init),
CONFIG_DB_BACKEND(selabel_db_init),
- &selabel_property_init,
- &selabel_service_init,
+ CONFIG_ANDROID_BACKEND(selabel_property_init),
+ CONFIG_ANDROID_BACKEND(selabel_service_init),
};
static void selabel_subs_fini(struct selabel_sub *ptr)
--
1.9.1
next prev parent reply other threads:[~2016-09-29 11:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 11:39 [PATCH 1/3] libselinux: renamed andriod label backend source file Janis Danisevskis
2016-09-29 11:39 ` [PATCH 2/3] libselinux: android: fix lax service context lookup Janis Danisevskis
2016-09-29 11:57 ` William Roberts
2016-09-29 13:01 ` Janis Danisevskis
2016-09-29 11:39 ` Janis Danisevskis [this message]
2016-09-29 14:23 ` [PATCH 3/3] libselinux: makes android label back ends configurable Stephen Smalley
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=1475149159-21757-3-git-send-email-jdanis@android.com \
--to=jdanis@android.com \
--cc=jwcart2@tycho.nsa.gov \
--cc=sds@tycho.nsa.gov \
--cc=seandroid-list@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.