Don't allow adb to run as root in user builds.
Change-Id: I4fbd7beb7f76c68fead1a89b745f0dfb931b4597
This commit is contained in:
parent
bd9206bc73
commit
5890fe3314
2 changed files with 8 additions and 0 deletions
|
|
@ -133,6 +133,10 @@ ifeq ($(TARGET_ARCH),arm)
|
|||
LOCAL_CFLAGS += -DANDROID_GADGET=1
|
||||
endif
|
||||
|
||||
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
|
||||
LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
|
||||
endif
|
||||
|
||||
LOCAL_MODULE := adbd
|
||||
|
||||
LOCAL_FORCE_STATIC_EXECUTABLE := true
|
||||
|
|
|
|||
|
|
@ -844,6 +844,9 @@ void build_local_name(char* target_str, size_t target_size, int server_port)
|
|||
|
||||
#if !ADB_HOST
|
||||
static int should_drop_privileges() {
|
||||
#ifndef ALLOW_ADBD_ROOT
|
||||
return 1;
|
||||
#else /* ALLOW_ADBD_ROOT */
|
||||
int secure = 0;
|
||||
char value[PROPERTY_VALUE_MAX];
|
||||
|
||||
|
|
@ -869,6 +872,7 @@ static int should_drop_privileges() {
|
|||
}
|
||||
}
|
||||
return secure;
|
||||
#endif /* ALLOW_ADBD_ROOT */
|
||||
}
|
||||
#endif /* !ADB_HOST */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue