diff options
| author | Nick Kralevich <nnk@google.com> | 2012-01-19 13:11:35 -0800 |
|---|---|---|
| committer | Nick Kralevich <nnk@google.com> | 2012-01-19 15:06:14 -0800 |
| commit | 5890fe33141a9efd124c86c40a8c1ff6170ecf20 (patch) | |
| tree | 20d4561a00f32e0ab2c29749c8dbbaaaad5bcbfd /adb | |
| parent | bd9206bc7399b22d3917c737bb75f8534fa77e35 (diff) | |
| download | system_core-5890fe33141a9efd124c86c40a8c1ff6170ecf20.tar.gz system_core-5890fe33141a9efd124c86c40a8c1ff6170ecf20.tar.bz2 system_core-5890fe33141a9efd124c86c40a8c1ff6170ecf20.zip | |
Don't allow adb to run as root in user builds.
Change-Id: I4fbd7beb7f76c68fead1a89b745f0dfb931b4597
Diffstat (limited to 'adb')
| -rw-r--r-- | adb/Android.mk | 4 | ||||
| -rw-r--r-- | adb/adb.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/adb/Android.mk b/adb/Android.mk index 7744d2b5..248208a0 100644 --- a/adb/Android.mk +++ b/adb/Android.mk @@ -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 */ |
