Don't allow adb to run as root in user builds.

Change-Id: I4fbd7beb7f76c68fead1a89b745f0dfb931b4597
This commit is contained in:
Nick Kralevich 2012-01-19 13:11:35 -08:00
parent bd9206bc73
commit 5890fe3314
2 changed files with 8 additions and 0 deletions

View file

@ -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

View file

@ -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 */