diff options
author | Colin Cross <ccross@android.com> | 2013-03-05 18:52:28 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-03-05 18:52:28 +0000 |
commit | 7c646cd3594283bc4aaf53a0b10143a76281270f (patch) | |
tree | 93baa842c99c8c382d6abded654281a96a0c7547 /run-as | |
parent | d1439a7f8eb228eb39dd74845a5e46d20c63b3b0 (diff) | |
parent | af4ececc7bd10aec1240acfbfe7756ab8ee16883 (diff) | |
download | system_core-7c646cd3594283bc4aaf53a0b10143a76281270f.zip system_core-7c646cd3594283bc4aaf53a0b10143a76281270f.tar.gz system_core-7c646cd3594283bc4aaf53a0b10143a76281270f.tar.bz2 |
am af4ececc: am 515bed0e: Merge "run-as: set the SELinux security context."
* commit 'af4ececc7bd10aec1240acfbfe7756ab8ee16883':
run-as: set the SELinux security context.
Diffstat (limited to 'run-as')
-rw-r--r-- | run-as/Android.mk | 2 | ||||
-rw-r--r-- | run-as/run-as.c | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/run-as/Android.mk b/run-as/Android.mk index 043cc3a..a8f2885 100644 --- a/run-as/Android.mk +++ b/run-as/Android.mk @@ -3,6 +3,8 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:= run-as.c package.c +LOCAL_SHARED_LIBRARIES := libselinux + LOCAL_MODULE:= run-as include $(BUILD_EXECUTABLE) diff --git a/run-as/run-as.c b/run-as/run-as.c index 20e1530..9eb09ae 100644 --- a/run-as/run-as.c +++ b/run-as/run-as.c @@ -29,6 +29,7 @@ #include <time.h> #include <stdarg.h> +#include <selinux/android.h> #include <private/android_filesystem_config.h> #include "package.h" @@ -162,6 +163,11 @@ int main(int argc, char **argv) return 1; } + if (selinux_android_setcontext(uid, 0, NULL, pkgname) < 0) { + panic("Could not set SELinux security context: %s\n", strerror(errno)); + return 1; + } + /* User specified command for exec. */ if (argc >= 3 ) { if (execvp(argv[2], argv+2) < 0) { |