am 515bed0e: Merge "run-as: set the SELinux security context."
* commit '515bed0e6aae4a835ab4393499c7dd99941a8423': run-as: set the SELinux security context.
This commit is contained in:
commit
af4ececc7b
2 changed files with 8 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue